Dspam确实是一款很不错的开源反垃圾邮件软件,并且还能配合clamav反病毒,通过学习后,能达到99%的正确率,误判很小,并且能针对每个用户的习性学习垃圾邮件及反垃圾邮件,在国外很流行,国内很少有人用。 下面是我的安装步骤,希望能对所需之人有所帮助。 groupadd -g 1005 dspam useradd -g dspam -u 1005 dspam 1\编译安装,支持mysql ./configure \ --prefix=/usr/ \ --enable-daemon \ --enable-clamav \ --enable-debug \ --enable-syslog \ --enable-preferences-extension \ --enable-long-usernames \ --enable-domain-scale \ --enable-virtual-users \ --with-dspam-home-owner=dspam \ --with-dspam-home-group=dspam \ --with-dspam-mode=2510 \ --with-dspam-owner=dspam \ --with-dspam-group=dspam \ --with-storage-driver=mysql_drv \ --with-mysql-includes=/usr/include/mysql \ --with-mysql-libraries=/usr/lib/mysql \ --with-logdir=/var/log/dspam \ --with-delivery-agent=/usr/sbin/sendmail make make install 2\建立mysql用户及数据库 cd src/tools.mysql_drv mysql -u root -p -e "create database dspam" mysql -u root -p -e "grant all on dspam.* to dspam@localhost identified by '123456'" vi mysql_objects-4.1.sql 增加一行内容到最上面: use dspam; vi virtual_users.sql 增加一行内容到最上面: use dspam; mysql -u dspam -p mysql -u dspam -p cp purge-4.1.sql /usr/local/dspam/var/dspam/purge.sql crontab -e 15 23 * * * /usr/bin/mysql -u dspam -p'123456' dspam 30 23 * * * dspam /usr/local/dspam/bin/dspam_logrotate -a 30 -d /usr/local/dspam/var/dspam/data 3\配置 dspam vi /usr/etc/dspam.conf TrustedDeliveryAgent /usr/sbin/sendmail Trust dspam Trust postfix Preference "spamAction=quarantine" Preference "signatureLocation=headers" # 'message' or 'headers' Preference "showFactors=on" #Preference "spamAction=tag" //此参数注释掉,否则不能更改message handling. Preference "spamSubject=SPAM" MySQLServer /var/lib/mysql/mysql.sock MySQLUser dspam MySQLPass 123456 MySQLDb dspam MySQLCompress true 4\配置postfix [Postfix] (LMTP) -> [DSPAM] [Postfix] -> { Delivery } |___ (SMTP Reinjection) ____| vi /usr/etc/dspam.conf ServerMode auto ServerParameters "--deliver=innocent" ServerIdent "localhost.localdomain" ServerPID /var/run/dspam.pid ServerDomainSocketPath "/tmp/dspam.sock" Start dspam : /usr/bin/dspam --daemon & Configure Postfix to use a content filter 修改master.cf smtp inet n - n - - smtpd To: smtp inet n - n - - smtpd -o content_filter=dspam: # -o content_filter=lmtp:unix:/tmp/dspam.sock 5\测试dspam工作是否正常 随便发一封测试邮件,查看信头,有如下,说明正常: X-DSPAM-Result: Innocent X-DSPAM-Processed: Mon Nov 12 16:49:17 2007 X-DSPAM-Confidence: 1.0000 X-DSPAM-Probability: 0.0023 X-DSPAM-Signature: 1,4738138d233081377414986 X-DSPAM-Factors: 27, (六) 配置DSPAM Web Control mkdir /var/www/cgi-bin/dspam cp -r /usr/src/dspam-3.8.0/webui/cgi-bin/* /var/www/cgi-bin/dspam/ cp /usr/src/dspam-3.8.0/webui/htdocs/base.css /var/www/cgi-bin/dspam/ cp /usr/src/dspam-3.8.0/webui/htdocs/dspam-logo-small.gif /var/www/cgi-bin/dspam/ chown -R dspam.dspam /var/www/cgi-bin/dspam/ 修改webui/cgi-bin下的admins. echo “vmail” >admins htpasswd -c /var/www/cgi-bin/dspam vmail 配置apache: DocumentRoot /var/www/cgi-bin/dspam SuexecUserGroup dspam dspam Options ExecCGI Options -Indexes Addhandler cgi-script .cgi DirectoryIndex dspam.cgi AllowOverride All Order deny,allow Deny from all AuthType Basic AuthName "DSPAM Control Center" AuthUserFile /var/www/cgi-bin/dspam/password Require valid-user Satisfy Any crontab -e 15 23 * * * /usr/bin/mysql -u dspam -p'123456' dspam 30 * * * * dspam /usr/bin/dspam_logrotate -a 30 -d /usr/var/dspam/data 1、Postfix filtering vi /usr/etc/dspam.conf TrustedDeliveryAgent "/usr/sbin/sendmail" vi /etc/postfix/master.cf smtp inet n - n - - smtpd -o content_filter=dspam: dspam unix - n n - 10 pipe flags=Rhqu user=dspam argv=/usr/bin/dspam --deliver=innocent --user $user -i -f $sender -- $recipient spam unix - n n - 10 pipe flags=Ru user=dspam argv=/usr/bin/dspam --class=spam --source=error --user dspam notspam unix - n n - 10 pipe flags=Ru user=dspam argv=/usr/bin/dspam --class=innocent --source=error --user dspam vi /etc/postfix/dspam_filter_access /./ FILTER dspam:dspam vi /etc/postfix/transport,add spam@jimzhang.com spam notspam@jimzhang.com notspam vi /etc/postfix/main.cf transport_maps = hash:/etc/postfix/transport smtpd_client_restrictions = check_client_access hash:/etc/postfix/dspam_filter_access local_recipient_maps = proxy:unix:passwd.byname $transport_maps $alias_maps dspam_destination_recipient_limit = 1 最后检查一下/var/www/cgi-bin/dspam,configure.pl文件 若不能生成图像,安装以下: Can't locate GD/Graph/bars.pm Install GD::Graph::bars wget http://cpan.mirror.ac.za/authors/id/B/BW/BWARFIELD/GDGraph-1.44_01.tar.gz Can't locate GD/Graph/lines3d.pm Install GD::Graph::lines3d wget http://search.cpan.org/CPAN/authors/id/W/WA/WADG/GD-Graph3d-0.63.tar.gz yum install gd-devel Can't locate GD.pm Install GD http://search.cpan.org/CPAN/authors/id/L/LD/LDS/GD-2.39.tar.gz tar zxfv GD-2.39.tar.gz cd GD-2.39 perl Makefile.PL make & make install Can't locate GD/Graph.pm http://search.cpan.org/CPAN/authors/id/B/BW/BWARFIELD/GDGraph-1.44_01.tar.gz cd GDGraph-1.44_01 perl Makefile.PL make & make install Can't locate GD/Text/Align.pm GD::Text::Align http://search.cpan.org/CPAN/authors/id/M/MV/MVERB/GDTextUtil-0.86.tar.gz cd GDTextUtil-0.86 perl Makefile.PL make & make install 若中文主题有乱码,将httpd.conf的AddDefaultCharset GB2312. 装好clamav,并启动 Vi dspam.conf Clamavport 3310 Clamavhost 127.0.0.1 Clamavresponse reject 若训练垃圾邮件的时候,出现以下错误: dspam[2380]: Signature retrieval for '2,457582a423802003310769' failed dspam[2380]: Unable to find a valid signature. Aborting. dspam[2380]: process_message returned error -5. dropping message. 将以下三项打开 ParseToHeaders on ChangeModeOnParse on ChangeUserOnParse on MySQLUIDInSignature on //此项一定要打开 在 http://www.ccert.edu.cn/spam/sa/2005-Jun.tar.gz 下载学习样本。 dspam_train spam ham/ spam/ (dspam_train username spam_dir ham_dir) |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-30 05:39 , Processed in 0.110614 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.