Amavisd + Spamassassin + ClamAV
By Rayed
Installing amavisd+Spamassassin+clamav
# cd /usr/ports/security/amavisd-new/
# make install
# cd /usr/ports/security/clamav/
# make install
Updating ClamAV virus defintation, every hour!:
# vi /usr/local/etc/freshclam.conf
... HTTPProxyServer proxy.saudi.net.sa
... HTTPProxyPort 8080
# freshclam
# crontab -e
... 43 * * * * /usr/local/bin/freshclam --quiet
Changing clamav setting to work as vscan user, same as amavisd:
# vi /usr/local/etc/clamav.conf
... # Change User to match amavid user
... User vscan
# chown -R vscan:vscan /var/run/clamav
Configuraing amavisd:
# cp /usr/local/etc/amavisd.conf-dist /usr/local/etc/amavisd.conf
# vi /usr/local/etc/amavisd.conf
... $mydomain = 'rayed.com';
... $virus_admin = "rayed\@$mydomain";
... $spam_admin = "rayed\@$mydomain";
... $final_spam_destiny = D_PASS;
... $banned_filename_re ... # change this to what ever you like
... @av_scanners ... # uncomment clamav section
... #$QUARANTINEDIR = '/var/virusmails'; # comment QUARANTINEDIR
Enabling clamavd and amavisd to start automatically:
# vi /etc/rc.conf
... # Add the following lines
... amavisd_enable="YES"
... clamav_clamd_enable="YES"
# /usr/local/etc/rc.d/clamav-clamd.sh start
# /usr/local/etc/rc.d/amavisd.sh start
After testing ClamAV, and amavisd, configure postfix to use amavisd:
# vi /usr/local/etc/postfix/master.conf
-------------------------------------
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-------------------------------------
# vi /usr/local/etc/postfix/main.cf
... content_filter=smtp-amavis:[127.0.0.1]:10024
# postfix reload