`
haoningabc
  • 浏览: 1477173 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

dspam安装

阅读更多
使用dspam-3.9.1-RC1

参考修改自http://hi.baidu.com/delphiss/blog/item/24da4611395c33fac3ce79c3.html
mysql模式
./configure \
--prefix=/usr/local/dspam \
--with-dspam-home=/var/dspam \
--with-dspam-home-owner=vmail \
--with-dspam-home-group=postdrop \
--with-dspam-mode=2510 \
--with-dspam-owner=vmail \
--with-dspam-group=postfix \
--with-delivery-agent=/usr/sbin/sendmail \
--with-storage-driver=mysql_drv \
--with-mysql-includes=/usr/include/mysql \
--with-mysql-libraries=/usr/lib64/mysql \
--enable-preferences-extension \
--enable-virtual-users \
--enable-daemon \
--enable-debug \
--enable-syslog \
--enable-clamav \
--with-logdir=/var/log/dspam 

注意64为系统用--with-mysql-libraries=/usr/lib64/mysql
最好指定一下prefix,要不文件都飞了找不到
---------------
创建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 'passwd123456'"

给 mysql_objects-4.1.sql 和 virtual_users.sql 增加一行内容到最上面:
use dspam;

# mysql -u dspam -p < mysql_objects-4.1.sql
# mysql -u dspam -p < virtual_users.sql

配置----

安装后dspam的配置文件为 /usr/local/etc/dspam.conf,修改之

TrustedDeliveryAgent    /usr/sbin/sendmail
Trust root
Trust vmail
Trust postfix

# spamAction 表示识别为垃圾邮件后的处理,quarantine:扔到隔离区,tag:给邮件Subject增加标记,deliver:直接投递
# quarantine 需要设置 QuarantineAgent
Preference "spamAction=tag"
# spamSubject tag操作的时候给邮件Subject前面增加的字符
Preference "spamSubject=SPAM"
#signatureLocation: dspam给每个识别后的邮件编个号码,将来可以用作重新训练
#'message': 把signature加在邮件正文后面,'headers':把signature加在邮件头里
Preference "signatureLocation=headers" # 'message' or 'headers'
Preference "showFactors=on"

# mysql的设置
MySQLServer             /var/lib/mysql/mysql.sock
MySQLUser               dspam
MySQLPass               passwd123456
MySQLDb                 dspam
MySQLCompress           true

启动 dspam 后台进程:
#/usr/local/dspam/bin/dspam --daemon &
-----------------------------
cat spam01.eml | /usr/local/dspam/bin/dspam --mode=teft --source=corpus --class=spam --feature=noise --user mydspam

训练垃圾邮件
-class=spam 表示训练识别垃圾邮件,训练识别非垃圾邮件则用参数 --class=innocent
--source=corpus 与 --source=error 对应的设置
--user mydspam 训练的user,dspam会自动创建。

dspam提供了一个批量训练邮件的命令:

dspam_train [username] [spam_dir] [nonspam_dir]

username 是训练用的user,spam_dir 和 nonspam_dir 是垃圾邮件和非垃圾邮件存储的目录

操作之后进入mysql
可以看到
select * from dspam_stats;
select * from dspam_token_data;
select * from dspam_virtual_uids;
有数据了



--------------管理页面太麻烦了--------
http://192.168.229.129/dspam/dspam.cgi
一下是注意的地方,具体参考http://hi.baidu.com/delphiss/blog/item/24da4611395c33fac3ce79c3.html
吧,对3.9的版本好使
yum install postfix
cd /etc/postfix
vim master.cf
dspam     unix  -       n       n       -       10      pipe
  flags=Rhqu    user=vmail      argv=/usr/local/dspam/bin/dspam --deliver=innocent --user mydspam -i -f $sender -- $recipient



yum install postfix
yum install pcre
yum install *perl*         perl的html图形等

cp webui/htdocs/dspam-logo-small.gif /var/www/html/
cp webui/htdocs/base.css /var/www/html/
/etc/httpd/conf.d/welcome.conf注释掉里面所有
否则httpd找不到/


----------web配置----------
mkdir /var/www/cgi-bin/dspam
cp -R /opt/backup/open_club_spam_filter/dspam-3.9.1-RC1/webui/cgi-bin/* /var/www/cgi-bin/dspam

vim /etc/httpd/conf.d/welcome.conf
全注释掉
vim /etc/httpd/conf/httpd.conf
#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
ScriptAlias /dspam "/var/www/cgi-bin/dspam"

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
<Directory "/var/www/cgi-bin/dspam">
Options ExecCGI
Options -Indexes
DirectoryIndex dspam.cgi
AllowOverride All
   Order deny,allow
   Deny from all
   AuthType Basic
   AuthName "DSPAM Control Center"
   AuthUserFile /usr/local/apache2/dspam.pass
   Require valid-user
   Satisfy Any
</Directory>



htpasswd -c /usr/local/apache2/dspam.pass mydspam


dspam_stats -H mydspam
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics