Catch-all with LMTP and Postfix
Michael Starks
dovecot at michaelstarks.com
Mon Aug 22 03:32:25 UTC 2016
Hidy-ho,
I'm having a difficult time getting catch-all working when using Dovecot
LMTP. I would like *@example.com (everything) to go to
virtual at example.com, where virtual is a valid virtual user. It seems
that things are getting as far as LMTP, but then the mail gets bounced.
To wit:
Aug 21 08:02:50 hostname postfix/lmtp[4914]: 8DF8E9AFE6:
to=<test at example.com>, relay=mail.example.com[private/dovecot-lmtp],
delay=0.07, delays=0.04/0.01/0.01/0.01, dsn=5.1.1, status=bounced (host
mail.example.com[private/dovecot-lmtp] said: 550 5.1.1
<test at example.com> User doesn't exist: test at example.com (in reply to
RCPT TO command))
In the previous log example, test at example.com should have been forwarded
(aliased) to the virtual mail user.
Some config details:
[root at hostname postfix]# cat /etc/postfix/virtual
#########################################
#### Postmap this file after editing ####
#########################################
# Person who should get root's mail. Don't receive mail as root!
#root you
# Basic system aliases -- these MUST be present
MAILER-DAEMON postmaster
postmaster root
# General redirections for pseudo accounts
bin root
daemon root
named root
nobody root
uucp root
www root
ftp-bugs root
postfix root
# Put your local aliases here.
@example.com virtual at example.com
# Well-known aliases
manager root
dumper root
operator root
abuse postmaster
# trap decode to catch security attacks
decode root
[root at hostname postfix]# cat /etc/postfix/virtual_mailbox_domains
################################################
#### Do NOT postmap this file after editing ####
################################################
example.com
[root at hostname postfix]# cat /etc/postfix/virtual_mailbox_maps
#########################################
#### Postmap this file after editing ####
#########################################
# From: http://wiki.dovecot.org/LDA/Postfix
# Info: if you use the Dovecot LDA or LMTP it doesn't matter what you
use behind the recipient address. Use "OK", the full name of the user or
else.
# I am using the Dovecot LMTP
@example.com OK
[root at hostname postfix]# dovecot --version
2.2.10
[root at hostname postfix]# dovecot -n
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-327.22.2.el7.x86_64 x86_64 CentOS Linux release
7.2.1511 (Core)
auth_verbose = yes
login_greeting = What's crackalackin?
mail_debug = yes
mail_home = /var/mail/%d/%n
mail_location = maildir:~/mail
maildir_very_dirty_syncs = yes
mbox_write_locks = fcntl
namespace inbox {
hidden = no
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
separator = /
type = private
}
passdb {
args = scheme=SSHA512 /etc/dovecot/passdb
driver = passwd-file
}
protocols = imap lmtp
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0660
user = postfix
}
unix_listener auth-userdb {
group = vmail
mode = 0600
user = vmail
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
ssl_cert = </etc/pki/tls/certs/hostname.com.crt
ssl_cipher_list =
EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA256:EECDH:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!IDEA:!ECDSA:kEDH:CAMELLIA128-SHA:AES128-SHA
ssl_dh_parameters_length = 2048
ssl_key = </etc/pki/tls/certs/example.com.key
ssl_prefer_server_ciphers = yes
ssl_protocols = !SSLv3 !SSLv2
userdb {
args = /etc/dovecot/userdb
driver = passwd-file
}
[root at hostname postfix]# postconf -d mail_version
mail_version = 2.10.1
[root at talyn postfix]# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
body_checks = pcre:/etc/postfix/body_checks.pcre
broken_sasl_auth_clients = no
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd
$daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
header_checks = pcre:/etc/postfix/header_checks.pcre
html_directory = no
inet_protocols = all
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 20480000
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = mail.example.com
mynetworks_style = host
newaliases_path = /usr/bin/newaliases.postfix
notify_classes = resource, software, bounce
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
relay_domains = $mydestination
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_header_checks = pcre:/etc/postfix/smtp_header_checks.pcre
smtp_tls_note_starttls_offer = yes
smtp_use_tls = yes
smtpd_banner = $myhostname Microsoft ESMTP MAIL Service, Version:
6.0.3790.1830 ready.
smtpd_data_restrictions = reject_unauth_pipelining,
reject_multi_recipient_bounce permit
smtpd_helo_required = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname,
reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname,
reject_non_fqdn_hostname, reject_non_fqdn_sender,
reject_non_fqdn_recipient, reject_unknown_sender_domain,
reject_unknown_recipient_domain, reject_unauth_destination,
check_recipient_access hash:/etc/postfix/recipient_access.hash,
check_recipient_access pcre:/etc/postfix/recipient_access.pcre,
check_sender_access hash:/etc/postfix/sender_access.hash,
check_sender_access pcre:/etc/postfix/sender_access.pcre,
reject_rbl_client b.barracudacentral.org, reject_rbl_client
zen.spamhaus.org, reject_rbl_client bl.spamcop.net permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/example.com.crt
smtpd_tls_key_file = /etc/pki/tls/certs/example.com.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox_maps
virtual_transport = lmtp:unix:private/dovecot-lmtp
Thank you in advance for your assistance.
More information about the dovecot
mailing list