4

I have a mail server set up which is responsible for several virtual users and domains. These mails are delivered fine to the respective mailbox.

But I can't get local delivery for system accounts (root, http, ...) to work. This is my alias file:

root:           <local_user>
<local_user>:   <[email protected]>

MAILER-DAEMON:  postmaster
postmaster:     root

bin:            root
daemon:         root
named:          root
nobody:         root
uucp:           root
www:            root
ftp-bugs:       root
postfix:        root
http:           root

This is the relevant part of /etc/postfix/main.cf:

alias_database = $alias_maps
alias_maps = hash:/etc/postfix/aliases
append_dot_mydomain = no
html_directory = no
inet_protocols = ipv4
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = localhost.$mydomain, localhost, localhost.localdomain
mydomain = <mydomain.org>
myhostname = <myhost.mydomain.org>
mynetworks_style = host
myorigin = $mydomain
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = <mydomain.org mydomain2.org mydomain3.org ...>
virtual_mailbox_maps = hash:/etc/postfix/vmailbox

Values in <...> are obviously placeholders.

When I locally send a mail to root. Postfix completes the address to [email protected], which it then wants to deliver via virtual but of course [email protected] is not a valid virtual address (and it should not be).

It would work if the address is completed to root@localhost for local delivery. But when sending emails.

How would I accomplish that? Or what else should I do to get local delivery to work? Thanks for your help.

/e: added mydomain = <mydomain.org> to above config output, because that wasn't obvious.

4
  • Have you tried root <[email protected]> instead?
    – NickW
    Jun 3, 2013 at 16:31
  • @NickW No it somehow gets expanded to [email protected] before the alias lookup. So that should not change anything.
    – BubuIIC
    Jun 3, 2013 at 16:44
  • Ah, I was assuming you had mydomain.org as $mydomain
    – NickW
    Jun 3, 2013 at 16:48
  • @NickW I have. But still happens as described above. /e: maybe because it's also a virtual domain?
    – BubuIIC
    Jun 3, 2013 at 16:53

3 Answers 3

1

Try adding to your mydestination definition

mydestination = localhost.$mydomain, localhost, localhost.localdomain, <mydomain.org>

Or, change the email to go to root@localhost.

Me, I stopped using local account for any email and have all system accounts configured as virtual domains. Then I can run email for the system using the same set of tools as I do for the virtual domains (and the mail is all stored in the same place).

I'm not sure that your current config will block email to root that comes from outside the box. You might want to test that.

1

By default postfix will append $myorigin whenever the recipient part doesn't have valid domain. This behavior was controlled by append_dot_mydomain parameter (default: yes). You can read some rewriting schema that postfix do in this page.

Because myorigin was set as $mydomain, then you get behavior you described above

When I locally send a mail to root. Postfix completes the address to [email protected], which it then wants to deliver via virtual but of course [email protected] is not a valid virtual address (and it should not be).


Solution

Change the myorigin to localhost.$mydomain. It will set the completion address to localhost.$mydomain. Because localhost.$mydomain was defined in mydestination then postfix will use /etc/aliases to perform aliasing.

0

One solution is to just add the virtual domain (typically the fully qualified hostname) and virtual mailbox definitions for all of the local accounts that you want to allow to send mail.

2
  • I have considered that, but I don't want [email protected] expsoed to the outside world. Only local delivery should be allowed to root.
    – BubuIIC
    Jun 3, 2013 at 16:37
  • Take a look at postfix.org/RESTRICTION_CLASS_README.html -- you can setup per-address restriction lists. In our setup, we use root@, postgres@, etc. as convenient ways of gathering spam samples to feed to spamassassin's sa-learn.
    – tgharold
    Jun 3, 2013 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .