2006年9月11日
AntiVirusとSPAMチェック
○AntiVirusとSPAMチェック
以前利用していたH+BEDV AntiVirの無料版が無くなったようだ。
今回はports/security/clamsmtpを利用することにする。これを使うとamavisd-newも必要ないようだ。
SPAMチェックはports/mail/p5-Mail-SpamAssassin/
「ClamSMTPとSpamAssassinをPostfixで利用メモ」を参照して設定した。
postofix側設定
master.cf
#
# AV scan filter (used by content_filter)
#
scan unix - - n - 16 smtp
-o smtp_send_xforward_command=yes
# SpamAssassin
#
spamd unix - n n - - pipe
user=spamd argv=/usr/local/bin/spamc
-e /usr/sbin/sendmail -oi -f ${sender} -- ${recipient}
# For injecting mail back into postfix from the filter
#
127.0.0.1:10026 inet n - n - 16 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
pickup fifo n - n 60 1 pickup <--既存行
-o content_filter=scan:[127.0.0.1]:10025 <--追加
main.conf
#
# content filter: for ClamSMTP
# for SpamAssassin
#content_filter = scan:127.0.0.1:10025
content_filter = spamd
receive_override_options = no_address_mappings
allow_mail_to_commands = alias,forward,include <--fmlに必要
# SMTP-AUTH
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtp_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated,
# check_relay_domains
/etc/procmailrc
ユーザー宛メールでSpam Pointの高いものを/dev/nullへ。
他は各ユーザーメールボックスへ。### # # Master Procmail Recipe for Postfix > Procmail > Cyrus # ### LOGFILE=/var/log/procmail.log DELIVERTO="/usr/local/cyrus/bin/deliver" USERINBOX="$DELIVERTO -a $USER -m user.$USER" INCLUDERC=/home/$USER/.procmailrc # Last but not least, deliver mail that falls through to the user’s INBOX #exim4 adds From line which doesn't work right with cyrus, so remove it :0 fw | /usr/local/bin/formail -I 'From ' -b # 20.0 point < /dev/null :0 * ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* /dev/null :0 w | $USERINBOX~/.procmailrc
LOGFILE=/var/log/procmail.log
DELIVERTO="/usr/local/cyrus/bin/deliver"
DEFAULT="$DELIVERTO -a $USER -m user.$USER"
:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
/dev/null
:0
*^X-Spam-Status: Yes
|${DEFAULT}.spam
# Accept all the rest to your default mailbox
:0
|${DEFAULT}
- by Webmaster
- at 21:56
comments