经过查询资料之后找到这个解决方案,看样子跟系统的
SElinux,
有关
************
因
fedora core
有用
SElinux,
所以要多下列
***************
touch /var/log/openwebmail.log
chmod 660 /var/log/openwebmail.log
chown root.mail /var/log/openwebmail.log
chcon -u system_u /var/log/openwebmail.log
chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail*
修改輪替檔
nano /etc/logrotate.d/openwebmail.logrotate
/var/log/openwebmail.log {
weekly
rotate 4
missingok
nocompress
notifempty
create 0660 root mail
# 增加的
sharedscripts
postrotate
/usr/bin/chcon -u system_u /var/log/openwebmail.log
/usr/bin/chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
endscript
}
touch /var/log/openwebmail.log
chmod 660 /var/log/openwebmail.log
chown root.mail /var/log/openwebmail.log
chcon -u system_u /var/log/openwebmail.log
chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
chcon -t httpd_unconfined_script_exec_t /var/www/cgi-bin/openwebmail/openwebmail*
修改輪替檔
nano /etc/logrotate.d/openwebmail.logrotate
/var/log/openwebmail.log {
weekly
rotate 4
missingok
nocompress
notifempty
create 0660 root mail
# 增加的
sharedscripts
postrotate
/usr/bin/chcon -u system_u /var/log/openwebmail.log
/usr/bin/chcon -t httpd_sys_script_rw_t /var/log/openwebmail.log
endscript
}
然后安装反病毒和垃圾邮件的模块
Mail-SpamAssassin- 3.2.3 .tar.gz
MailScanner- 4.51.5 -1.rpm.tar.gz
install-Clam-SA.tar.gz
为了 简单 先生成rpm安装方式的
Mail-SpamAssassin
rpmbuild -tb Mail-SpamAssassin- 3.2.3 .tar.gz
又是依赖型问题
..T.T!!
根据提示缺少的包安装吧
..
生成的文件存在
:
/usr/src/redhat/RPMS/i386/spamassassin-
/usr/src/redhat/RPMS/i386/perl-Mail-SpamAssassi-
3.2.3
-1.i386.rpm/usr/src/redhat/RPMS/i386/perl-Mail-SpamAssassi-
3.2.3
-1.i386.rpm
执行
:
cd /usr/src/redhat/RPMS/i386
如果以前安装过需要卸载
rpm -e spamassassin- 3.0.1 -0.EL4
# rpm -q spamassassin
package spamassassin is not installed
package spamassassin is not installed
rpm -ivh *.rpm
Postfix
安装笔记
2
之防毒
,
过滤篇
下载
MailScanner, ClamAV 0.88
#wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/rpm/MailScanner-4.51.5-1.rpm.tar.gz
#wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/install-Clam-SA.tar.gz
# tar -zxvf MailScanner-4.51.5-1.rpm.tar.gz
#tar -zxvf install-Clam-SA.tar.gz
# cd MailScanner-4.51.5-1
# ./install.sh
# cd install-Clam-SA
# ./install.sh
注 : 这两步的过程比较长 , 可以先泡杯茶 …….
15. 2 . 配置 :
vi /etc/mail/spamassassin/init.pre
激活下面两个插件 ( 去掉前面的 # ):
loadplugin Mail::SpamAssassin::Plugin::DCC ???
loadplugin Mail::SpamAssassin::Plugin::Razor2
# vi /etc/MailScanner/MailScanner.conf
修改下面几项 :
Run As User = postfix
Run As Group = postfix
MTA = postfix
%org-name% = yayaa.net
%org-long-name% = YY
%web-site% = www.yayaa.net
#wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/rpm/MailScanner-4.51.5-1.rpm.tar.gz
#wget http://www.sng.ecs.soton.ac.uk/mailscanner/files/4/install-Clam-SA.tar.gz
# tar -zxvf MailScanner-4.51.5-1.rpm.tar.gz
#tar -zxvf install-Clam-SA.tar.gz
# cd MailScanner-4.51.5-1
# ./install.sh
# cd install-Clam-SA
# ./install.sh
注 : 这两步的过程比较长 , 可以先泡杯茶 …….
15. 2 . 配置 :
vi /etc/mail/spamassassin/init.pre
激活下面两个插件 ( 去掉前面的 # ):
loadplugin Mail::SpamAssassin::Plugin::DCC ???
loadplugin Mail::SpamAssassin::Plugin::Razor2
# vi /etc/MailScanner/MailScanner.conf
修改下面几项 :
Run As User = postfix
Run As Group = postfix
MTA = postfix
%org-name% = yayaa.net
%org-long-name% = YY
%web-site% = www.yayaa.net
确保下面几项正确:
Incoming Queue Dir = /var/spool/mqueue.in
Outgoing Queue Dir = /var/spool/mqueue
Virus Scanners = auto
Use SpamAssassin = yes
Incoming Queue Dir = /var/spool/mqueue.in
Outgoing Queue Dir = /var/spool/mqueue
Virus Scanners = auto
Use SpamAssassin = yes
#mkdir /var/spool/mqueue
#chown postfix:postfix /var/spool/mqueue
#chown postfix:postfix /var/spool/MailScanner/incoming
#chown postfix:postfix /var/spool/MailScanner/quarantine
#chown -R postfix:postfix /var/spool/mqueue.in
#chown –R postfix:postfix /var/spool/postfix
#chown postfix:postfix /var/spool/mqueue
#chown postfix:postfix /var/spool/MailScanner/incoming
#chown postfix:postfix /var/spool/MailScanner/quarantine
#chown -R postfix:postfix /var/spool/mqueue.in
#chown –R postfix:postfix /var/spool/postfix
开机自启动:
#chkconfig spamassassin on
#service spamassassin restart
#chkconfig postfix off
# chkconfig MailScanner on
#chkconfig spamassassin on
#service spamassassin restart
#chkconfig postfix off
# chkconfig MailScanner on
15.3.定时自动更新
使用CCERT 中文垃圾邮件过滤规则集Chinese_rules.cf
#wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf
定时更新:SA
# crontab –e
0 0 1 * * wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf;/etc/init.d/spamassassin restart;/etc/init.d/spamassassin restart
# sa-learn --sync -D -p user_prefs ( 建立学习系统)
#sa-learn --dump all(查看自学习的数据信息)
定时更新:ClamAV
#vi /usr/local/etc/freshclam.conf
去掉下面几句前面的 #
UpdateLogFile /var/log/freshclam.log
LogSyslog
PidFile /var/run/freshclam.pid
#vi /usr/local/etc/clamd.conf
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 2M
LogTime
PidFile /var/run/clamd.pid
LogSyslog
ScanMail
#touch /var/log/freshclam.log
#chmod 644 /var/log/freshclam.log
#chown clamav:clamav /var/log/freshclam.log
#mkdir /var/log/clamav
#touch /var/log/clamav/clamd.log
#chown –R clamav:clamav /var/log/clamav
#chmod –R 644 /var/log/clamav
#crontab –e
0 1 * * * freshclam --quiet -l /var/log/freshclam.log
使用CCERT 中文垃圾邮件过滤规则集Chinese_rules.cf
#wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf
定时更新:SA
# crontab –e
0 0 1 * * wget -N -P /usr/share/spamassassin www.ccert.edu.cn/spam/sa/Chinese_rules.cf;/etc/init.d/spamassassin restart;/etc/init.d/spamassassin restart
# sa-learn --sync -D -p user_prefs ( 建立学习系统)
#sa-learn --dump all(查看自学习的数据信息)
定时更新:ClamAV
#vi /usr/local/etc/freshclam.conf
去掉下面几句前面的 #
UpdateLogFile /var/log/freshclam.log
LogSyslog
PidFile /var/run/freshclam.pid
#vi /usr/local/etc/clamd.conf
LogFile /var/log/clamav/clamd.log
LogFileMaxSize 2M
LogTime
PidFile /var/run/clamd.pid
LogSyslog
ScanMail
#touch /var/log/freshclam.log
#chmod 644 /var/log/freshclam.log
#chown clamav:clamav /var/log/freshclam.log
#mkdir /var/log/clamav
#touch /var/log/clamav/clamd.log
#chown –R clamav:clamav /var/log/clamav
#chmod –R 644 /var/log/clamav
#crontab –e
0 1 * * * freshclam --quiet -l /var/log/freshclam.log
15.4.
重新启动,测试
#reboot
#tail –f /var/log/maillog |grep MailScanner
#reboot
#tail –f /var/log/maillog |grep MailScanner
16
、测试
webmail
方式收发电子邮件:
在
ie
中输入以下地址:
http://192.168.1.102/cgi-bin/openwebmail/openwebmail.pl
http://192.168.1.102/cgi-bin/openwebmail/openwebmail.pl
17
。用
OUTLOOK
或者
FOXMAIL
测试。
自己给自己写封信,发,再收。测试。
给外网的邮箱发信,再回复。测试。
至此,Webmail邮件服务器设定就完成了!