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 have a postfix installation handling mail for a couple of domains, for which all mail goes to one real local user (cmb), and I want to add a new domain (let's call it example.org) for a second user, but everything is being delivered to cmb. Here is /etc/postfix/virtual:

chris@boyle.name cmb
@chris.boyle.name cmb
@cmb.is-a-geek.org cmb
@example.org newperson

Here is most of /etc/postfix/main.cf, full file on request. I have not set luser_relay.

myhostname = nova.chris.boyle.name
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = chris.boyle.name
mydestination = chris.boyle.name, nova.chris.boyle.name, nova, localhost.localdomain, localhost
mynetworks_style = host
mailbox_command = procmail -a "$EXTENSION"
virtual_alias_domains   = cmb.is-a-geek.org example.org
virtual_alias_maps      = hash:/etc/postfix/virtual
smtpd_sender_login_maps = hash:/etc/postfix/virtual

Here is /etc/aliases:

# See man 5 aliases for format
postmaster: cmb
root: cmb

Note that aliases.db and virtual.db are both more recent than their plain-text counterparts, and postfix has been restarted to no effect. A test mail to test@example.org does this in mail.log (I've edited this log extract to make the domain example.org).

Aug 30 12:48:59 nova postfix/smtpd[32520]: 795B53D558: client=goggins.uwcs.co.uk[89.16.166.19]
Aug 30 12:48:59 nova postfix/cleanup[32530]: 795B53D558: message-id=<20090830114859.GA15341@warwickcompsoc.co.uk>
Aug 30 12:48:59 nova dkim-filter[2074]: 795B53D558 external host goggins.uwcs.co.uk attempted to send as uwcs.co.uk
Aug 30 12:48:59 nova dkim-filter[2074]: 795B53D558 ASP query: missing parameter(s) in policy data
Aug 30 12:48:59 nova spamd[2385]: spamd: connection from localhost [127.0.0.1] at port 38371 
Aug 30 12:49:00 nova spamd[2385]: spamd: using default config for test@example.org: /srv/chris.boyle.name/spamassassin/user_prefs 
Aug 30 12:49:00 nova spamd[2385]: spamd: processing message <20090830114859.GA15341@warwickcompsoc.co.uk> for test@example.org:1000 
Aug 30 12:49:05 nova spamd[2385]: spamd: clean message (-5.2/5.0) for test@example.org:1000 in 5.3 seconds, 1002 bytes. 
Aug 30 12:49:05 nova spamd[2385]: spamd: result: . -5 - AWL,BAYES_00,LOCALPART_IN_SUBJECT,RCVD_IN_DNSWL_MED,SPF_PASS,UNPARSEABLE_RELAY scantime=5.3,size=1002,user=test@example.org,uid=1000,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=38371,mid=<20090830114859.GA15341@warwickcompsoc.co.uk>,bayes=0.000000,autolearn=ham 
Aug 30 12:49:05 nova postfix/qmgr[32518]: 795B53D558: from=<cmb@warwickcompsoc.co.uk>, size=966, nrcpt=1 (queue active)
Aug 30 12:49:05 nova postfix/smtpd[32520]: disconnect from goggins.uwcs.co.uk[89.16.166.19]
Aug 30 12:49:05 nova postfix/local[32533]: 795B53D558: to=<cmb@chris.boyle.name>, orig_to=<test@example.org>, relay=local, delay=6.1, delays=6.1/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Aug 30 12:49:05 nova postfix/qmgr[32518]: 795B53D558: removed

Notice it being delivered to cmb at the end: I'd really love to know why.

share|improve this question

migrated from superuser.com Aug 30 '09 at 17:21

This question came from our site for computer enthusiasts and power users.

1 Answer 1

up vote 0 down vote accepted

Robot101 helped me solve this. The trick is that virtual_alias_maps will effectively recurse until the address is unchanged, and unqualified local parts on the right-hand side of the map will be qualified with myorigin, so this happens:

foo@example.org  -> newperson@chris.boyle.name -> cmb@chris.boyle.name

I can therefore work around it by changing myorigin to nova.chris.boyle.name (and fixing my address canonicalisation (using canonical_maps) to use @chris.boyle.name in sender addresses). This way, the mapping is onto foo@nova.chris.boyle.name, which the map will not alter any further, and which still has this machine as its final destination. Alternatively, I could have fully qualified the mappings with @nova.chris.boyle.name.

share|improve this answer

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.