1 / 20

DSPAM 简介和使用

DSPAM 简介和使用. Xueron 2007-06-16. 反垃圾概述. 基本 MTA 控制(防止 OpenRelay , SMTP 认证, IP 并发、频率等) 关键字过滤 黑、白名单( IP 、 DOMAIN 、用户) DNS 测试 IP , HELO , SENDER 的一些 DNS 查询 SPF 、 DKIM 实时黑名单技术( RBL 、 URIBL ) 贝叶斯过滤 垃圾邮件评分( SA ) 指纹识别 行为检测 蜜罐 图片识别 HashCash Reputation ……. DSPAM 简介. Dspam 是一个开源的垃圾邮件过滤软件

lew
Download Presentation

DSPAM 简介和使用

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DSPAM简介和使用 Xueron 2007-06-16

  2. 反垃圾概述 • 基本MTA控制(防止OpenRelay,SMTP认证,IP并发、频率等) • 关键字过滤 • 黑、白名单(IP、DOMAIN、用户) • DNS测试 • IP,HELO,SENDER的一些DNS查询 • SPF、DKIM • 实时黑名单技术(RBL、URIBL) • 贝叶斯过滤 • 垃圾邮件评分(SA) • 指纹识别 • 行为检测 • 蜜罐 • 图片识别 • HashCash • Reputation • ……

  3. DSPAM简介 • Dspam是一个开源的垃圾邮件过滤软件 • 作者:Jonathan A. Zdziarski • 《Ending Spam: Bayesian Content Filtering and the Art of Statistical Language Classification 》 • 目前版本:3.8.0 (2007.3) • 特点: • 高效 0.01s-0.07s/msg • 准确 99.5% - 99.95%

  4. DSPAM的其他一些特性 • 数据库支持 • Hash DB • Sqlite,Sqlite3 • Mysql • Pgsql • Oracle(最新的3.8.0已经去掉了) • ClamAV集成 • WebUI • 自动白名单

  5. DSPAM的分词技术 • Word-逐个“词”的切分 • Chain-链式切分 • Sbph( Sparse Binary Polynomial Hashing) • Osb(Orthogonal Sparse biGram)

  6. DSPAM使用的算法 • Naïve(朴素bayes算法) • Graham("A Plan for Spam") • Burton(SpamProbe) • Robinson(Robinson‘s Geometric Mean Test) • Chi-square(Fisher-Robinson)

  7. DSPAM的训练方法 • Toe train-on-error 遇到错误才学习 • 优点:数据库写操作少些,学习效率高 • 缺点:准确性低一些 • Teft train-everything 学习所有 • 优点:简单实时 • 缺点:数据库增长很快,I/O频繁易出错 • Tum train-until-mature 学习到成熟 • 介于Teft和Toe之间的一个方法 • Tune train-until-no-errors 学习到没有错误 • 优点:准确率很高 • 缺点:学习需要的时间很长

  8. DSPAM的处理能力 • 最大的部署在35,000用户的系统上 • 通常处理一封邮件需要0.01s 到 0.07s (最高的 0.20s左右)

  9. DSPAM的应用 • 学习 • Dspam自带的工具 dspam_train • Dspam程序 $ ./dspam_train Usage: ./dspam_train [username] [[-i index]|[spam_dir] [nonspam_dir]] $ ./dspam --user user1 --class=[spam|innocent] --source=[error|corpus|inoculation] < message

  10. DSPAM的应用 • 学习方式:–source 参数 • error 针对dspam作成错误判断的邮件,使用这个方法学习。它要求邮件中dspam判断的特征串,或者以参数形势给它,以便对数据库相应的内容做修改 • corpus 对分好类的样本集做学习,通常在最开始的时候使用这个方式,这些样本没有被dspam判断或者学习过 • inoculation 接种方法,通常用来学习Honeypot收到的邮件,这些邮件的token将被额外的计数,以便突出,对识别新spam效果很好

  11. DSPAM的应用 • 部署dspam(postfix) • 作为content-filter • Dspam设置 [Postfix] (LMTP) -> [DSPAM] [Postfix] -> { Delivery } |___ (SMTP Reinjection) ____| # Serverside ServerMode auto ServerParameters "--deliver=innocent" ServerIdent "localhost.localdomain" ServerPID /var/run/dspam.pid ServerDomainSocketPath "/tmp/dspam.sock“ # Clientside DeliveryHost 127.0.0.1 DeliveryPort 10026 DeliveryIdent localhost DeliveryProto SMTP

  12. DSPAM的应用 • 部署dspam(postfix) • Postfix的设置 • Re-inject设置 smtp inet n - n - - smtpd -o content_filter=lmtp:unix:/tmp/dspam.sock localhost:10026 inet n - n - - 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=127.0.0.0/8 -o smtpd_authorized_xforward_hosts=127.0.0.0/8

  13. DSPAM的应用 • 部署dspam(amavisd-new) • amavisd.conf • amavisd $path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin'; $dspam = ‘/usr/bin/dspam'; …… my($proc_fh,$pid) = run_command('&'.fileno($fh), "&1", $dspam, qw(--stdout --deliver=spam,innocent --mode=tum --tokenizer=chained,noise --enable-signature-headers --user), $daemon_user, ); # --mode=teft # qw(--stdout --deliver-spam) # dspam < 3.0 # use option --feature instead of --tokenizer with dspam < 3.8.0 ……

  14. DSPAM的应用 • 做为SA的一个插件 • 同直接使用一样部署,但是设置dspam让其只在header上添加处理结果 • SA增加插件,根据邮件头上dspam的结果增减不通的分数 • 插件下载http://eric.lubow.org/projects/dspam/dspam.pm ServerParameters "--deliver=innocent,spam"

  15. DSPAM的应用 • 自动白名单 • Dspam跟踪完整“From:” 行,如果同一From:有10(可调)封正常邮件并且0封垃圾邮件,那么该记录被标记为白名单。一旦有用户报告来自该记录的spam,这个白名单记录将被删除。 • 启动白名单 • dspam.conf • 命令行参数 Feature whitelist --feature=wh

  16. DSPAM的数据库的清理 • 随着时间的增长,dpsam的不断使用和学习,他的token数据库和特征库也在不断的增长,所以需要定时的对过时的或者无用的数据进行清理。 • Hash-db • Sql • 对于mysql,有两个脚本,>4.1的脚本支持事务 0 0 * * * /usr/local/bin/dspam_clean [options] 0 0 * * * mysql --user=[user] --pass=[pass] [db] < /path/to/purge-4.1.sql

  17. DSPAM的web管理 • 统计监测 • 参数调节(用户级) • 隔离区管理 • 图形分析 • 系统管理(超级管理员)

  18. 参考资料 • http://dspam.nuclearelephant.com/ • http://dspam.nuclearelephant.com/text/README-3.6.7.txt

  19. Q&A • Email: xueron@xueron.com • MSN: xueron@hotmail.com • QQ: 412844

  20. 谢谢

More Related