Chinaunix

标题: dspam 在extmail上的安装第二版 [打印本页]

作者: crastyl    时间: 2008-12-02 10:18
标题: dspam 在extmail上的安装第二版
第一次安装的有点问题。读取不到数据,也训练不成功。主要原因还是用户的权限问题
因为安装的apache运行的用户是vuser,vgroup而原来安装的是dspam的用户是dspam改为777的权限也没有用,在文档上有下列的说明
PERMISSIONS
   In the typical UNIX environment, you'll need to worry about the following
   permissions:
   The CGI User: This is the user your web server (most likely Apache) is
     running as. This is commonly 'nobody' or 'web'. You can find this in
     Apache's httpd.conf by searching for 'User'. The CGI user will need
     the ability to access the following components of DSPAM:
       - Ability to execute the dspam binary
       - Ability to read and write to dspam_home/data/
       - Trusted user permissions in dspam.conf ("Trust [username]")
       - The execution 'Group' used must match the group dspam is running as
         (this is typically 'mail', 'dspam', or similar)
提示要要运行的apache用户,由于我的apache石油vuser 和vgroup来运行的


# ./configure \
--enable-daemon \
--enable-clamav \
--enable-debug \
--enable-syslog \
--enable-preferences-extension \
--enable-long-usernames \
--enable-domain-scale \
--enable-virtual-users \
--with-dspam-home-owner=vuser\
--with-dspam-home-group=vgroup \
--with-dspam-mode=2510 \
--with-dspam-owner=vuser \
--with-dspam-group=vgroup \
--with-storage-driver=mysql_drv \
--with-mysql-includes=/usr/include/mysql \
--with-mysql-libraries=/usr/lib/mysql \
--with-logdir=/var/log/dspam \
--prefix=/usr/local/dspam \
--with-delivery-agent=/usr/sbin/sendmail

2 make &&make install
3# 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 'dspam'"
# vi mysql_objects-4.1.sql
增加一行内容到最上面:
use dspam; //不增加不知道用那个数据库
mysql -u dspam -p
# vi /usr/local/dspam/etc/dspam.conf        
Trust vuser
Trust vgroup
Preference "spamAction=quarantine"
Preference "signatureLocation=headers"  # 'message' or 'headers'/这里最好改成headers
Preference "showFactors=on"
Preference "spamAction=tag"
Preference "spamSubject=**SPAM**"
AllowOverride localStore
MySQLServer             /var/lib/mysql/mysql.sock
MySQLUser               dspam
MySQLPass               dspam
MySQLDb                 dspam
MySQLCompress           true
MySQLUIDInSignature    on
#LocalMX 127.0.0.1
ParseToHeaders on
#ChangeModeOnParse on
#ChangeUserOnParse on
ChangeUserOnParse user
ClamAVPort      3310
ClamAVHost      127.0.0.1
ClamAVResponse         accept

配置postfix
# vi /etc/postfix/master.cf        (以下只写出修改或增加的部分)
-------------------------------------------------------------------------------------------------------------
smtp      inet  n       -       n       -       -       smtpd   -o      content_filter=dspam:
dspam   unix    -       n       n       -       10      pipe    flags=Rhqu user=vuser argv=/usr/local/dspam/bin/dspam --deliver=innocent --user $user -i -f $sender -- $recipient
spam    unix    -       n       n       -       10      pipe    flags=Ru user=vuser argv=/usr/local/dspam/bin/dspam --class=spam --source=error --user vuser
notspam   unix    -       n       n       -       10      pipe  flags=Ru user=vuser argv=/usr/local/dspam/bin/dspam --class=innocent --source=error --user vuser

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
# vi /etc/postfix/dspam_filter_access        (建立新的文件,空格用 tab 键)
/./     FILTER dspam:dspam
编辑
vi /etc/postfix/transport        (建立新的文件,空格用 tab 键)
spam@icaot.com
           spam
notspam@icaot.com
      notspam
然后执行
postmap /etc/postfix/transport
二web界面的配置
mkdir /var/www/dspam
chown dspam:vgroup/var/www/dspam -R  
这里需要看你的postfix用的是什么帐户 我的apache用的是vuser vgroup
把dspam源码中webui下的cig-bin整个目录拷贝到/var/www/dspam下拷贝webui htdocs 的base.css
和login.gif到cgi哪里
chown dspam:vgroup cgi-bin -R
htpasswd -c /var/www/dspam/htpasswd
admin
echo "admin" >>/var/www/dspam/cgi-bin/admins
配置apache
DocumentRoot /var/www/dspam/cgi-bin
DirectoryIndex dspam.cgi
Options +ExecCGI
Addhandler cgi-script .cgi
        Order deny,allow
        Allow from all
        AuthType Basic
        AuthName "DSPAM Control Center"
        AuthUserFile /var/www/dspam/passwd
        Require valid-user
当时想用虚拟主机跑dspam但是配置也出了。不过用这种也行。。比较简单容易理解一点

垃圾邮件的训练
/usr/local/dspam/bin/dspam_train spam spam/ ham/




本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/57953/showart_1675077.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2