2

I have set up a Postfix mail server which uses Courier in order to provide an SMTP service. On my server there is a user called joe.

I used alias maps to make mail to test@example.com redirect to joe using test: joe in my /etc/aliases. Seeing as there is just one email address and one domain, I don't want to use MySQL to manage aliases as this seems to be a massive overkill for my scenario.

I have two questions...

  1. People can send mail to joe@example.com as well as test@example.com and it will still go to the account joe. I don't particularly want this, primarily as I am worried people could start spamming system user accounts. Is there a way to disable this?

  2. When I use Courrier-IMAP to login to IMAP, is there a way I can login with test or test@example.com as my username rather than joe? I would not like to create a user called test if at all possible.

Thanks :)

Zak
  • 81
  • 7
  • I'm sorry, but I don't understand what you want to do in 1. Do you want to receive mail for test@example.com but not joe@example.com? Do you want to receive mail for test@example.com and joe@example.com separately, as if they were two different accounts? – rsuarez Feb 27 '17 at 11:53
  • The first option – Zak Feb 27 '17 at 12:00

3 Answers3

1

About your 1st question, if you already set test to go to joe then it will go to joe, as you made test an alias to joe and joe is the main account. You must make a new user name for test if you wanted it to be an account and not just an alias.

If you want to disable test, then redirect it to nobody test: nobody and nobody change it from nobody: root to nobody: /dev/null.

And about your 2nd question you can't login with an alias as it has no password, and it's not an account. The alias only redirects to an account that have a user name and password.

Talal Al-Khalifa
  • 648
  • 5
  • 12
  • Thanks for taking the time to answer my question. However, you have slightly misinterpreted the first part. **I do not want to disable `test`.** When someone emails `test@example.com` the server should redirect the email to the account `joe` but when someone emails `joe@example.com` (or any other user accounts e.g. `mary@example.com`) it should reject the email. – Zak Feb 28 '17 at 18:02
  • @Zak if the email to anything goes to joe it means you have set root at root: joe@example.com so you have to set an account to recive root messages on and make joe as user like this joe: joe@example.com – Talal Al-Khalifa Feb 28 '17 at 18:31
  • I'm not quite understanding your comment. However, the first part is not what I mean at all. The only thing that should go to `joe` is `test@example.com`. Emails to any other address at `example.com` (apart from to `test@example.com`) should be rejected. – Zak Feb 28 '17 at 18:35
  • " you have slightly misinterpreted the first part" : maybe you can edit your question : people having the same problem will be more likely to find your post – bgtvfr Mar 01 '17 at 14:15
1

I think part of the confusion is around the role of an alias: AFAIK, the concept of the alias is that both the aliased and 'real' inboxes work.

If you want test without exposing joe, create an inbox for test, but not for joe.

You could, I guess, create some config to manually reject emails to joe other than those coming from your own domain, but that seems a complicated and fragile way of getting what you want.

Not completely sure if Courier can do it, but I know dovecot allows you to set up 'public' or shared inboxes, which might be a better fit for what you seem to be trying to do.

Edit:

Thinking about it, you could abuse domains to achieve what you want: have postfix accept incoming email for (e.g.) example.com, and alias to secret.example.com/example.local (or whatever seems reasonable to you).

So long as your server doesn't accept emails to example.local other than from itself, I think that could do what you are hoping to do.

iwaseatenbyagrue
  • 3,588
  • 12
  • 22
0
  1. If i understand your question correctly, you want to receive all mail for test@example.com, but none of the mails sent to joe@example.com

Well, you can use mailfilter to move to trash all the mail destinated to joe@example.com

  1. As far as I know, you can't.
bgtvfr
  • 1,224
  • 10
  • 19
  • Sounds great, but will mailfilter be able to delete emails to **all addresses apart from `test`** (e.g. `mary` and `bob` as well) rather than deleting **only emails to `joe`**. – Zak Feb 28 '17 at 18:04
  • Yes you can use a regexp to target all mails not matching "to : test@example.com" – bgtvfr Mar 01 '17 at 14:12