CentOS+Qmail安装笔记(4)


# 用daemontools来启动qmail-pop3d和qmail-pop3ds
ln -s /var/qmail/supervise/qmail-pop3d /service
ln -s /var/qmail/supervise/qmail-pop3ds /service

# 启动,停止,重启,查看队列等
vpopmailctl start|stop|restart|stat|pause|cont|help
# 检查服务
netstat -an | grep 110
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep

#管理:
echo 'export PATH=$PATH:/mail/vpopmail/bin' >> /etc/profile
source /etc/profile


安装courier-imap:
cd /opt/src
tar -xjf tar/courier-authlib-0.59.1.tar.bz2
cd courier-authlib-0.59.1
patch -p0 < ../tar/vpopmail_courier_cram-1.diff
./configure --with-RedHat
make
make install-strip
make install-configure

cp courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 755 /etc/init.d/courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc0.d/K30courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc1.d/K30courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc2.d/S80courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc3.d/S80courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc4.d/S80courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc5.d/S80courier-authlib
ln -s /etc/init.d/courier-authlib /etc/rc6.d/K30courier-authlib

cd /opt/src
tar -xjf tar/courier-imap-4.1.2.tar.bz2
cd courier-imap-4.1.2
chown -R vpopmail:vchkpw ../courier-imap-4.1.2
su vpopmail
umask 0022
./configure --with-redhat

make
exit
make install-strip
make install-configure
# 修改文件/usr/local/etc/authlib/authdaemonrc
--------------------------------
authmodulelist= "authvchkpw"
--------------------------------
/etc/init.d/courier-authlib start

cp courier-imap.sysvinit /etc/init.d/courier-imap
chmod 755 /etc/init.d/courier-imap
ln -s /etc/init.d/courier-imap /etc/rc0.d/K30courier-imap
ln -s /etc/init.d/courier-imap /etc/rc1.d/K30courier-imap
ln -s /etc/init.d/courier-imap /etc/rc2.d/S80courier-imap
ln -s /etc/init.d/courier-imap /etc/rc3.d/S80courier-imap
ln -s /etc/init.d/courier-imap /etc/rc4.d/S80courier-imap
ln -s /etc/init.d/courier-imap /etc/rc5.d/S80courier-imap
ln -s /etc/init.d/courier-imap /etc/rc6.d/K30courier-imap

# 修改文件/usr/lib/courier-imap/etc/imapd
------------------------------------
IMAPDSTART=YES
把" AUTH=CRAM-MD5" 加到 IMAP_CAPABILITY 开启安全认证(CRAM-MD5)
------------------------------------

# 修改文件/usr/lib/courier-imap/etc/imapd-ssl
----------------------------
IMAPDSSLSTART=YES
----------------------------

# 修改文件/usr/lib/courier-imap/etc/imapd.cnf

CN=szgwbn.com.cn

emailAddress=postmaster@szgwbn.com.cn

# 修改文件/usr/lib/courier-imap/etc/pop3d.cnf

CN=domain.com

emailAddress=postmaster@szgwbn.com.cn

#启动:

/etc/rc.d/init.d/courier-imap start

#使用outlook测试一下IMAP是否正常


安装Autorespond:
autorespond是一个自动回复工具,可以很好的与qmailadmin配合使用

cd /opt/src
tar -xzf tar/autorespond-2.0.4.tar.gz
cd autorespond-2.0.4
patch -p1 < ../tar/autorespond-2.0.4-2.0.5.patch
make
make install

安装ezmlm-idx:
exmlm是一个快速,强大的邮件列表程序,可以通过qmailadmin对其进行配置

