前面整合好了extmail,不过没有测试使用foxmail这种客户端去测试收发邮件功能,今天测试的时候发现了蛮多问题,大部分和/etc/authmysqlrc这个文件的配置和权限相关,都是小问题,折腾了大半天时间,哎!邮件系统真的是很麻烦!下面就记录下邮件过滤和病毒查杀的配置,参考文档如下,感谢作者分享!
http://www.linuxquestions.in/index.php?topic=36.0
http://linuxguest.blog.51cto.com/195664/199632
一:邮件过滤
- [root@orcl ~]# cd /usr/local/src/tarbag/
- [root@orcl tarbag]# wget ftp://ftp.espci.fr/pub/milter-greylist/milter-greylist-2.0.2.tgz
- [root@orcl tarbag]# tar -zxvf milter-greylist-2.0.2.tgz -C ../software/
- [root@orcl milter-greylist-2.0.2]# ./configure --prefix=/usr/local/greylist
- Required libmilter not found. Use --with-libmilter
- [root@orcl milter-greylist-2.0.2]# yum -y install sendmail-devel
- [root@orcl milter-greylist-2.0.2]# make && make install
- [root@orcl milter-greylist-2.0.2]# ls /usr/local/greylist/
- bin man
- [root@orcl milter-greylist-2.0.2]# cp rc-redhat.sh /etc/init.d/greylist
- [root@orcl milter-greylist-2.0.2]# chmod +x /etc/init.d/greylist
- [root@orcl milter-greylist-2.0.2]# chkconfig --add greylist
- [root@orcl milter-greylist-2.0.2]# chkconfig greylist on
- [root@orcl ~]# tail -1 /etc/postfix/main.cf
- smtpd_milters = unix:/var/milter-greylist/milter-greylist.sock
- [root@orcl ~]# grep -v '^#' /etc/mail/greylist.conf |grep -v '^$'
- acl whitelist addr 127.0.0.0/8
- greylist 2m
- acl whitelist addr 12.5.136.141/32 # Southwest Airlines (unique sender)
- acl whitelist addr 12.5.136.142/32 # Southwest Airlines
- acl whitelist addr 12.5.136.143/32 # Southwest Airlines
- acl whitelist addr 12.5.136.144/32 # Southwest Airlines
- acl whitelist addr 12.107.209.244/32 # kernel.org (unique sender)
- ……………………输出省略…………………………
- [root@orcl ~]# service greylist start
- Starting Milter-Greylist: [ OK ]
- [root@orcl ~]# ls /var/milter-greylist/milter-greylist.*
- /var/milter-greylist/milter-greylist.pid /var/milter-greylist/milter-greylist.sock
- [root@orcl ~]# /usr/local/postfix/sbin/postfix stop
- postfix/postfix-script: stopping the Postfix mail system
- [root@orcl ~]# /usr/local/postfix/sbin/postfix start
- postfix/postfix-script: starting the Postfix mail system
- [root@orcl ~]# tail -f /var/log/maillog
- Sep 13 15:58:10 orcl milter-greylist: User [email protected] authenticated, bypassing greylistingSep 13 15:58:10 orcl postfix/smtpd[17243]: 6A20723EFB9: client=unknown[192.168.227.1], sasl_method=LOGIN, sasl_username=admin@yang.com
- Sep 13 15:58:10 orcl postfix/cleanup[17265]: 6A20723EFB9: message-id=<2011091315575673407321@yang.com>Sep 13
- 15:58:10 orcl milter-greylist: smfi_getsymval failed for {if_addr}
- Sep 13 15:58:10 orcl postfix/qmgr[13086]: 6A20723EFB9: from=<admin@yang.com>, size=1749, nrcpt=1 (queue active)Sep 13 15:58:10 orcl postfix/smtpd[17243]: disconnect from unknown[192.168.227.1]
- Sep 13 16:04:35 orcl postfix/smtp[17488]: 6A20723EFB9: to=<ylw6006@163.com>, relay=163mx03.mxmail.netease.com
- [123.125.50.140]:25, delay=385, delays=348/0.01/32/5.1, dsn=2.0.0, status=sent (250 Mail OK queued as
- 25,S8CowEC5tkmLDm9O7JYgAA--.7130S2 1315901072)
- Sep 13 16:04:35 orcl postfix/qmgr[13086]: 6A20723EFB9: removed
二:邮件杀毒
- [root@orcl ~]# cd /usr/local/src/tarbag/
- [root@orcl tarbag]# wget http://nchc.dl.sourceforge.net/project/clamav/clamav/0.97.2/clamav-0.97.2.tar.gz
- [root@orcl tarbag]# tar -zxvf clamav-0.97.2.tar.gz -C ../software/
- [root@orcl tarbag]# cd ../software/clamav-0.97.2/
- [root@orcl clamav-0.97.2]# groupadd clamav
- [root@orcl clamav-0.97.2]# useradd -g clamav clamav
- [root@orcl clamav-0.97.2]# ./configure --prefix=/usr/local/clamav
- [root@orcl clamav-0.97.2]# make && make install
- [root@orcl clamav-0.97.2]# ls /usr/local/clamav/
- bin etc include lib sbin share
- [root@orcl clamav-0.97.2]# mkdir /usr/local/clamav/logs
- [root@orcl clamav-0.97.2]# mkdir /usr/local/clamav/update
- [root@orcl ~]# grep -v '^#' /usr/local/clamav/etc/clamd.conf |grep -v '^$'
- LogFile /usr/local/clamav/logs/clamd.log
- PidFile /usr/local/clamav/update/clamd.pid
- DatabaseDirectory /usr/local/clamav/update
- LocalSocket /tmp/clamd.socket
- [root@orcl ~]# grep -v '^#' /usr/local/clamav/etc/freshclam.conf |grep -v '^$'
- DatabaseDirectory /usr/local/clamav/update
- UpdateLogFile /usr/local/clamav/logs/freshclam.log
- PidFile /usr/local/clamav/update/freshclam.pid
- DatabaseMirror database.clamav.net
- [root@orcl ~]# touch /usr/local/clamav/logs/freshclam.log
- [root@orcl ~]# touch /usr/local/clamav/logs/clamd.log
- [root@orcl ~]# chown -R clamav.clamav /usr/local/clamav/
- [root@orcl ~]# /usr/local/clamav/bin/freshclam
- ClamAV update process started at Tue Sep 13 16:34:37 2011
- Downloading main.cvd [100%]
- main.cvd updated (version: 53, sigs: 846214, f-level: 53, builder: sven)
- WARNING: Your ClamAV installation is OUTDATED!
- WARNING: Current functionality level = 43, recommended = 53
- DON'T PANIC! Read http://www.clamav.net/support/faq
- Downloading daily.cvd [ 67%]
- [root@orcl ~]# /usr/local/clamav/bin/clamscan -r /email --remove -l /usr/local/clamav/logs/clamscan.log
- /email/mailbox/yang.com/admin/Maildir/maildirsize: OK
- /email/mailbox/yang.com/admin/Maildir/.Junk/extmail-curcache.db: OK
- /email/mailbox/yang.com/admin/Maildir/.Junk/maildirfolder: Empty file
- /email/mailbox/yang.com/admin/Maildir/.Junk/extmail-curcnt: OK
- /email/mailbox/yang.com/admin/Maildir/extmail-curcache.db: OK
- /email/mailbox/yang.com/admin/Maildir/.Drafts/extmail-curcache.db: OK
- /email/mailbox/yang.com/admin/Maildir/.Drafts/maildirfolder: Empty file
- /email/mailbox/yang.com/admin/Maildir/.Drafts/extmail-curcnt: OK
- /email/mailbox/yang.com/admin/Maildir/abook.cf: OK
- /email/mailbox/yang.com/admin/Maildir/extmail-curcnt: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315209989.M694119P12554V000000000000FD00I0033598A,S=352:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315470328.M899053P31309V000000000000FD00I00335AD8,S=348:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315293753.M922202P5384V000000000000FD00I0033598C,S=306:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315293677.M625955P5320V000000000000FD00I0033598B,S=311:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315554157.M6165P4649V000000000000FD00I00335ADA,S=186136:2,ASA: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315360552.M565430P23846V000000000000FD00I00335ACD,S=340:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315470293.M558036P16741V000000000000FD00I00335AD7,S=344:2,S: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/extmail-curcache.db: OK
- /email/mailbox/yang.com/admin/Maildir/.Sent/maildirfolder: Empty file
- /email/mailbox/yang.com/admin/Maildir/.Sent/extmail-curcnt: OK
- /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209216.M252889P11932V000000000000FD00I00335983,S=95506:2,SA:
- OK
- /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209389.M952518P12149V000000000000FD00I00335985,S=95465:2,SA:
- OK
- /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209575.M622698P12333V000000000000FD00I00335985,S=95473:2,ASA:
- OK
- /email/mailbox/yang.com/admin/Maildir/.Trash/extmail-curcache.db: OK
- /email/mailbox/yang.com/admin/Maildir/.Trash/maildirfolder: Empty file
- /email/mailbox/yang.com/admin/Maildir/.Trash/extmail-curcnt: OK
- /email/mailbox/yang.com/admin/Maildir/fileman/filesize: OK
- ----------- SCAN SUMMARY -----------
- Known viruses: 1034901
- Engine version: 0.97.2
- Scanned directories: 30
- Scanned files: 23
- Infected files: 0
- Data scanned: 0.81 MB
- Data read: 0.48 MB (ratio 1.68:1)
- Time: 42.771 sec (0 m 42 s)