Installation
Install SpamAssassin
# apt-get install spamassassin
Install AmavisNew
# apt-get install amavisd-new
Install pyzor and razor
# apt-get install pyzor razor
Install compress and uncompress utility
# apt-get install arj bzip2 cabextract cpio file gzip lha nomarch pax rar unrar unzip unzoo zip zoo
Configuration :
Activate spamassassin
edit /etc/default/spamassassin :
change ENABLED=0 into :
ENABLED=1
Start :
# /etc/init.d/spamassassin start
Starting SpamAssassin Mail Filter Daemon: spamd.
Amavis
# nano /etc/amavis/conf.d/15-content_filter_mode
make into these lines :
use strict;
# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.
#
# Default antivirus checking mode
# Uncomment the two lines below to enable it back
#
@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);
#
# Default SPAM checking mode
# Uncomment the two lines below to enable it back
#
@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);
1; # ensure a defined return
Discard bouncing spam by editing /etc/amavis/conf.d/20-debian_defaults :
$final_virus_destiny = D_DISCARD; # (data not lost, see virus quarantine)
$final_banned_destiny = D_BOUNCE; # D_REJECT when front-end MTA
$final_spam_destiny = D_DISCARD;
$final_bad_header_destiny = D_PASS; # False-positive prone (for spam)
Start :
# /etc/init.d/amavis restart
Stopping amavisd: (not running).
Starting amavisd: head: cannot open `/etc/mailname’ for reading: No such file or directory
The value of variable $myhostname is “smsgw”, but should have been
a fully qualified domain name; perhaps uname(3) did not provide such.
You must explicitly assign a FQDN of this host to variable $myhostname
in /etc/amavis/conf.d/05-node_id, or fix what uname(3) provides as a host’s
network name!
(failed).
Solution :
Edit /etc/hostname :
change from smsgw into mail.digitalfusi.com
Or by typing this command :
# hostname mail.digitalfusi.com
Restart amavis
# /etc/init.d/amavis restart
Stopping amavisd: (not running).
Starting amavisd: head: cannot open `/etc/mailname’ for reading: No such file or directory
amavisd-new.
Ok, I make the file and put ‘mail.digitalfusi.com’ inside /etc/mailname and restart amavis
# /etc/init.d/amavis restart
Stopping amavisd: amavisd-new.
Starting amavisd: amavisd-new.
Seem good
Checking all equipment ::
# tail -f /var/log/mail.log
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .zoo tried: zoo
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .lha
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .doc tried: ripole
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .cab tried: cabextract
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .tnef
Apr 25 12:38:30 smsgw amavis[4654]: Internal decoder for .tnef
Apr 25 12:38:30 smsgw amavis[4654]: No decoder for .exe tried: unrar-free; arj, unarj
Apr 25 12:38:30 smsgw amavis[4654]: Using primary internal av scanner code for ClamAV-clamd
Apr 25 12:38:30 smsgw amavis[4654]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Apr 25 12:38:30 smsgw amavis[4654]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.34, libdb 4.6
Install missing package :
# apt-get install lha zoo cabextract
Try again to verify :
# tail -f /var/log/mail.log
Apr 25 12:42:34 smsgw amavis[4878]: Found decoder for .zoo at /usr/bin/zoo
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for .lha
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for .doc tried: ripole
Apr 25 12:42:34 smsgw amavis[4878]: Found decoder for .cab at /usr/bin/cabextract
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for .tnef
Apr 25 12:42:34 smsgw amavis[4878]: Internal decoder for .tnef
Apr 25 12:42:34 smsgw amavis[4878]: No decoder for .exe tried: unrar-free; arj, unarj
Apr 25 12:42:34 smsgw amavis[4878]: Using primary internal av scanner code for ClamAV-clamd
Apr 25 12:42:34 smsgw amavis[4878]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
Apr 25 12:42:34 smsgw amavis[4878]: Creating db in /var/lib/amavis/db/; BerkeleyDB 0.34, libdb 4.6
Install other decoder:
# apt-get install unrar-free arj ripole tnef
Postfix Integration
Edit /etc/postfix/main.cf :
Add this line :
content_filter = smtp-amavis:[127.0.0.1]:10024
Edit /etc/postfix/master.cf :
Add these lines :
smtp-amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
Save.
Test
# telnet localhost 10024
Trying ::1…
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 [127.0.0.1] ESMTP amavisd-new service ready
Incoming search terms for the article: