如何对付垃圾邮件:在FreeBSD上安装FuzzyOCR来对付图片垃圾邮件

  垃圾邮件无所不在由早期文字形态信件进化到图文并貌HTML格式而由于anti-spam技术进步几乎可达到 9成拦阻率但「道高尺、魔高丈」spammer开始大量运用图片形态方式来寄送邮件图像式垃圾邮件在图片内容加入大量噪声数据(noisy data)藉以回避扫描引擎侦测

  以目前anti-spam市场所推出产品若是缺少扫描图像式垃圾邮件功能相信也无法在市场上生存例如:IronPort、Sophos PureMessage等厂商皆推出具备相关功能产品

  当然开放源码SpamAssassin也不能在此功能上缺席也出现了不少相对应solution例如:OcrPlugin

  而此篇文章所要介绍 FuzzyOCR套修改自OcrPluginSpamassassin plugin同样是利用光学辨认(OCR)方式来识别图像式邮件所包含「文字讯息」并利用Fuzzy word matching算法判断辨识出来文字

  主要具备了下列功能:

  Optical Character Recognition using dferent engines and tings

  Fuzzy word matching algorithm applied to OCR results

  Image hashing system to learn unique properties of known spam images

  Dimension, size and egrity checking of images

  Content-Type verication for the containing email

  Matching and learning techniques

  可弹性支持区别OCR erface并利用fuzzy word matching算法来处理辨识结果

  支持DB可将处理过图片以feature vectors形态储存在数据库因此相同或是类似图片便可以利用储存在DB特征向量来处理

  能检测区别维度、size和整合性测试

  邮件内容检测

  Resource saving techniques

  仅扫描邮件而非辨认该封信件是否为垃圾信件信件分类仍交由spamassassin所判别分数高低来决定

  对于已达到spam分数门坎邮件FuzzyOCR在处理该封邮件时会忽略该封信件而不进行扫描进而减轻系统负载(3.5版的后提供)

  藉由比对储存于DBfeature vectors(dimensions and file size)若比对成功则忽略该封信件而不再进行OCR辨识和处理

  Safety measures

  可设定扫描邮件timeout时间藉以避免Denial of Service攻击

  使用word s取代simple lists避免FuzzyOCR错判可能

  具体过程如下:

  更新ports

  # portsnap fetch update

  通过ports安装

  # cd /usr/ports/mail/p5-FuzzyOcr-devel

  # make clean

  # cp /usr/local/share/examples/FuzzyOcr/FuzzyOcr.* /usr/local/etc/mail/spamassassin

  # vi /usr/local/etc/mail/spamassassin/init.pre

  加入如下内容:

  # FuzzyOcr

  loadplugin Mail::SpamAssassin::Plugin::FuzzyOcr

  # vi /usr/local/etc/mail/spamassassin/FuzzyOcr.cf

  确定focr_logfile设置为:

  focr_logfile /var/log/FuzzyOcr.log

  保存设置以后重启反垃圾邮件网关引擎例如:mailscanner

  # /usr/local/etc/rc.d/mailscanner restart

  如果没有用mailscanner那么重启sa-spamd

  # /usr/local/etc/rc.d/sa-spamd restart

  测试是否正常工作:

  # cd /tmp

  # mkdir test;cd test

  # fetch http://users.own-hero.net/~decoder/fuzzyocr/sample-mails.tar.gz

  # unzip sample-mails.tar.gz

  # spamassassin -t < ocr-g.eml

  或者查看日志文件:

  # tail -f /var/log/FuzzyOcr.log

  # tail -f /var/log/maillog

Tags:  freebsd7.2安装 freebsd硬盘安装 freebsd安装 如何对付垃圾邮件

延伸阅读

最新评论

发表评论