百独托管7500 紫田网络超高转化播放器收cps[推荐]速盾CDN 免实名免备防屏蔽阿里云 爆款特卖9.9元封顶提升alexa、IP流量7Q5团队
【腾讯云】中小企福利专场【腾讯云】多款产品1折起高防 随时退换 好耶数据小飞国外网赚带你月入万元炎黄网络4H4G10M 99每月
香港带宽CN2/美国站群优惠中客数据中心 服务器租用联盟系统移动广告平台 中易企业专场腾讯云服务器2.5折九九数据 工信部正规资质
腾讯云新用户大礼包代金券高价收cpa注册量高价展示【腾讯云】2核2G/9.93起租服务器找45互联 随时退换阿里云 短信服务 验证秒达

[其它内容] 对MailWatch for MailScanner 进行配置测试 [复制链接]
查看:938 | 回复:1

154

主题

671

帖子

586

积分

落伍者(一心一意)

Rank: 1

贡献
28
鲜花
1
注册时间
2013-4-4

落伍手机绑定

发表于 2013-4-5 15:45:24 | |阅读模式 来自 中国广东广州
安装 mailwatch 之前,确定系统上安装的 MailScanner 已经可以正常工作,postfix 或其他 MTA 可以正常的收发邮件,同时重要的是系统上安装好了 PHP 程序。

一、配置PHP
需要修改下 PHP 的配置文件 php.ini 里面的一些参数:
vim /usr/local/webserver/php/etc/php.ini
short_open_tag = On
safe_mode = Off
register_globals = Off
magic_quotes_gpc = On
magic_quotes_runtime = Off
session.auto_start = 0


二、安装配置mailwatch
1.建立 mailwatch 所需要的数据库 mailscanner
mysql -uroot -p < create.sql
mysql -uroot -p
mysql> GRANT ALL ON mailscanner.* TO mailwatch@www.tvvcd.com IDENTIFIED BY '123456';
mysql> GRANT ALL ON mailscanner.* TO mailwatch@'127.0.0.1' IDENTIFIED BY '123456';
mysql> FLUSH PRIVILEGES;

建立web管理用户
mysql> use mailscanner;
mysql> insert into users(username,password,type) values('admin',md5('123456'),'A');

2.修改配置文件
# cd /root/mailwatch/MailScanner_perl_scripts/
# cp MailWatch.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
# vim /usr/lib/MailScanner/MailScanner/CustomFunctions/MailWatch.pm
my($db_user) = 'mailwatch';
my($db_pass) = '123456';

黑名单、白名单设置
# cp SQLBlackWhiteList.pm /usr/lib/MailScanner/MailScanner/CustomFunctions/
  my($db_user) = 'mailwatch';
  my($db_pass) = '123456';

# vim /etc/MailScanner/spam.assassin.prefs.conf
bayes_path /etc/MailScanner/bayes/bayes
bayes_file_mode 0660
bayes_auto_learn 0
建立目录,赋予权限
# mkdir /etc/MailScanner/bayes/
# chown root:vmail /etc/MailScanner/bayes
# chmod g+rws /etc/MailScanner/bayes
测试
# spamassassin -D -p /etc/MailScanner/spam.assassin.prefs.conf --lint

3.From within the unpacked mailwatch directory move the directory called 'mailscanner' to the web server's root.
mv mailscanner /data/html/

Check the permissions of /data/html/mailscanner/images and /var/www/html/images/cache - they should be ug+rwx and owned by root and in the same group as the web server user
# chown -R root:vmail /data/html/mailscanner/
# chmod -R ug+rwx /data/html/mailscanner/images
# chmod ug+rwx images
# chmod ug+rwx images/cache

添加虚拟主机
# vim /usr/local/webserver/apache/conf/extra/extmail-vhosts.conf
<VirtualHost *:80>
ServerName mailwatch.fresh100.com.cn
DocumentRoot /data/html/mailscanner/
Errorlog /usr/local/webserver/apache/logs/mailwatch-error.log
CustomLog /usr/local/webserver/apache/logs/mailwatch-access.log combined
</VirtualHost>


