Postfix: virtual_alias_maps delivering everything to one user despite new domain

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:

[email protected] 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 [email protected] 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=<[email protected]>
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 [email protected]: /srv/chris.boyle.name/spamassassin/user_prefs 
Aug 30 12:49:00 nova spamd[2385]: spamd: processing message <[email protected]> for [email protected]:1000 
Aug 30 12:49:05 nova spamd[2385]: spamd: clean message (-5.2/5.0) for [email protected]: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,[email protected],uid=1000,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=38371,mid=<[email protected]>,bayes=0.000000,autolearn=ham 
Aug 30 12:49:05 nova postfix/qmgr[32518]: 795B53D558: from=<[email protected]>, 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=<[email protected]>, orig_to=<[email protected]>, 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.


Solution 1:

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:

[email protected]  -> [email protected] -> [email protected]

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 [email protected], 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.