3

I could not make Postfix work with Linux usernames containing @

Postfix has virtual domain map, in /etc/postfix/virtual

It looks something like this:

domain.ru                       domain.ru
administrator@domain.ru         me@example.ru
moderator@domain.ru             me@example.ru

It means that all mail going to users administrator@domain.ru and moderator@domain.ru must be delivered to the Linux user with name me@example.ru

However, when I use no @ in Linux username, like me.example.ru, things work regular way.

I found out that saslauth rejected to work with me@example.ru unless it's load with -r flag. Is there something familiar should be done to Postfix, to make it work the same way?

I also tried me\@example.ru, escaping it. No effect. What am I missing?

  • How do you want to treat/deliver messages to OTHER addresses in example.ru? – AnFi Jul 30 '15 at 14:48
  • They have the same structure as the example above but just for example.ru – Ilia Rostovtsev Jul 30 '15 at 16:21
5

According to hints from postfix-users@postfix.org you should use virtual mailer instead of local mailer for deliveries to me@example.ru.

As I understand you may:
1. Put example.ru domain in virtual_mailbox_domains list
2. Use virtual mailbox map (vmailbox) to specify location of me@example.ru mailbox-file/maildir
3. Use virtual uid map to set owner of me@example.ru mailbox file(s)
[it selects OS account/user (numerical) identifier]

http://www.postfix.org/VIRTUAL_README.html#virtual_mailbox


[postfix-users] OS accounts/users with @

To: postfix-users at postfix org
Subject: Re: OS accounts/users with @
Date: Thu, 30 Jul 2015 11:21:12 -0400 (EDT)
Message-Id: <3mhwS83SMSzJrQ1@spike.porcupine.org>
From: wietse@porcupine.org (Wietse Venema)
[...]
In any case, using UNIX system account names with @ is a mistake, and I will not put in a great deal of effort to make that easy.

Wietse

  • I think I got it now. Thanks for extra, interesting investigation on Google Groups – Ilia Rostovtsev Jul 30 '15 at 22:40
2

What directive used in main.cf for that /etc/postfix/virtual ? There're a bunch of maps.

I would use for such things in main.cf just

recipient_bcc_maps = hash:/usr/local/etc/postfix/recipient_bcc
sender_bcc_maps = hash:/usr/local/etc/postfix/sender_bcc

where you can manipulate with copies of sent/received emails.

Syntax of recipient_bcc/sender_bcc is pretty simple (as all in postfix)

# Email to catch                       email to send copy
administartor@domain.ru                realAdmin@SomeDomain.ru
moderator@domain.ru                    realAdmin@SomeDomain.ru

Advantage of using bcc - You can assign some admin and monitor him or keep related to administartor@domain.ru emails in his account and keep clean realAdmin@SomeDomain.ru account, when you get msg you can safely delete it since you know you always have a copy in real account. If assigned admin delete some msg, you anyway will have a copy as evidence if he/she something wrong.

  • There is no directives should be in main.cf about virtual domains. I'm not sure how your answer will help me to solve my problem. The problem is, that Postifix needs additional settings (if there are any in this concern) to make it work. – Ilia Rostovtsev Jul 28 '15 at 21:34
  • recipient_bcc_maps is not related to virtual domains only, it catching every emails passed through the server. This directive used in main.cf as a global parameters and just point to external file shown above. If you won't such solution as bcc check, then you need to use virtual_alias_maps – Alex Jul 28 '15 at 22:34
  • BTW, "There is no directives should be in main.cf about virtual domains." - If main.cf will not have directive about virtual domains, then how did you point to /etc/postfix/virtual ? – Alex Jul 28 '15 at 22:37
  • The problem is that realAdmin@SomeDomain.ru is local Linux username and it falls into loop. – Ilia Rostovtsev Jul 28 '15 at 22:38
  • 1
    Alex, my question was about how to make things work differently, when they already work find the way they are. In case, in virtual I set destination user as me.example.ru - it's all fine then BUT if I use me@example.ru, then Postfix says unknown user!? What should I do? – Ilia Rostovtsev Jul 29 '15 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.