Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to set up a local mailserver. I run Mac OS X Server 10.6 Snow Leopard, and it uses Postfix as server. I set the server up using the GUI and I'm doing all virtual settings via the terminal.

The situation: the server is on a domain, let's call it "domain.com". I have multiple virtual aliases, for now let's say "alias.com". I have a user "postmaster" on the server.

My goal: I'd like to setup some aliases (postmaster, root, mailer-daemon, etc.) that work for all domains/aliases without having to set it up every time I add an alias domain.

Summary/to the point question: how can I set up aliases that work automatically for all virtual domains?

Current progress: using the current configuration, I receive all messages to root@domain.com, postmaster@domain.com, etc...@domain.com. But when I send a message to root@alias.com (or postmaster@alias.com), the message is returned.

Error message:

Aug 17 23:53:54 home postfix/smtpd[11903]: connect from SERVER[IP]
Aug 17 23:53:54 home postfix/smtpd[11903]: NOQUEUE: reject: RCPT from SERVER[IP]: 550 5.1.1 <postmaster@alias.com>: Recipient address rejected: User unknown in virtual alias table; from=<FROM> to=<postmaster@alias.com> proto=ESMTP helo=<SERVER>
Aug 17 23:53:55 home postfix/smtpd[11903]: disconnect from SERVER[IP]

My configuration:

bash-3.2# postconf -n
virtual_alias_domains = $virtual_alias_maps hash:/etc/postfix/virtual_domains
virtual_alias_maps = hash:/etc/postfix/virtual_users

Contents of /etc/postfix/virtual_domains:

alias.com             allow

Contents of /etc/postfix/virtual_users:

jonathan@alias.com    jonathan
info@alias.com        jonathan
support@alias.com     jonathan

Contents of /etc/aliases:

root:                 postmaster
MAILER-DAEMON:        postmaster

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

manager:              root
dumper:               root
operator:             root
abuse:                postmaster

decode:               root

I've googled a lot, but I can't find real solutions. I hope you guys come up with some genius plan :-)

Thanks! Jonathan

share|improve this question

1 Answer 1

up vote 7 down vote accepted

I got this awesome link from a tweep and it worked perfectly! If you are looking for the answer, here is my solution. (You need to combine this with the /etc/aliases from my first post, this snippet is only for the virtual domain aliases.)

Configuration

virtual_alias_maps = regexp:/etc/postfix/virtual_users_global hash:/etc/postfix/virtual_users

/etc/postfix/virtual_users_global

# Short version:

/^(postmaster|root|MAILER-DAEMON|abuse)@/   postmaster
/^(bin|daemon|named|nobody|uucp|www|ftp-bugs|postfix|manager|dumper|operator|decode)@/  root

# Or the long version:

/^postmaster@/         postmaster
/^root@/               postmaster
/^MAILER-DAEMON@/      postmaster

/^bin@/                root
/^daemon@/             root
/^named@/              root
/^nobody@/             root
/^uucp@/               root
/^www@/                root
/^ftp-bugs@/           root
/^postfix@/            root

/^manager@/            root
/^dumper@/             root
/^operator@/           root
/^abuse@/              postmaster

/^decode@/             root
share|improve this answer
    
this won't capture also mails to external domains? i.e. if one of your users sends email to postmaster@external.com –  tictacbum Oct 17 at 9:07
    
@tictacbum yes, you are right! I have just verified on my similar setup and this catches all emails to external addresses that have the local part identical to local addresses. I fixed it by explicitely setting the complete address including virtual domain name instead of just the local part of the email address. –  Costin Gușă Nov 18 at 15:37
    
@CostinGușă here you can see what I've configured to add these aliases: serverfault.com/questions/637764/… –  tictacbum Nov 19 at 8:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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