I thought I had set up postfix to receive email to a catchall address at my domain and run a command as a certain user (on my box).
This is not the case, because if I email 'brian@domain.com' and there is a 'brain' user on my box, postfix tries to send the email to his mailbox, when what I wanted was for it to execute a command as another user.
Here are some relevant configs:
main.cf:
myhostname = li133-75.members.linode.com
#alias_maps = hash:/etc/aliases
#alias_database = hash:/etc/aliases
mydestination = pcre:/etc/postfix/mydestinations
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
virtual_alias_maps = pcre:/etc/postfix/virtual
luser_relay = destructly
local_recipient_maps =
mailbox_command = /usr/local/bin/node /home/destructly/parser/server.js
parent_domain_matches_subdomains=
mydestinations
/^li133-75\.members\.linode.com$/ ACCEPT
/^localhost\.members\.linode.com$/ ACCEPT
/^localhost$/ ACCEPT
/^.*\.destructly\.com$/ ACCEPT
virtual
/^.*@destructly\.com$/ destructly
I am a complete n00b at postfix, but my motivation for this config was that I would want to set up postfix to call other commands for other domains on my box, so I don't want to have one command for all emails that come into my box.
Edit: Logs
Here is a log of an email that worked as expected. i.e: i sent to a non-existing user and my mailbox_command was called:
Feb 14 16:49:57 dogself postfix/smtpd[793]: connect from mail-wi0-f173.google.com[209.85.212.173]
Feb 14 16:49:58 dogself postfix/smtpd[793]: 7C8738115: client=mail-wi0-f173.google.com[209.85.212.173]
Feb 14 16:49:58 dogself postfix/cleanup[796]: 7C8738115: message-id=<CALKwPdZn3tFFMz8QL-FKCXSA_-_Z0+AkxgeXB40gbJVn7GeN_Q@mail.gmail.com>
Feb 14 16:49:58 dogself postfix/qmgr[784]: 7C8738115: from=<misha@openmile.com>, size=2281, nrcpt=1 (queue active)
Feb 14 16:49:58 dogself postfix/local[797]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 14 16:49:58 dogself postfix/smtpd[793]: disconnect from mail-wi0-f173.google.com[209.85.212.173]
Feb 14 16:49:59 dogself postfix/local[797]: 7C8738115: to=<destructly@li133-75.members.linode.com>, orig_to=<petvirus@gmail.com.destructly.com>, relay=local, delay=1.3, delays=0.26/0.01/0/1, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/node /home/destructly/parser/server.js)
Feb 14 16:49:59 dogself postfix/qmgr[784]: 7C8738115: removed
Here is an email sent to an existing user on the box. My mailbox command is not called using the correct user, thus the error:
Feb 14 16:50:42 dogself postfix/smtpd[793]: connect from mail-wi0-f177.google.com[209.85.212.177]
Feb 14 16:50:42 dogself postfix/smtpd[793]: 9A78C8115: client=mail-wi0-f177.google.com[209.85.212.177]
Feb 14 16:50:42 dogself postfix/cleanup[796]: 9A78C8115: message-id=<CALKwPdZa064fWkc5U2YsaUM1m3bvdS-v-gBacefq1giD+MeaEw@mail.gmail.com>
Feb 14 16:50:42 dogself postfix/qmgr[784]: 9A78C8115: from=<misha@openmile.com>, size=2283, nrcpt=1 (queue active)
Feb 14 16:50:42 dogself postfix/local[797]: 9A78C8115: to=<brian@openmile.com.destructly.com>, relay=local, delay=0.31, delays=0.25/0/0/0.06, dsn=5.3.0, status=bounced (Command died with status 1: "/usr/local/bin/node /home/destructly/parser/server.js". Command output: module.js:340 throw err; ^ Error: Cannot find module '/home/destructly/parser/server.js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9))
Feb 14 16:50:42 dogself postfix/cleanup[796]: D0E9F8117: message-id=<20130214165042.D0E9F8117@li133-75.members.linode.com>
Feb 14 16:50:42 dogself postfix/bounce[803]: 9A78C8115: sender non-delivery notification: D0E9F8117
Feb 14 16:50:42 dogself postfix/qmgr[784]: D0E9F8117: from=<>, size=4959, nrcpt=1 (queue active)
Feb 14 16:50:42 dogself postfix/qmgr[784]: 9A78C8115: removed
Feb 14 16:50:42 dogself postfix/smtpd[793]: disconnect from mail-wi0-f177.google.com[209.85.212.177]
Feb 14 16:50:43 dogself postfix/smtp[804]: D0E9F8117: to=<misha@openmile.com>, relay=ASPMX.L.GOOGLE.com[74.125.134.26]:25, delay=0.66, delays=0/0.01/0.08/0.58, dsn=2.0.0, status=sent (250 2.0.0 OK 1360860643 z5si23425577ani.83 - gsmtp)
Feb 14 16:50:43 dogself postfix/qmgr[784]: D0E9F8117: removed
Feb 14 16:54:03 dogself postfix/anvil[787]: statistics: max connection rate 1/60s for (smtp:74.125.82.178) at Feb 14 16:48:06
Feb 14 16:54:03 dogself postfix/anvil[787]: statistics: max connection count 1 for (smtp:74.125.82.178) at Feb 14 16:48:06
Feb 14 16:54:03 dogself postfix/anvil[787]: statistics: max cache size 2 at Feb 14 16:50:42
(I was using mailbox_command_maps previously, and in that case the command was no called at all)
mailbox_command_maps:
destructly /usr/local/bin/node /home/destructly/parser/server.js
Here is the log of it not being called when using mailbox_command_maps:
Feb 14 16:36:26 dogself postfix/local[576]: 5A8108115: to=<destructly@li133-75.members.linode.com>, orig_to=<koryak@gmail.com.destructly.com>, relay=local, delay=1.3, delays=0.26/0.01/0/1.1, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/node /home/destructly/parser/server.js)
Feb 14 16:36:26 dogself postfix/qmgr[31228]: 5A8108115: removed
Feb 14 16:38:18 dogself postfix/smtpd[580]: connect from mail-wi0-f179.google.com[209.85.212.179]
Feb 14 16:38:19 dogself postfix/smtpd[580]: 5A6C08115: client=mail-wi0-f179.google.com[209.85.212.179]
Feb 14 16:38:19 dogself postfix/cleanup[583]: 5A6C08115: message-id=<CALKwPda6e3NDzzAxnqJaZGaD+38sfq94NG_Jy1VMLQOABMUmbw@mail.gmail.com>
Feb 14 16:38:19 dogself postfix/qmgr[31228]: 5A6C08115: from=<misha@openmile.com>, size=2305, nrcpt=1 (queue active)
Feb 14 16:38:19 dogself postfix/local[584]: warning: dict_nis_init: NIS domain name not set - NIS lookups disabled
Feb 14 16:38:19 dogself postfix/local[584]: 5A6C08115: to=<brian@openmile.com.destructly.com>, relay=local, delay=0.25, delays=0.24/0.01/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Feb 14 16:38:19 dogself postfix/qmgr[31228]: 5A6C08115: removed
Feb 14 16:38:19 dogself postfix/smtpd[580]: disconnect from mail-wi0-f179.google.com[209.85.212.179]