Differences between version 23 and revision by previous author of EximMailFilter.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 23 | Last edited on Tuesday, July 11, 2006 9:02:33 am | by CraigBox | Revert |
Older page: | version 21 | Last edited on Monday, June 27, 2005 4:46:30 pm | by JamieCurtis | Revert |
@@ -1,17 +1,19 @@
-!!!How to make your Debian machine an amazing [Exim] 4 mail filter
+!!!How to make your Debian or Ubuntu
machine an amazing [Exim] 4 mail filter
This is how I've set up a new exim4 installation to do all the filtering I used to do with MailScanner or amavis. It's much less CPU intensive to use the daemon mode of SpamAssassin and have your MTA do all the work instead of a big perl script.
There are a number of changes that aren't immediately apparent between using exim3 and exim4 on Debian: the configuration system is completely different. You either have a large configuration template file or a number of small files, but either way, the live config isn't updated until you run __update-exim4.conf__. Running an /etc/init.d/exim4 restart will run this command for you.
!!Get exim4
-!Sarge
+!Sarge/Dapper
-=apt-get install exim4-daemon-heavy clamav-daemon clamav-freshclam spamassassin= (add more or less as required)
+=apt-get install exim4-daemon-heavy clamav-daemon clamav-freshclam spamassassin= (add more or less as required.
)
!Woody
+
+You can only go as far as Exim 4.34, so you should really consider moving to Sarge.
Add these lines to your apt sources.list:
<pre>
@@ -183,8 +185,10 @@
version=_VERSION_"
</pre>
!!MIME errors & file attachments
+
+! Pre-Exim 4.50
Noone wants to receive executable file attachments: in acl/40_exim4-config_check_data.rul
<pre>
@@ -202,14 +206,36 @@
deny message = Serious MIME defect detected ($demime_reason)
demime = *
condition = ${if >{$demime_errorlevel}{2}{1}{0}}
</pre>
+
+! Exim 4.50 and higher
Recent exiscans (including the one included with Exim 4.50) have deprecated demime, instead adding a acl_smtp_mime ACL. This is more powerful than the precvious demime, but as always, is more complex to get the above features.
-See
http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050523/msg00117.html for a thread on this. (there are
many typo's in the original post that are fixed below)
. Add something like the following:
+This example was originally built from [an acl_smtp_mime thread on exim-users|
http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050523/msg00117.html], but
many typos have been corrected
.
+
+
Add something like the following:
+
+In main/02_exim4-config_options.rul
:
<pre>
+# itp: define MIME ACL
+#
+.ifndef MAIN_ACL_CHECK_MIME
+MAIN_ACL_CHECK_MIME = acl_check_mime
+.endif
+acl_smtp_mime = MAIN_ACL_CHECK_MIME
+</pre>
+
+Create acl/50_exim4-config_check_mime:
+
+<pre>
+### acl/50_exim4-config_check_mime
+##################################
+
+acl_check_mime:
+
# Decode MIME parts to disk. This will support virus scanners later.
deny
decode = default
condition = ${if > {$mime_anomaly_level}{2} \
@@ -225,13 +251,13 @@
log_message = DENY: MIME Error (Too many MIME parts: $mime_part_count)
# Excessive line length
#
- # BEWARE: Exim 4.50 has a bug that means regex's don't work in the MIME ACL. Don't use
- #
in that case !
+ # BEWARE: Exim 4.50 has a bug that means regex's don't work in the MIME ACL.
+ #
Don't use in that case! It works fine in Exim 4.60.
deny
- regex = ^.{131071
}
- message = MIME error: Line length in message or single header exceeds 131071
.
+ regex = ^.{8000
}
+ message = MIME error: Line length in message or single header exceeds 8000
.
log_message = DENY: MIME Error (Maximum line length exceeded)
# Partial message
#
@@ -261,11 +287,12 @@
{\N(\.bat|\.btm|\.cmd|\.com|\.cpl|\.dll|\.exe|\.lnk|\.msi|\.pif|\.prf|\.reg|\.scr|\.vbs|\.url)$\N} \
{1}{0}}
message = Blacklisted file extension detected in "$mime_filename". If you legitimately need to send these files please zip them first.
log_message = DENY: Blacklisted extension ("$mime_filename")
-</pre>
-Unfortunately because of a bug in exim 4.50 you may see "cannot test regex condition in MIME ACL". This stops you doing the Line Length check. This is described here:
+ # accept otherwise
+ accept
+</pre>
-http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050307/msg00131.html
+Unfortunately, because of [a bug in Exim 4.50|
http://www.exim.org/mail-archives/exim-users/Week-of-Mon-20050307/msg00131.html], you may see "cannot test regex condition in MIME ACL". This stops you doing the Line Length check. Enable that section only for Exim 4.6.
-You can tweak the values for Proposed filename
, MIME boundary length and Line Length to work for your users Some mailers conform more strictly to the MIME spec than others.
+You can tweak the values for Proposed Filename
, MIME boundary length and Line Length to work for your users Some mailers conform more strictly to the MIME spec than others.