2 ### acl/30_exim4-config_check_rcpt
3 #################################
5 # This access control list is used for every RCPT command in an incoming
6 # SMTP message. The tests are run in order until the address is either
10 # Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
11 # testing for an empty sending host field.
16 # Add missing Date and Message-ID header for relayed messages
18 hosts = +relay_from_hosts
19 control = submission/sender_retain
22 # The following section of the ACL is concerned with local parts that contain
23 # certain non-alphanumeric characters. Dots in unusual places are
24 # handled by this ACL as well.
26 # Non-alphanumeric characters other than dots are rarely found in genuine
27 # local parts, but are often tried by people looking to circumvent
28 # relaying restrictions. Therefore, although they are valid in local
29 # parts, these rules disallow certain non-alphanumeric characters, as
32 # Empty components (two dots in a row) are not valid in RFC 2822, but Exim
33 # allows them because they have been encountered. (Consider local parts
34 # constructed as "firstinitial.secondinitial.familyname" when applied to
35 # a name without a second initial.) However, a local part starting
36 # with a dot or containing /../ can cause trouble if it is used as part of a
37 # file name (e.g. for a mailing list). This is also true for local parts that
38 # contain slashes. A pipe symbol can also be troublesome if the local part is
39 # incorporated unthinkingly into a shell command line.
41 # Two different rules are used. The first one has a quite strict
42 # default, and is applied to messages that are addressed to one of the
43 # local domains handled by this host.
44 # If you have local accounts that include strange characters, you can
45 # use the macro provided to change the ACL range or to disable the
47 .ifdef CHECK_RCPT_LOCAL_LOCALPARTS
49 domains = +local_domains
50 local_parts = CHECK_RCPT_LOCAL_LOCALPARTS
51 message = restricted characters in address
55 # The second rule applies to all other domains, and its default is
56 # considerably less strict.
57 .ifdef CHECK_RCPT_REMOTE_LOCALPARTS
59 domains = !+local_domains
60 local_parts = CHECK_RCPT_REMOTE_LOCALPARTS
61 message = restricted characters in address
65 # Accept mail to postmaster in any local domain, regardless of the source,
66 # and without verifying the sender.
69 .ifndef CHECK_RCPT_POSTMASTER
70 local_parts = postmaster
72 local_parts = CHECK_RCPT_POSTMASTER
74 domains = +local_domains
77 # deny bad senders (envelope sender)
78 # CONFDIR/local_sender_blacklist holds a list of envelope senders that
79 # should have their access denied to the local host. Incoming messages
80 # with one of these senders are rejected at RCPT time.
82 # The explicit white lists are honored as well as negative items in
83 # the black list. See /usr/share/doc/exim4-config/default_acl for details.
85 message = sender envelope address $sender_address is locally blacklisted here. If you think this is wrong, get in touch with postmaster
86 !acl = acl_whitelist_local_deny
87 senders = ${if exists{CONFDIR/local_sender_blacklist}\
88 {CONFDIR/local_sender_blacklist}\
92 # deny bad sites (IP address)
93 # CONFDIR/local_host_blacklist holds a list of host names, IP addresses
94 # and networks (CIDR notation) that should have their access denied to
95 # The local host. Messages coming in from a listed host will have all
96 # RCPT statements rejected.
98 # The explicit white lists are honored as well as negative items in
99 # the black list. See /usr/share/doc/exim4-config/default_acl for details.
101 message = sender IP address $sender_host_address is locally blacklisted here. If you think this is wrong, get in touch with postmaster
102 !acl = acl_whitelist_local_deny
103 hosts = ${if exists{CONFDIR/local_host_blacklist}\
104 {CONFDIR/local_host_blacklist}\
108 # Deny unless the sender address can be verified.
110 # This is disabled by default so that DNSless systems don't break. If
111 # your system can do DNS lookups without delay or cost, you might want
112 # to enable this feature.
113 .ifdef CHECK_RCPT_VERIFY_SENDER
115 message = Sender verification failed
116 !acl = acl_whitelist_local_deny
120 # For some sender domains, we do callout to verify if a sender
123 !acl = acl_whitelist_local_deny
124 senders = ${if exists{CONFDIR/local_sender_callout}\
125 {CONFDIR/local_sender_callout}\
127 !verify = sender/callout
130 # For some recipient domains, we do callout to verify if a recipient
131 # exists. This is especially handy for customers that receive a lot of
132 # spam to non-existent addresses.
134 !acl = acl_whitelist_local_deny
135 recipients = ${if exists{CONFDIR/local_rcpt_callout}\
136 {CONFDIR/local_rcpt_callout}\
138 !verify = recipient/callout
141 # Warn if the sender host does not have valid reverse DNS.
143 # If your system can do DNS lookups without delay or cost, you might want
145 # If sender_host_address is defined, it's a remote call. If
146 # sender_host_name is not defined, then reverse lookup failed. Use
147 # this instead of !verify = reverse_host_lookup to catch deferrals
148 # as well as outright failures.
149 .ifdef CHECK_RCPT_REVERSE_DNS
151 message = X-Host-Lookup-Failed: Reverse DNS lookup failed for $sender_host_address (${if eq{$host_lookup_failed}{1}{failed}{deferred}})
152 condition = ${if and{{def:sender_host_address}{!def:sender_host_name}}\
157 # Check against classic DNS "black" lists (DNSBLs) which list
158 # sender IP addresses
159 .ifdef CHECK_RCPT_IP_DNSBLS
161 message = X-Warning: $sender_host_address is listed at $dnslist_domain ($dnslist_value: $dnslist_text)
162 log_message = $sender_host_address is listed at $dnslist_domain ($dnslist_value: $dnslist_text)
163 dnslists = CHECK_RCPT_IP_DNSBLS
167 # Check against DNSBLs which list sender domains, with an option to locally
168 # whitelist certain domains that might be blacklisted. If you want one
169 # blacklist per domain, you need to replicate the stanza for each DNSBL.
170 .ifdef CHECK_RCPT_DOMAIN_DNSBLS
172 message = X-Warning: $sender_address_domain is listed at $dnslist_domain ($dnslist_value: $dnslist_text)
173 log_message = $sender_address_domain is listed at $dnslist_domain ($dnslist_value: $dnslist_text)
174 !senders = ${if exists{CONFDIR/local_domain_dnsbl_whitelist}\
175 {CONFDIR/local_domain_dnsbl_whitelist}\
177 dnslists = CHECK_RCPT_DOMAIN_DNSBLS/$sender_address_domain
181 # This hook allows you to hook in your own ACLs without having to
182 # modify this file. If you do it like we suggest, you'll end up with
183 # a small performance penalty since there is an additional file being
184 # accessed. This doesn't happen if you leave the macro unset.
185 .ifdef CHECK_RCPT_LOCAL_ACL_FILE
186 .include CHECK_RCPT_LOCAL_ACL_FILE
190 # Accept if the address is in a local domain, but only if the recipient can
191 # be verified. Otherwise deny. The "endpass" line is the border between
192 # passing on to the next ACL statement (if tests above it fail) or denying
193 # access (if tests below it fail).
196 domains = +local_domains
198 message = unknown user
202 # Accept if the address is in a domain for which we are relaying, but again,
203 # only if the recipient can be verified.
205 # If you want to use the more conservative "unknown user" error
206 # message in case of a non-existing local part, you might want to
207 # set CHECK_RCPT_GIVE_UNKNOWN_USER. However, this might reveal
208 # local information, which is the cause for it not being enabled by
211 domains = +relay_to_domains
213 .ifdef CHECK_RCPT_GIVE_UNKNOWN_USER
214 message = ${if eq{$acl_verify_message}{Unrouteable address}{unknown user}{$acl_verify_message}}
216 message = unrouteable address
222 # If control reaches this point, the domain is neither in +local_domains
223 # nor in +relay_to_domains.
226 # Accept if the message comes from one of the hosts for which we are an
227 # outgoing relay. Recipient verification is omitted here, because in many
228 # cases the clients are dumb MUAs that don't cope well with SMTP error
229 # responses. If you are actually relaying out from MTAs, you should probably
230 # add recipient verification here.
233 hosts = +relay_from_hosts
236 # Accept if the message arrived over an authenticated connection, from
237 # any host. Again, these messages are usually from MUAs, so recipient
238 # verification is omitted.
244 # Reaching the end of the ACL causes a "deny", but we might as well give
245 # an explicit message.
248 message = relay not permitted