4.修改mailwatch web配置 文件
# cp /data/html/mailscanner/conf.php.example /data/html/mailscanner/conf.php
# vim /data/html/mailscanner/conf.php
define('DB_USER', 'mailwatch');
define('DB_PASS', '123456');
define('MAILWATCH_HOME', '/data/html/mailscanner');

5.修改MailScanner配置
# vim /etc/MailScanner/MailScanner.conf
Quarantine User = root
Quarantine Group = vmail (this should be the same group as your web server)
Quarantine Permissions = 0660
Quarantine Whole Message = yes
Quarantine Whole Message As Queue Files = no
Detailed Spam Report = yes
Include Scores In SpamAssassin Report = yes
Always Looked Up Last = &MailWatchLogging
Quarantine Permissions = 0660
Always Looked Up Last = &MailWatchLogging
Is Definitely Not Spam = &SQLWhitelist
Is Definitely Spam = &SQLBlacklist


6.重新启动MailScanner
# service MailScanner stop
# service MailScanner start
日志信息如下,证明配置成功
Dec 12 10:57:11 mail MailScanner[21681]: Starting up SQL Blacklist
Dec 12 10:57:11 mail MailScanner[21681]: Read 0 blacklist entries
Dec 12 10:57:11 mail MailScanner[21681]: Config: calling custom init function MailWatchLogging
Dec 12 10:57:11 mail MailScanner[21681]: Started SQL Logging child
Dec 12 10:57:11 mail MailScanner[21681]: Config: calling custom init function SQLWhitelist
Dec 12 10:57:11 mail MailScanner[21681]: Starting up SQL Whitelist
Dec 12 10:57:11 mail MailScanner[21681]: Read 0 whitelist entries


三、如下测试:



白名单和黑名单,查询数据库如下:
mysql> select * from blacklist;
+----+-----------------+-----------------+---------------+
| id | to_address      | to_domain       | from_address  |
+----+-----------------+-----------------+---------------+
|  1 | fresh100.com.cn | fresh100.com.cn | okauto.com.cn |
+----+-----------------+-----------------+---------------+
1 row in set (0.00 sec)

mysql> select * from whitelist;
+----+-----------------+-----------------+-----------------------+
| id | to_address      | to_domain       | from_address          |
+----+-----------------+-----------------+-----------------------+
|  1 | fresh100.com.cn | fresh100.com.cn | service@okauto.com.cn |
+----+-----------------+-----------------+-----------------------+
1 row in set (0.00 sec)

文章原创来源出自http://www.tvvcd.com 转载请注明
作用为:除了账号service@okauto.com.cn 可以向www.tvvcd.com域内账号发送邮件,且不被视为垃圾邮件外。okauto.com.cn域内的其他所有账号向fresh100.com.cn域内账号发邮件,将被作为垃圾邮件处理。
电影http://www.tvvcd.com最新电影

31

主题

694

帖子

17

积分

落伍者(一心一意)

Rank: 1

贡献
449
鲜花
0
注册时间
2013-2-26

QQ绑定落伍手机绑定

发表于 2013-4-7 13:22:25 | 来自 中国浙江杭州
老天,楼主辛苦了~
论坛客服/商务合作/投诉举报:2171544 (QQ)
落伍者创建于2001/03/14,本站内容均为会员发表,并不代表落伍立场!
拒绝任何人以任何形式在本论坛发表与中华人民共和国法律相抵触的言论!
落伍官方微信:2030286 邮箱:(djfsys@gmail.com|tech@im286.com)
© 2001-2014

浙公网安备 33060302000191号

浙ICP备11034705号 BBS专项电子公告通信管[2010]226号

  落伍法律顾问: ITlaw-庄毅雄

手机版|找回帐号|不能发帖?|Archiver|落伍者

GMT+8, 2024-11-1 07:12 , Processed in 0.058444 second(s), 36 queries , Gzip On.

返回顶部