前面整合好了extmail,不过没有测试使用foxmail这种客户端去测试收发邮件功能,今天测试的时候发现了蛮多问题,大部分和/etc/authmysqlrc这个文件的配置和权限相关,都是小问题,折腾了大半天时间,哎!邮件系统真的是很麻烦!下面就记录下邮件过滤和病毒查杀的配置,参考文档如下,感谢作者分享!

http://www.linuxquestions.in/index.php?topic=36.0
http://linuxguest.blog.51cto.com/195664/199632

一:邮件过滤

   
   
   
   
  1. [root@orcl ~]# cd /usr/local/src/tarbag/  
  2. [root@orcl tarbag]# wget ftp://ftp.espci.fr/pub/milter-greylist/milter-greylist-2.0.2.tgz  
  3. [root@orcl tarbag]# tar -zxvf milter-greylist-2.0.2.tgz -C ../software/  
  4. [root@orcl milter-greylist-2.0.2]# ./configure --prefix=/usr/local/greylist  
  5. Required libmilter not found. Use --with-libmilter  
  6. [root@orcl milter-greylist-2.0.2]# yum -y install sendmail-devel  
  7. [root@orcl milter-greylist-2.0.2]# make && make install  
  8. [root@orcl milter-greylist-2.0.2]# ls /usr/local/greylist/  
  9. bin  man  
  10.  
  11. [root@orcl milter-greylist-2.0.2]# cp rc-redhat.sh /etc/init.d/greylist  
  12. [root@orcl milter-greylist-2.0.2]# chmod +x /etc/init.d/greylist   
  13. [root@orcl milter-greylist-2.0.2]# chkconfig --add greylist  
  14. [root@orcl milter-greylist-2.0.2]# chkconfig greylist on  
  15.  
  16. [root@orcl ~]# tail -1 /etc/postfix/main.cf   
  17. smtpd_milters = unix:/var/milter-greylist/milter-greylist.sock  
  18.  
  19. [root@orcl ~]# grep -v '^#' /etc/mail/greylist.conf  |grep -v '^$'  
  20. acl whitelist addr 127.0.0.0/8  
  21. greylist 2m   
  22. acl whitelist addr 12.5.136.141/32    # Southwest Airlines (unique sender)  
  23. acl whitelist addr 12.5.136.142/32    # Southwest Airlines  
  24. acl whitelist addr 12.5.136.143/32    # Southwest Airlines  
  25. acl whitelist addr 12.5.136.144/32    # Southwest Airlines  
  26. acl whitelist addr 12.107.209.244/32  # kernel.org (unique sender)  
  27. ……………………输出省略…………………………  
  28.  
  29. [root@orcl ~]# service greylist start  
  30. Starting Milter-Greylist: [  OK  ]  
  31.  
  32. [root@orcl ~]# ls /var/milter-greylist/milter-greylist.*  
  33. /var/milter-greylist/milter-greylist.pid  /var/milter-greylist/milter-greylist.sock  
  34.  
  35. [root@orcl ~]# /usr/local/postfix/sbin/postfix stop  
  36. postfix/postfix-script: stopping the Postfix mail system  
  37. [root@orcl ~]# /usr/local/postfix/sbin/postfix start  
  38. postfix/postfix-script: starting the Postfix mail system 

Extmail邮件过滤和杀毒_第1张图片 

Extmail邮件过滤和杀毒_第2张图片 

   
   
   
   
  1. [root@orcl ~]# tail -f /var/log/maillog  
  2. 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=LOGINsasl_username=admin@yang.com  
  3. Sep 13 15:58:10 orcl postfix/cleanup[17265]: 6A20723EFB9: message-id=<2011091315575673407321@yang.com>Sep 13   
  4. 15:58:10 orcl milter-greylist: smfi_getsymval failed for {if_addr}  
  5. Sep 13 15:58:10 orcl postfix/qmgr[13086]: 6A20723EFB9: from=<admin@yang.com>size=1749nrcpt=1 (queue active)Sep 13 15:58:10 orcl postfix/smtpd[17243]: disconnect from unknown[192.168.227.1]  
  6. Sep 13 16:04:35 orcl postfix/smtp[17488]: 6A20723EFB9: to=<ylw6006@163.com>relay=163mx03.mxmail.netease.com  
  7. [123.125.50.140]:25, delay=385delays=348/0.01/32/5.1, dsn=2.0.0, status=sent (250 Mail OK queued as   
  8. 25,S8CowEC5tkmLDm9O7JYgAA--.7130S2 1315901072)  
  9. Sep 13 16:04:35 orcl postfix/qmgr[13086]: 6A20723EFB9: removed  

