I've set up a mail server on 5.7 following the walkthrough at
technoquarter.blogspot.com. Basically, it accepts mail and routes it
through spamassassin and clamav and finally delivers to dovecot.
Inbound and outbound mail works as expected. However, mail to
doesntex...@example.com bounces (and backscatters?) because the
recipient isn't checked until the final step. I tried adding the check
to the first step, but smtpd returned "aliases/virtual may not be used
with a relay rule".
My config is below. Is there a way to only accept mail for users who
exist when initially accepting the mail? I guess I could just drop the
mail, but that doesn't seem optimal. Thanks.
pki server.example.net certificate "/etc/ssl/server.example.net.crt"
pki server.example.net key "/etc/ssl/private/server.example.net.key"
# To accept external mail, replace with: listen on all
#
listen on lo0
listen on lo0 port 10026 tag CLAM_IN # incoming mail
listen on lo0 port 10028 tag CLAM_OUT # outgoing mail
listen on lo0 port 10036 tag SPAM_IN # incoming mail
listen on lo0 port 10029 tag DKIM_OUT # outgoing mail
listen on egress tls pki server.example.net auth-optional
listen on egress port submission tls-require pki server.example.net auth
table aliases db:/etc/mail/aliases.db
table vusers file:/etc/mail/vusers
table vdomains file:/etc/mail/vdomains
accept for local alias <aliases> deliver to maildir
# Tagged mail returned from dkimproxy_out relay out
accept tagged DKIM_OUT for any relay
# Tagged mail returned from spampd returned to lmtp
accept tagged SPAM_IN for domain <vdomains> virtual <vusers> deliver to
lmtp "/var/dovecot/lmtp"
# tagged mail returned from clamsmtpd either deliver or relay
accept tagged CLAM_IN for any relay via smtp://127.0.0.1:10035 # send to
spampd
accept tagged CLAM_OUT for any relay via smtp://127.0.0.1:10030 # send
to dkimproxy_out
# start here - untagged mail is sent to clamsmtpd
accept from any for domain <vdomains> relay via smtp://127.0.0.1:10025 #
incoming mail
#accept from any for domain <vdomains> virtual <vusers> relay via
smtp://127.0.0.1:10025 # incoming mail
accept from local for any relay via smtp://127.0.0.1:10027 # outgoing mail