I have a problem with my postfix + dovecot installation. Since July my catch-all does no longer work. I realisied the problem just a few days ago, because a friend of mine explicitly sent a mail to a non-existent adress and it didn't arrive. So I digged through a few logs and found that the catch-all seems no longer to work.
Looking into the mail storage directory, I saw that Dovecot created new Mailboxes for every 'user' before the @, instead of delivering it into my mailbox. The oldest of these mailboxes is from July, so I think something went wrong there. I havent changed my postfix/dovecot configuration since a year.
Edit: The last sentence wasn't true. I removed ClamAV from my server earlier this year. Maybe I screwed it up?
However, I always install updates when they arrive. The server is running Debian Squeeze.
Here is my postfix configuration:
~ > sudo postconf -n
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
mailbox_size_limit = 1099511627776
message_size_limit = 1073741824
mydestination = mail.mydomain.de
myhostname = mail.mydomain.de
mynetworks = 127.0.0.0/8
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
receive_override_options = no_address_mappings
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unknown_sender_domain, reject_rbl_client bl.spamcop.net, reject_rbl_client ix.dnsbl.manitu.net, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_authenticated_header = yes
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000
~ > sudo cat /etc/postfix/mysql-virtual_forwardings.cf
user = mail_admin
password = 123456
dbname = mail
query = SELECT destination FROM forwardings WHERE source='%s'
hosts = 127.0.0.1
~ > cat /etc/postfix/master.cf
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#submission inet n - - - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
-o content_filter=spamassassin
#smtps inet n - - - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - - 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - - - - smtp
-o smtp_fallback_relay=
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
#maildrop unix - n n - - pipe
# flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
#ifmail unix - n n - - pipe
# flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#bsmtp unix - n n - - pipe
# flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
#scalemail-backend unix - n n - 2 pipe
# flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
#mailman unix - n n - - pipe
# flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
# ${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
spamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
My mail.log shows the following ( the wurst@mydomain.de should be delivered to sebastian@mydomain.de ):
Sep 5 16:27:18 lvps5-35-246-109 postfix/smtpd[7969]: connect from mail.other.com[194.XX.XX.77]
Sep 5 16:27:18 lvps5-35-246-109 postfix/smtpd[7969]: E24511027C1CE: client=mail.other.com[194.XX.XX.77]
Sep 5 16:27:18 lvps5-35-246-109 postfix/cleanup[7973]: E24511027C1CE: message-id=<1D1B8546BC21F14AAE1508CC62F5130C144D604C@mail.other.com>
Sep 5 16:27:18 lvps5-35-246-109 postfix/qmgr[5915]: E24511027C1CE: from=<kops@other.com>, size=4723, nrcpt=1 (queue active)
Sep 5 16:27:20 lvps5-35-246-109 postfix/pickup[5916]: A0D821027C1D3: uid=5001 from=<kops@other.com>
Sep 5 16:27:20 lvps5-35-246-109 postfix/cleanup[7973]: A0D821027C1D3: message-id=<1D1B8546BC21F14AAE1508CC62F5130C144D604C@mail.other.com>
Sep 5 16:27:20 lvps5-35-246-109 postfix/pipe[7975]: E24511027C1CE: to=<wurst@mydomain.de>, relay=spamassassin, delay=1.8, delays=0.07/0.01/0/1.7, dsn=2.0.0, status=sent (delivered via spamassassin service)
Sep 5 16:27:20 lvps5-35-246-109 postfix/qmgr[5915]: E24511027C1CE: removed
Sep 5 16:27:20 lvps5-35-246-109 postfix/qmgr[5915]: A0D821027C1D3: from=<kops@other.com>, size=5081, nrcpt=1 (queue active)
Sep 5 16:27:20 lvps5-35-246-109 postfix/pipe[7982]: A0D821027C1D3: to=<wurst@mydomain.de>, relay=dovecot, delay=0.07, delays=0.05/0.01/0/0.01, dsn=2.0.0, status=sent (delivered via dovecot service)
Sep 5 16:27:20 lvps5-35-246-109 postfix/qmgr[5915]: A0D821027C1D3: removed
Sep 5 16:27:23 lvps5-35-246-109 postfix/smtpd[7969]: disconnect from other.com[194.XX.XX.77]
My MySQL-Database for the forwardings looks like this:
mysql> describe forwardings;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| source | varchar(80) | NO | PRI | NULL | |
| destination | text | NO | | NULL | |
+-------------+-------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> select * from forwardings;
+--------------+-----------------------+
| source | destination |
+--------------+-----------------------+
| @mydomain.de | sebastian@mydomain.de |
+--------------+-----------------------+
The Dovecot logfile shows that postfix doesn't resolve the correct destination:
2013-09-05 16:27:20 deliver(wurst@mydomain.de): Info: msgid=<1D1B8546BC21F14AAE1508CC62F5130C144D604C@other.com>: saved mail to INBOX
Logging the MySQL-queries from postfix:
130905 16:09:34 68 Query SELECT domain AS virtual FROM domains WHERE domain='other.com'
68 Query SELECT domain AS virtual FROM domains WHERE domain='mydomain.de'
69 Query SELECT destination FROM forwardings WHERE source='wurst@mydomain.de'
70 Query SELECT email FROM users WHERE email='wurst@mydomain.de'
69 Query SELECT destination FROM forwardings WHERE source='@mydomain.de'
The last line indicates that postfix tries to resolve the non-existens address. Manually executing the query:
mysql> SELECT destination FROM forwardings WHERE source='@mydomain.de';
+-----------------------+
| destination |
+-----------------------+
| sebastian@mydomain.de |
+-----------------------+
1 row in set (0.00 sec)
So everything seems to be in place and should work. But it doesn't. Does anyone have an idea what may cause this behavior?
Thanks for reading this 😉
Regards,
Sebastian
Best Answer
In your
main.cf
you havereceive_override_options = no_address_mappings
. This disables the catch-all. Remove this line to enable it again.You probably had different
receive_override_options
in your configuration of the postfix instance after the clamav content filter which enabled the catch-all before.