# Deny if the local part contains @, %, /, | or !, or starts with a dot
deny local_parts = ^.*[@%!/|] : ^\\.
# Accept relaying from networks we control. Note: no address verification
# is done at this point, which is good for mail submission, but may render
# recipient callout verification by affected hosts useless.
accept domains = ! +local_domains
hosts = +relay_from_hosts
control = submission/sender_retain
# Require recipient domain to be local
require message = Relay not permitted
domains = +local_domains
set acl_m_relayed = yes
# Accept mail for postmaster without further policy checking,
# for compliance with the RFCs
accept local_parts = postmaster : abuse
set acl_m2 = skip_spamd
# Verify the recipient address for local domains, or require the
# recipient domain to exist for remote domains
require verify = recipient
# Check whether the sender address domain exists
require verify = sender
# Drop connections from IP addresses listed in DNSBL
drop message = $sender_host_address is listed by $dnslist_domain ($dnslist_value: $dnslist_text)
dnslists = zen.spamhaus.org
delay = 15s
accept
acl_check_connect:
# Delay the banner for 5 seconds and drop connections of (spam) senders who do not wait
accept delay = 5s
acl_check_helo:
# drop if remote tries to send HELO <any ip> because RFC2821 4.1.3
# indicates HELO must be followed by domain or ip literal
drop log_message = HELO failure ref0 (Remote said: HELO $sender_helo_name - Problem: HELO must contain a domain name or ip literal wrapped with square brackets [])
message = HELO failure ref0
condition = ${if isip{$sender_helo_name}}
!hosts = +wikimedia_nets : +relay_from_hosts
delay = 45s
# drop if remote tries to send HELO < a local domain >
drop log_message = HELO failure ref1 (Remote said: HELO $sender_helo_name - Problem: HELO name matches a domain listed in local_domains)
#log_message = HELO failure ref4 (Remote said: HELO $sender_helo_name - Problem: HELO name does not contain an address literal or a period)
#delay = 45s
accept
acl_check_mail:
# drop if an unknown host attempts to issue a mail from from command containing one of our domains
drop log_message = MAIL FROM FAILURE ref1 (Remote said: MAIL FROM: $sender_address - Problem: envelope from addresses containing domains listed in local_domains are only allowed from hosts listed in the wikimedia_nets or relay_from_hosts exim hostslists)