10 sudo aptitude install clamav spamassassin spamc greylistd
12 adduser clamav Debian-exim
13 adduser Debian-exim clamav
15 /etc/clamav/clamd.conf
17 #Automatically Generated by clamav-base postinst
18 #To reconfigure clamd run #dpkg-reconfigure clamav-base
19 #Please read /usr/share/doc/clamav-base/README.Debian.gz for details
20 LocalSocket /var/run/clamav/clamd.ctl
23 AllowSupplementaryGroups
28 ArchiveMaxFileSize 10M
29 ArchiveMaxCompressionRatio 250
32 MaxConnectionQueueLength 15
33 LogFile /var/log/clamav/clamav.log
36 PidFile /var/run/clamav/clamd.pid
37 DatabaseDirectory /var/lib/clamav
41 DetectBrokenExecutables
45 /etc/exim4/conf.d/main/02_exim4-config_options
47 ### main/02_exim4-config_options
48 #################################
50 av_scanner = clamd:/var/run/clamav/clamd.ctl
51 spamd_address = 127.0.0.1 783
55 /etc/exim4/conf.d/acl/30_exim4-config_check_rcpt
57 # This access control list is used for every RCPT command in an incoming
58 # SMTP message. The tests are run in order until the address is either
63 # Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
64 # testing for an empty sending host field.
67 # Add missing Date and Message-ID header for relayed messages
68 warn hosts = +relay_from_hosts
69 control = submission/sender_retain
71 # The following section of the ACL is concerned with local parts that contain
72 # @ or % or ! or / or | or dots in unusual places.
74 # The characters other than dots are rarely found in genuine local parts, but
75 # are often tried by people looking to circumvent relaying restrictions.
76 # Therefore, although they are valid in local parts, these rules lock them
77 # out, as a precaution.
79 # Empty components (two dots in a row) are not valid in RFC 2822, but Exim
80 # allows them because they have been encountered. (Consider local parts
81 # constructed as "firstinitial.secondinitial.familyname" when applied to
82 # someone like me, who has no second initial.) However, a local part starting
83 # with a dot or containing /../ can cause trouble if it is used as part of a
84 # file name (e.g. for a mailing list). This is also true for local parts that
85 # contain slashes. A pipe symbol can also be troublesome if the local part is
86 # incorporated unthinkingly into a shell command line.
88 # Two different rules are used. The first one is stricter, and is applied to
89 # messages that are addressed to one of the local domains handled by this
90 # host. It blocks local parts that begin with a dot or contain @ % ! / or |.
91 # If you have local accounts that include these characters, you will have to
93 deny domains = +local_domains
94 local_parts = ^[.] : ^.*[@%!/|\'`#&?]
95 message = restricted characters in address
97 # The second rule applies to all other domains, and is less strict. This
98 # allows your own users to send outgoing messages to sites that use slashes
99 # and vertical bars in their local parts. It blocks local parts that begin
100 # with a dot, slash, or vertical bar, but allows these characters within the
101 # local part. However, the sequence /../ is barred. The use of @ % and ! is
102 # blocked, as before. The motivation here is to prevent your users (or
103 # your users' viruses) from mounting certain kinds of attack on remote sites.
105 deny domains = !+local_domains
106 local_parts = ^[./|] : ^.*[@%!\'`#&?] : ^.*/\\.\\./
107 message = restricted characters in address
109 # Accept mail to postmaster in any local domain, regardless of the source,
110 # and without verifying the sender.
112 accept local_parts = postmaster
113 domains = +local_domains
115 # deny bad senders (envelope sender)
116 # CONFDIR/local_sender_blacklist holds a list of envelope senders that
117 # should have their access denied to the local host. Incoming messages
118 # with one of these senders are rejected at RCPT time.
120 # The explicit white lists are honored as well as negative items in
121 # the black list. See /usr/share/doc/exim4-config/default_acl for details.
122 deny message = sender envelope address $sender_address is locally blacklisted here. If you think this is wrong, get in touch with postmaster
123 !acl = acl_whitelist_local_deny
124 senders = ${if exists{CONFDIR/local_sender_blacklist}\
125 {CONFDIR/local_sender_blacklist}\
128 # deny bad sites (IP address)
129 # CONFDIR/local_host_blacklist holds a list of host names, IP addresses
130 # and networks (CIDR notation) that should have their access denied to
131 # The local host. Messages coming in from a listed host will have all
132 # RCPT statements rejected.
134 # The explicit white lists are honored as well as negative items in
135 # the black list. See /usr/share/doc/exim4-config/default_acl for details.
136 deny message = sender IP address $sender_host_address is locally blacklisted here. If you think this is wrong, get in touch with postmaster
137 !acl = acl_whitelist_local_deny
138 hosts = ${if exists{CONFDIR/local_host_blacklist}\
139 {CONFDIR/local_host_blacklist}\
144 # Deny unless the sender address can be verified.
146 # This is disabled by default so that DNSless systems don't break. If
147 # your system can do DNS lookups without delay or cost, you might want
148 # to enable the following line.
149 #deny message = Sender verification failed
150 # !acl = acl_whitelist_local_deny
153 # Warn if the sender host does not have valid reverse DNS.
155 # This is disabled by default so that DNSless systems don't break. If
156 # your system can do DNS lookups without delay or cost, you might want
157 # to enable the following lines.
158 # If sender_host_address is defined, it's a remote call. If
159 # sender_host_name is not defined, then reverse lookup failed. Use
160 # this instead of !verify = reverse_host_lookup to catch deferrals
161 # as well as outright failures.
162 warn message = X-Host-Lookup-Failed: Reverse DNS lookup failed for $sender_host_address (${if eq{$host_lookup_failed}{1}{failed}{deferred}})
163 condition = ${if and{{def:sender_host_address}{!def:sender_host_name}}\
166 #############################################################################
167 # There are no checks on DNS "black" lists because the domains that contain
168 # these lists are changing all the time. You can find examples of
169 # how to use dnslists in /usr/share/doc/exim4-config/examples/acl
170 #############################################################################
173 # Perform greylisting on incoming messages from remote hosts.
174 # We do NOT greylist messages with no envelope sender, because that
175 # would conflict with remote hosts doing callback verifications, and we
176 # might not be able to send mail to such hosts for a while (until the
177 # callback attempt is no longer greylisted, and then some).
179 # We also check the local whitelist to avoid greylisting mail from
180 # hosts that are expected to forward mail here (such as backup MX hosts,
181 # list servers, etc).
183 # Because the recipient address has not yet been verified, we do so
184 # now and skip this statement for non-existing recipients. This is
185 # in order to allow for a 550 (reject) response below. If the delivery
186 # happens over a remote transport (such as "smtp"), recipient callout
187 # verification is performed, with the original sender intact.
190 message = $sender_host_address is not yet authorized to deliver. \
192 log_message = greylisted.
194 !hosts = : +relay_from_hosts : \
195 ${if exists {/etc/greylistd/whitelist-hosts}\
196 {/etc/greylistd/whitelist-hosts}{}} : \
197 ${if exists {/var/lib/greylistd/whitelist-hosts}\
198 {/var/lib/greylistd/whitelist-hosts}{}}
200 !acl = acl_whitelist_local_deny
201 domains = +local_domains : +relay_to_domains : dsearch;/etc/exim4/virtual
202 verify = recipient/callout=20s,use_sender,defer_ok
203 condition = ${readsocket{/var/run/greylistd/socket}\
205 ${mask:$sender_host_address/24}} \
207 # $local_part@$domain}\
212 # Accept if the address is in a local domain, but only if the recipient can
213 # be verified. Otherwise deny. The "endpass" line is the border between
214 # passing on to the next ACL statement (if tests above it fail) or denying
215 # access (if tests below it fail).
217 accept domains = +local_domains
219 message = unknown user
222 accept domains = dsearch;/etc/exim4/virtual
224 message = unknown user
227 # Accept if the address is in a domain for which we are relaying, but again,
228 # only if the recipient can be verified.
230 accept domains = +relay_to_domains
232 message = unrouteable address
235 # If control reaches this point, the domain is neither in +local_domains
236 # nor in +relay_to_domains.
238 # Accept if the message comes from one of the hosts for which we are an
239 # outgoing relay. Recipient verification is omitted here, because in many
240 # cases the clients are dumb MUAs that don't cope well with SMTP error
241 # responses. If you are actually relaying out from MTAs, you should probably
242 # add recipient verification here.
244 accept hosts = +relay_from_hosts
246 # Accept if the message arrived over an authenticated connection, from
247 # any host. Again, these messages are usually from MUAs, so recipient
248 # verification is omitted.
250 accept authenticated = *
252 # Reaching the end of the ACL causes a "deny", but we might as well give
253 # an explicit message.
255 deny message = relay not permitted
259 /etc/exim4/conf.d/acl/40_exim4-config_check_data
261 # 40_exim4-config_check_data
264 # greylistd(8) configuration follows.
265 # This statement has been added by "greylistd-setup-exim4",
266 # and can be removed by running "greylistd-setup-exim4 remove".
267 # Any changes you make here will then be lost.
269 # Perform greylisting on incoming messages with no envelope sender here.
270 # We did not subject these to greylisting after RCPT TO:, because that
271 # would interfere with remote hosts doing sender callout verifications.
273 # Because there is no sender address, we supply only two data items:
274 # - The remote host address
275 # - The recipient address (normally, bounces have only one recipient)
277 # We also check the local whitelist to avoid greylisting mail from
278 # hosts that are expected to forward mail here (such as backup MX hosts,
279 # list servers, etc).
282 message = $sender_host_address is not yet authorized to deliver. \
284 log_message = greylisted.
286 !hosts = : +relay_from_hosts : \
287 ${if exists {/etc/greylistd/whitelist-hosts}\
288 {/etc/greylistd/whitelist-hosts}{}} : \
289 ${if exists {/var/lib/greylistd/whitelist-hosts}\
290 {/var/lib/greylistd/whitelist-hosts}{}}
292 !acl = acl_whitelist_local_deny
293 condition = ${readsocket{/var/run/greylistd/socket}\
295 ${mask:$sender_host_address/24}} \
300 # Deny unless the address list headers are syntactically correct.
302 # This is disabled by default because it might reject legitimate mail.
303 # If you want your system to insist on syntactically valid address
304 # headers, you might want to enable the following lines.
305 # deny message = Message headers fail syntax check
306 # !acl = acl_whitelist_local_deny
307 # !verify = header_syntax
309 # require that there is a verifiable sender address in at least
310 # one of the "Sender:", "Reply-To:", or "From:" header lines.
311 # deny message = No verifiable sender address in message headers
312 # !acl = acl_whitelist_local_deny
313 # !verify = header_sender
316 deny message = Serious MIME defect detected ($demime_reason)
318 condition = ${if >{$demime_errorlevel}{2}{1}{0}}
320 deny message = Blacklisted file extension detected
321 condition = ${if match \
322 {${lc:$mime_filename}} \
323 {\N(\.bat|\.com|\.exe|\.pif|\.prf|\.scr|\.vbs)$\N} \
326 deny message = This message contains malware ($malware_name)
330 # Always put X-Spam-Score header in the message.
331 # It looks like this:
332 # X-Spam-Score: 6.6 (++++++)
333 # When a MUA cannot match numbers, it can match for an
334 # equivalent number of '+' signs.
335 # The 'true' makes sure that the header is always put
336 # in, no matter what the score.
337 warn message = X-Spam-Score: $spam_score ($spam_bar)
338 condition = ${if <{$message_size}{300k}{1}{0}}
339 spam = spamassassin:true
341 # Always put X-Spam-Report header in the message.
342 # This is a multiline header that informs the user
343 # which tests a message has "hit", and how much a
344 # test has contributed to the score.
345 warn message = X-Spam-Flag: YES
346 condition = ${if <{$message_size}{300k}{1}{0}}
347 spam = spamassassin:true
348 condition = ${if >{$spam_score_int}{30}{1}{0}}
351 deny message = Spam score too high ($spam_score)
352 condition = ${if <{$message_size}{300k}{1}{0}}
353 spam = spamassassin:true
354 condition = ${if >{$spam_score_int}{100}{1}{0}}
362 [[!tag CategoryCodeSnippets]] [[!tag CategoryTipsAndTricks]]