cd /opt/src
tar -xzf tar/ezmlm-0.53.tar.gz
tar -xzf tar/ezmlm-idx-0.443.tar.gz
mv -f ezmlm-idx-0.443/* ezmlm-0.53/
cd ezmlm-0.53
patch -p0 < idx.patch
make
make setup


安装QmailAdmin:
cd /opt/src
tar -xzf tar/qmailadmin-1.2.11.tar.gz
cd qmailadmin-1.2.11
./configure --enable-htmllibdir=/mail/mailadmin --enable-cgibindir=/mail/apache2/cgi-bin --enable-htmldir=/mail/mailadmin --enable-imagedir=/mail/apache2/htdocs/images/qmailadmin --enable-qmaildir=/var/qmail --enable-ezmlmdir=/usr/local/bin --enable-autoresponder-bin=/usr/local/bin --enable-modify-quota
make
make install-strip

cd ../
tar -xzf tar/qmailadmin-help-1.0.8.tar.gz
cd qmailadmin-help-1.0.8
mkdir /mail/apache2/htdocs/images/qmailadmin/help
cp -rp * /mail/apache2/htdocs/images/qmailadmin/help/


安装SpamAssassin:
cd /root
yum install spamassassin
mkdir -p /var/qmail/supervise/spamd/log
mkdir -p /var/log/spamd
chown qmaill /var/log/spamd
cp /opt/src/toaster-scripts-0.9.0/spamd.run /var/qmail/supervise/spamd/run
cp /opt/src/toaster-scripts-0.9.0/spamd.log.run /var/qmail/supervise/spamd/log/run
chmod 755 /var/qmail/supervise/spamd/run
chmod 755 /var/qmail/supervise/spamd/log/run
cp /opt/src/toaster-scripts-0.9.0/local.cf /etc/mail/spamassassin/local.cf
mkdir /etc/mail/spamassassin/.spamassassin/
chown vpopmail /etc/mail/spamassassin/.spamassassin/
ln -s /var/qmail/supervise/spamd /service

#修改起动脚本使spamassassin支持vpopmail
#修改如下一行:
vi /etc/init.d/spamassassin
-------------------------------------------
SPAMDOPTIONS="-d -c -m5 -H -x -u spamd -v"
-------------------------------------------

vi /etc/sysconfig/spamassassin
---------------------------------------------
SPAMDOPTIONS="-d -c -m5 -H -x -u spamd -v"
----------------------------------------------

#spamassassin的过滤模板在/etc/mail/spamassassin/local.cf,修改为:
vi /etc/mail/spamassassin/local.cf
#spamassassin的过滤模板在/etc/mail/spamassassin/local.cf,修改为:


vi /etc/mail/spamassassin/local.cf


required_score 5.0

rewrite_header Subject ********SPAM********
report_safe 1
use_bayes 1
skip_rbl_checks 0
ok_languages zh en
ok_locales en ko
score HEAD_ILLEGAL_CHARS 0
score SUBJ_ILLEGAL_CHARS 0
score DATE_IN_PAST_03_06 0
score UPPERCASE_25_50 0
score UPPERCASE_50_75 0
score UPPERCASE_75_100 0
score X_MSMAIL_PRIORITY_HIGH 0
score X_PRIORITY_HIGH 0
score TO_TXT 100
score RATWARE_HASH_2 100
score RATWARE_HASH_2_V2 100
score BAYES_99 0.1
score BAYES_80 0.1
score BAYES_60 0.1
score FROM_ILLEGAL_CHARS 0.1
score MIME_BASE64_TEXT 0.1
score NO_RDNS_DOTCOM_HELO 0.1
score CHINA_HEADER 0.1
score NO_REAL_NAME 0.2
score HTML_MESSAGE 0.2
score MIME_HTML_ONLY 0.2
score MIME_HTML_ONLY_MULTI 0.2
score FORGED_MUA_OUTLOOK 0.2
score FORGED_HOTMAIL_RCVD 0.2
score FORGED_OUTLOOK_TAGS 0.2
score MAILTO_TO_SPAM_ADDR 0.2
# 使用中国反垃圾邮件联盟的CBL/CDL
# URL:
header RCVD_IN_CBL eval:check_rbl('cbl', 'cbl.anti-spam.org.cn.')
describe RCVD_IN_CBL Received via a relay in cbl.anti-spam.org.cn
tflags RCVD_IN_CBL net

header RCVD_IN_CDL eval:check_rbl('cdl-notfirsthop', 'cdl.anti-spam.org.cn.')
describe RCVD_IN_CDL CDL: dialup sender did non-local SMTP
tflags RCVD_IN_CDL net

#SCORE
score RCVD_IN_CBL 4.0
score RCVD_IN_CDL 3.0

#运行ntsysv,将spamassassin设定的为开机运行
#使用CCERT 中文垃圾邮件过滤规则集Chinese_rules.cf
wget -N -P /usr/share/spamassassin

#定期自动更新中文反垃圾邮件规则
crontab –e
#加入
0 0 1 * * wget -N -P /usr/share/spamassassin ; /etc/init.d/init-script restart

#建立SpamAssassin的学习系统
sa-learn --sync -D -p user_prefs

#查看自学习的数据信息
sa-learn --dump all

#查看调试信息
spamassassin --lint –D


安装Clamav:
groupadd clamav
useradd -g clamav clamav
cd /opt/src/tar
wget
wget
cd ../
tar -xzf tar/clamav-0.90.2.tar.gz
cd clamav-0.90.2
patch -p0 < ../tar/clamav-0.90.2.patch
./configure
make
make install-strip

# setup freshclam
touch /var/log/freshclam.log
chmod 600 /var/log/freshclam.log
chown clamav /var/log/freshclam.log
cp /opt/src/toaster-scripts-0.9.0/freshclam /etc/init.d/freshclam
chmod 755 /etc/init.d/freshclam
ln -s /etc/init.d/freshclam /etc/rc0.d/K30freshclam
ln -s /etc/init.d/freshclam /etc/rc1.d/K30freshclam
ln -s /etc/init.d/freshclam /etc/rc2.d/S80freshclam
ln -s /etc/init.d/freshclam /etc/rc3.d/S80freshclam
ln -s /etc/init.d/freshclam /etc/rc4.d/S80freshclam
ln -s /etc/init.d/freshclam /etc/rc5.d/S80freshclam
ln -s /etc/init.d/freshclam /etc/rc6.d/K30freshclam

# add freshclam.log to logrotate
cp /opt/src/toaster-scripts-0.9.0/freshclam.logrotate /etc/logrotate.d/freshclam

# run clamd under daemontools
mkdir -p /var/qmail/supervise/clamd/log
mkdir -p /var/log/clamd
chown clamav /var/log/clamd
cp ../toaster-scripts-0.9.0/clamd.run /var/qmail/supervise/clamd/run
cp ../toaster-scripts-0.9.0/clamd.log.run /var/qmail/supervise/clamd/log/run
chmod 755 /var/qmail/supervise/clamd/run
chmod 755 /var/qmail/supervise/clamd/log/run

# Start clamd and freshclam
ln -s /var/qmail/supervise/clamd /service
/etc/init.d/freshclam start


#更改/usr/local/etc/freshclam.conf文件,去掉下面选项前面的#:
vi /usr/local/etc/freshclam.conf
#Example \\前面加上#
UpdateLogFile /var/log/freshclam.log \\去掉前面的#
LogSyslog \\去掉前面的#
PidFile /var/run/freshclam.pid \\去掉前面的#

更改/usr/local/etc/clamd.conf文件,去掉下面选项前面的#:
vi /usr/local/etc/clamd.conf
#Example \\前面加上#
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/lib/clamav
chown clamav:clamav /var/lib/clamav
#升级clamscan病毒库
freshclam --verbose

#把freshclam加入crontab 定时更新病毒库,自动扫描/home目录
crontab -e
0 1 * * * freshclam --quiet -l /var/log/freshclam.log
0 6 * * * /usr/local/bin/clamscan --recursive --infected --exclude /usr/local/share/clamav/viruses.db --exclude /usr/local/share/clamav/viruses.db2 --log=/var/log/clamscan.log /home

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wygswx.html