二:邮件杀毒

   
   
   
   
  1. [root@orcl ~]# cd /usr/local/src/tarbag/  
  2. [root@orcl tarbag]# wget http://nchc.dl.sourceforge.net/project/clamav/clamav/0.97.2/clamav-0.97.2.tar.gz  
  3. [root@orcl tarbag]# tar -zxvf clamav-0.97.2.tar.gz -C ../software/  
  4. [root@orcl tarbag]# cd ../software/clamav-0.97.2/  
  5. [root@orcl clamav-0.97.2]# groupadd clamav  
  6. [root@orcl clamav-0.97.2]# useradd -g clamav clamav  
  7. [root@orcl clamav-0.97.2]# ./configure --prefix=/usr/local/clamav  
  8. [root@orcl clamav-0.97.2]# make && make install  
  9. [root@orcl clamav-0.97.2]# ls /usr/local/clamav/  
  10. bin  etc  include  lib  sbin  share  
  11. [root@orcl clamav-0.97.2]# mkdir /usr/local/clamav/logs  
  12. [root@orcl clamav-0.97.2]# mkdir /usr/local/clamav/update  
  13.  
  14. [root@orcl ~]# grep -v '^#' /usr/local/clamav/etc/clamd.conf |grep -v '^$'  
  15. LogFile /usr/local/clamav/logs/clamd.log  
  16. PidFile /usr/local/clamav/update/clamd.pid  
  17. DatabaseDirectory /usr/local/clamav/update  
  18. LocalSocket /tmp/clamd.socket  
  19.  
  20. [root@orcl ~]# grep -v '^#' /usr/local/clamav/etc/freshclam.conf |grep -v '^$'  
  21. DatabaseDirectory /usr/local/clamav/update  
  22. UpdateLogFile /usr/local/clamav/logs/freshclam.log  
  23. PidFile /usr/local/clamav/update/freshclam.pid  
  24. DatabaseMirror database.clamav.net  
  25.  
  26. [root@orcl ~]# touch /usr/local/clamav/logs/freshclam.log  
  27. [root@orcl ~]# touch /usr/local/clamav/logs/clamd.log  
  28. [root@orcl ~]# chown -R clamav.clamav /usr/local/clamav/  
  29.  
  30. [root@orcl ~]# /usr/local/clamav/bin/freshclam   
  31. ClamAV update process started at Tue Sep 13 16:34:37 2011  
  32. Downloading main.cvd [100%]  
  33. main.cvd updated (version: 53, sigs: 846214, f-level: 53, builder: sven)  
  34. WARNING: Your ClamAV installation is OUTDATED!  
  35. WARNING: Current functionality level = 43recommended = 53 
  36. DON'T PANIC! Read http://www.clamav.net/support/faq  
  37. Downloading daily.cvd [ 67%]  
  38.  
  39. [root@orcl ~]# /usr/local/clamav/bin/clamscan -r /email --remove -l /usr/local/clamav/logs/clamscan.log  
  40. /email/mailbox/yang.com/admin/Maildir/maildirsize: OK  
  41. /email/mailbox/yang.com/admin/Maildir/.Junk/extmail-curcache.db: OK  
  42. /email/mailbox/yang.com/admin/Maildir/.Junk/maildirfolder: Empty file  
  43. /email/mailbox/yang.com/admin/Maildir/.Junk/extmail-curcnt: OK  
  44. /email/mailbox/yang.com/admin/Maildir/extmail-curcache.db: OK  
  45. /email/mailbox/yang.com/admin/Maildir/.Drafts/extmail-curcache.db: OK  
  46. /email/mailbox/yang.com/admin/Maildir/.Drafts/maildirfolder: Empty file  
  47. /email/mailbox/yang.com/admin/Maildir/.Drafts/extmail-curcnt: OK  
  48. /email/mailbox/yang.com/admin/Maildir/abook.cf: OK  
  49. /email/mailbox/yang.com/admin/Maildir/extmail-curcnt: OK  
  50. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315209989.M694119P12554V000000000000FD00I0033598A,S=352:2,S: OK  
  51. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315470328.M899053P31309V000000000000FD00I00335AD8,S=348:2,S: OK  
  52. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315293753.M922202P5384V000000000000FD00I0033598C,S=306:2,S: OK  
  53. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315293677.M625955P5320V000000000000FD00I0033598B,S=311:2,S: OK  
  54. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315554157.M6165P4649V000000000000FD00I00335ADA,S=186136:2,ASA: OK  
  55. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315360552.M565430P23846V000000000000FD00I00335ACD,S=340:2,S: OK  
  56. /email/mailbox/yang.com/admin/Maildir/.Sent/cur/1315470293.M558036P16741V000000000000FD00I00335AD7,S=344:2,S: OK  
  57. /email/mailbox/yang.com/admin/Maildir/.Sent/extmail-curcache.db: OK  
  58. /email/mailbox/yang.com/admin/Maildir/.Sent/maildirfolder: Empty file  
  59. /email/mailbox/yang.com/admin/Maildir/.Sent/extmail-curcnt: OK  
  60. /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209216.M252889P11932V000000000000FD00I00335983,S=95506:2,SA:   
  61.  
  62. OK  
  63. /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209389.M952518P12149V000000000000FD00I00335985,S=95465:2,SA:   
  64.  
  65. OK  
  66. /email/mailbox/yang.com/admin/Maildir/.Trash/cur/1315209575.M622698P12333V000000000000FD00I00335985,S=95473:2,ASA:   
  67.  
  68. OK  
  69. /email/mailbox/yang.com/admin/Maildir/.Trash/extmail-curcache.db: OK  
  70. /email/mailbox/yang.com/admin/Maildir/.Trash/maildirfolder: Empty file  
  71. /email/mailbox/yang.com/admin/Maildir/.Trash/extmail-curcnt: OK  
  72. /email/mailbox/yang.com/admin/Maildir/fileman/filesize: OK  
  73.  
  74. ----------- SCAN SUMMARY -----------  
  75. Known viruses: 1034901  
  76. Engine version: 0.97.2  
  77. Scanned directories: 30  
  78. Scanned files: 23  
  79. Infected files: 0  
  80. Data scanned: 0.81 MB  
  81. Data read: 0.48 MB (ratio 1.68:1)  
  82. Time: 42.771 sec (0 m 42 s)