Page MenuHomePhabricator
Paste P12203

exim config for lists.wmcloud.org
ActivePublic

Authored by Ladsgroup on Aug 8 2020, 9:10 PM.
Referenced Files
F31987866: raw.txt
Aug 8 2020, 9:10 PM
Subscribers
None
# Minimal Exim 4 configuration file for Wikimedia Labs
# Main configuration options
check_spool_space = 50M
remote_max_parallel = 10
# Allow the -f cli option to work
untrusted_set_sender = *
local_from_check = false
# No frozen messages please
ignore_bounce_errors_after = 0h
add_environment = <; PATH=/bin:/usr/bin
keep_environment =
# 4.87+ defaults to *, which errors if tls_certificate etc. is not present
tls_advertise_hosts =
# Logging
log_selector = +address_rewrite +all_parents +delivery_size +deliver_time +incoming_interface +incoming_port +smtp_confirmation +smtp_protocol_error +smtp_syntax_error
message_logs = false
# /etc/exim4/conf.d/main/25_mm3_macros
# The colon-separated list of domains served by Mailman.
domainlist mm_domains=lists.wmcloud.org
MM3_LMTP_PORT=8024
# MM3_HOME must be set to mailman's var directory, wherever it is
# according to your installation.
MM3_HOME=/var/lib/mailman3
MM3_UID=list
MM3_GID=list
################################################################
# The configuration below is boilerplate:
# you should not need to change it.
# The path to the list receipt (used as the required file when
# matching list addresses)
MM3_LISTCHK=MM3_HOME/lists/${local_part}.${domain}
acl_smtp_connect = acl_check_connect
acl_smtp_helo = acl_check_helo
acl_smtp_mail = acl_check_mail
acl_smtp_rcpt = acl_check_rcpt
acl_smtp_data = acl_check_data
domainlist system_domains = @
domainlist local_domains = +system_domains : +mm_domains
hostlist wikimedia_nets = <; 172.16.0.0/12
hostlist relay_from_hosts = <; @[] ; 127.0.0.1 ; ::1 ;
helo_try_verify_hosts = *
###############################
# Access Control Lists (ACLs) #
###############################
begin acl
acl_check_rcpt:
# temporary spam countermeasures, 2015-09-20
discard local_parts = ^.+\\+[0-9]{4,}
domains = gmail.com
# Disable list subscription via email due to excessive suspicious subscriptions --herron 2018-05-14 T194032
deny message = Support for list subscription via email has been disabled. Please use the web interface at https://lists.wmcloud.org
local_parts = ^.*-(join|subscribe)\$
# If there have been ~4 times as many previous RCPT rejects than
# accepts, drop the connection
drop message = Too many ($rcpt_fail_count) rejected recipients, good bye
hosts = ! +wikimedia_nets
condition = ${if >={$rcpt_fail_count}{${eval:4*($recipients_count+1)}}}
# Accept if the source is local SMTP (a pipe)
accept hosts = :
# 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)
message = HELO failure ref1
condition = ${if match_domain{$sender_helo_name}{+local_domains}{yes}{no}}
!hosts = +wikimedia_nets : +relay_from_hosts
delay = 45s
# warn if remote tries to send HELO < my primary hostname >
# change from warn to delay & drop to enforce this
warn log_message = HELO failure ref2 (Remote said: HELO $sender_helo_name - Problem: HELO name equals my primary_hostname of $primary_hostname)
condition = ${if match{$sender_helo_name}{$primary_hostname}}
!hosts = +wikimedia_nets : +relay_from_hosts
#log_message = HELO failure ref2 (Remote said: HELO $sender_helo_name - Problem: HELO name equals my primary_hostname of $primary_hostname)
#delay = 45s
# warn if remote tries to send HELO < my interface address >
# change from warn to delay & drop to enforce this
warn log_message = HELO FAILURE ref3 (Remote said: HELO $sender_helo_name - Problem: HELO name matches local interface address $received_ip_address)
condition = ${if eq{[$received_ip_address]}{$sender_helo_name}}
!hosts = +wikimedia_nets : +relay_from_hosts
#log_message = HELO failure ref3 (Remote said: HELO $sender_helo_name - Problem: HELO name matches local interface address $received_ip_address)
#delay = 45s
# warn if remote sends HELO with no address literal and no periods
# change from warn to delay & drop to enforce this
warn log_message = HELO FAILURE ref4 (Remote said: HELO $sender_helo_name - Problem: HELO name does not contain an address literal or a period)
condition = ${if match{$sender_helo_name}{\N^\[\N}{no}{yes}}
condition = ${if match{$sender_helo_name}{\N\.\N}{no}{yes}}
!hosts = +wikimedia_nets : +relay_from_hosts
#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)
message = MAIL FROM FAILURE ref1
condition = ${if match_domain{$sender_address_domain}{+local_domains}{yes}{no}}
!hosts = +wikimedia_nets : +relay_from_hosts
delay = 45s
accept
acl_check_data:
# Let's trust local senders to not send out spam
accept hosts = +wikimedia_nets
set acl_m0 = trusted relay
# Only run through SpamAssassin if requested for this domain and
# the message is not too large
accept condition = ${if >{$message_size}{400K}}
# Skip if so requested
accept condition = ${if eq{$acl_m2}{skip_spamd}}
accept
begin routers
# Redirect using /etc/aliases if it exists, blackhole otherwise
#system_aliases:
# driver = redirect
# domains = @
# data = ${lookup{$local_part}lsearch{/etc/aliases}{$value}{:blackhole:}}
# qualify_domain = wmflabs.org
# allow_fail
# allow_defer
# forbid_file
# Send all mail via a set of mail relays ("smart hosts")
mailman3_router:
driver = accept
domains = +mm_domains
require_files = MM3_LISTCHK
local_part_suffix_optional
local_part_suffix = \
-bounces : -bounces+* : \
-confirm : -confirm+* : \
-join : -leave : \
-owner : -request : \
-subscribe : -unsubscribe
transport = mailman3_transport
smart_route:
driver = manualroute
transport = remote_smtp
route_list = * mx-out01.wmflabs.org:mx-out02.wmflabs.org
begin transports
mailman3_transport:
driver = smtp
protocol = lmtp
allow_localhost
hosts = localhost
port = MM3_LMTP_PORT
rcpt_include_affixes = true
# Generic remote SMTP transport
remote_smtp:
driver = smtp
hosts_avoid_tls = <; 0.0.0.0/0 ; 0::0/0
begin retry
* * F,2h,5m; F,1d,15m
begin rewrite
# Rewrite the envelope From for mails from internal servers in *.wmnet,
# as they are usually rejected by sender domain address verification.
*@$primary_hostname root@wmflabs.org F