本文己經假設你己經會 Linux,並且熟悉各項操作
SpamAssassin 跑在 Daemon Mode 以增加速度
1. 安裝必要的 Package
#emerge spamassassin amavisd-new
本文撰寫時間時的版本
spamassassin : 3.0.0-r1
amavisd-new : 20040701
2. 新增 Spamassassin 的 ShellScript /usr/bin/pff
#!/bin/bash
/usr/bin/spamc | /usr/sbin/sendmail -i "$@"
exit $?
EOF
3. 新增一個使用者 pff
#useradd -s /bin/nologin pff
#mkdir /home/pff
#chown pff /home/pff
4. 修改 /etc/amavisd.conf
有 Example 字樣,請移除
$mydomain = 'techarea.org';
$forward_method = 'smtp:[127.0.0.1]:10025';
$notify_method = $forward_method;
$inet_socket_port = 10024;
['ClamAV-clamd',
&ask_daemon, ["CONTSCAN {}n", "/tmp/clamd"],
qr/bOK$/, qr/bFOUND$/,
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
以上這邊注意一下,”tmp/clamd 是 for Gentoo 的….
5. 自動 update Virus Pattern
修改 /etc/freshclam.conf
有 Exmaple 字樣,請移除
到 /etc/cron.daily 下新增一個檔案,內容如下
#!/bin/sh
/usr/bin/freshclam --quiet -d -c 2 -l /var/log/clam-update.log
再執行
#touch /var/log/clam-update.log
#chmod 777 /var/log/clam-update.log (小朋友不要學,這是壞榜樣 :p)
6. Postfix 修正檔 /etc/postfix/main.cf
在最後一行加上
contect_filter = smtp-amavis:[127.0.0.1]:10024
7. Postfix 修正檔 /etc/postfix/master.cf
加上
pff unix - n n - - pipe
flags=Rq user=pff argv=/usr/bin/pff -f ${sender} -- ${recipient}
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=pff:
-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 mynetworks=127.0.0.0/8
7. 啟動相關 Serivce 並且設定成開機即可執行
# /etc/init.d/spamd start
# /etc/init.d/amavisd start
# /etc/init.d/postfix restart
# rc-update add spamd default
# rc-update add amavisd default
其他:
amavisd 應該可以做 SpamAssassin 的動作,我目前先放在第二個 POSTFIX Daemon 執行.
以後有空再來研究比較沒有問題的做法
這個架構其實很慢,若是要求速度,可能沒有辦法滿足。
要求速度,應該要將 SpamAssassin 用 C 重寫 :p
On this day..
- 電子郵件加上入聯戳記 UN FOR TAIWAN (最終版) - 2007
- DARPA Grand Challenge 2005 - 2005
- 無聲 Keyboard - 2004
- 台灣史之我思 - 2004




0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment