六、配置dovecot
# vim /etc/dovecot.conf
mail_location = maildir:/var/mailbox/%d/%n/Maildir
……
auth default {
mechanisms = plain
passdb sql {
args = /etc/dovecot-mysql.conf
}
userdb sql {
args = /etc/dovecot-mysql.conf
}
……
把userdb的其他相关禁用
vim /etc/postfix/main.cf
#postfix的配置文件也要该
vim /etc/postfix/main.cf
home_mailbox = Maildir/
# vim /etc/dovecot-mysql.conf
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = '%u'
接下来启动dovecot服务:
# service dovecot start
# chkconfig dovecot on
七、安装Extmail-1.2 (先安装httpd)
1、安装
# mkdir -pv /var/www/extsuite
# tar -zxvf extmail-1.2.tar.gz -C /var/www/extsuite
# mv extmail-1.2/ /var/www/extsuite/extmail
# cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf
2、修改主配置文件
#vim /var/www/extsuite/extmail/webmail.cf
部分修改选项的说明:
SYS_MESSAGE_SIZE_LIMIT = 5242880
用户可以发送的最大邮件
SYS_USER_LANG = en_US
语言选项,可改作:
SYS_USER_LANG = zh_CN
SYS_MAILDIR_BASE = /home/domains
此处即为您在前文所设置的用户邮件的存放目录,可改作:
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_USER = db_user
SYS_MYSQL_PASS = db_pass
以上两句句用来设置连接数据库服务器所使用用户名、密码和邮件服务器用到的数据库,这里修改为:
SYS_MYSQL_USER = extmail
SYS_MYSQL_PASS = extmail
SYS_MYSQL_HOST = localhost
指明数据库服务器主机名,这里默认即可
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
以上用来指定验正用户登录里所用到的表,以及用户名、域名和用户密码分别对应的表中列的名称;这里默认即可
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
此句用来指明authdaemo socket文件的位置,这里修改为:
SYS_AUTHLIB_SOCKET = /usr/local/courier-authlib/var/spool/authdaemon/socket
3、apache相关配置
由于extmail要进行本地邮件的投递操作,故必须将运行apache服务器用户的身份修改为您的邮件投递代理的用户;本例中打开了apache服务器的suexec功能,故使用以下方法来实现虚拟主机运行身份的指定。此例中的MDA为postfix自带,因此将指定为postfix用户:
<VirtualHost *:80>
ServerName mail.liuwei.com
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
SuexecUserGroup postfix postfix
</VirtualHost>
修改 cgi执行文件属主为apache运行身份用户:
# chown -R postfix.postfix /var/www/extsuite/extmail/cgi/
如果您没有打开apache服务器的suexec功能,也可以使用以下方法解决:
# vim /etc/httpd/httpd.conf
User postfix
Group postfix
<VirtualHost *:80>
ServerName mail.liuwei.com
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
</VirtualHost>
4、依赖关系的解决
extmail将会用到perl的Unix::syslogd功能,您可以去http://search.cpan.org搜索下载原码包进行安装。
# tar -zxvf Unix-Syslog-1.1.tar.gz
#cd Unix-Syslog-1.1
# perl Makefile.PL
# make
# make install
5、启动apache服务
# service httpd start
# chkconfig httpd on
八、安装Extman-1.1
1、安装及基本配置
# tar -zxvf extman-1.1.tar.gz -C /var/www/extsuite
Cd /var/www/extsuite
# mv extman-1.1 /var/www/extsuite/extman
修改配置文件以符合本例的需要:
#cp /var/www/extsuite/extman/webman.cf.default /var/www/extsuite/extman/webman.cf
# vim /var/www/extsuite/extman/webman.cf
SYS_MAILDIR_BASE = /home/domains
此处即为您在前文所设置的用户邮件的存放目录,可改作:
SYS_MAILDIR_BASE = /var/mailbox
修改
SYS_CAPTCHA_ON = 1
为
SYS_CAPTCHA_ON = 0
修改cgi目录的属主:
# chown -R postfix.postfix /var/www/extsuite/extman/cgi/
在apache的主配置文件中Extmail的虚拟主机部分,添加如下两行:
vim /etc/httpd/httpd.conf
ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
创建其运行时所需的临时目录,并修改其相应的权限:
#mkdir -pv /tmp/extman
#chown postfix.postfix /tmp/extman
# vim /var/www/extsuite/extman/webman.cf
98 SYS_DEFAULT_UID = 2525
101 SYS_DEFAULT_GID = 2525
好了,到此为止,重新启动apache服务器后,您的Webmail和Extman已经可以使用了,可以在浏览器中输入指定的虚拟主机的名称进行访问,如下:
http://mail.liuwei.com
选择管理即可登入extman进行后台管理了。默认管理帐号为:[email protected] 密码为:extmail*123*
说明:
(1) 如果您安装后无法正常显示校验码,安装perl-GD模块会解决这个问题。如果想简单,您可以到以下地址下载适合您的平台的rpm包,安装即可: http://dries.ulyssis.org/rpm/packages/perl-GD/info.html
(2) extman-1.1自带了图形化显示日志的功能;此功能需要rrdtool的支持,您需要安装此些模块才可能正常显示图形日志。
2、配置Mailgraph_ext,使用Extman的图形日志:(下面所需的软件包面要自己下载)
接下来安装图形日志的运行所需要的软件包Time::HiRes、File::Tail和rrdtool,其中前两个包您可以去http://search.cpan.org搜索并下载获得,后一个包您可以到 http://oss.oetiker.ch/rrdtool/pub/?M=D下载获得; 注意安装顺序不能改换。
安装Time::HiRes
#tar zxvf Time-HiRes-1.9707.tar.gz
#cd Time-HiRes-1.9707
#perl Makefile.PL
#make
#make test
#make install
安装File::Tail
#tar zxvf File-Tail-0.99.3.tar.gz
#cd File-Tail-0.99.3
#perl Makefile.PL
#make
#make test
#make install
安装rrdtool-1.2.23
#tar zxvf rrdtool-1.2.23.tar.gz
#cd rrdtool-1.2.23
#./configure --prefix=/usr/local/rrdtool
#make
#make install
创建必要的符号链接(Extman会到这些路径下找相关的库文件)
#ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/auto/RRDs/RRDs.so /usr/lib/perl5/5.8.8/i386-linux-thread-multi/
#ln -sv /usr/local/rrdtool/lib/perl/5.8.8/RRDp.pm /usr/lib/perl5/5.8.5
#ln -sv /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/RRDs.pm /usr/lib/perl5/5.8.8
复制mailgraph_ext到/usr/local,并启动之
# cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local
# /usr/local/mailgraph_ext/mailgraph-init start
启动cmdserver(在后台显示系统信息)
# /var/www/extsuite/extman/daemon/cmdserver --daemon
添加到自动启动队列
# echo “/usr/local/mailgraph_ext/mailgraph-init start” >> /etc/rc.d/rc.local
# echo “/var/www/extsuite/extman/daemon/cmdserver -v -d” >> /etc/rc.d/rc.local
使用方法: 等待大约15分钟左右,如果邮件系统有一定的流量,即可登陆到extman里,点“图形日志”即可看到图形化的日志。具体每天,周,月,年的则点击相应的图片进入即可。
smtpd_recipient_restrictions=permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unauth_destination
九. 垃圾邮件过滤
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
[root@localhost ~]# vim /etc/postfix/access
192.168.4 REJECT
192.168.4.1 OK
bbc.com REJECT
[root@localhost ~]# postMAP /etc/postfix/access
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_helo_required = yes
smtpd_helo_restrictions = reject_invalid_hostname
[root@localhost ~]# postfix reload
[root@localhost ~]# vim /etc/postfix/mail.cf
smtpd_sender_login_maps =
mysql:/etc/postfix/mysql_virtual_sender_maps.cf,
mysql:/etc/postfix/mysql_virtual_alias_maps.cf
smtpd_sender_restrictions =
permit_mynetworks,
reject_sender_login-mismatch,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
check_sender_access hash:/etc/postfix/sender_access
[root@localhost ~]# vim /etc/postfix/sender_access
[email protected] REJECT
marketing@ REJECT
fake.aptech.com REJECT
[root@localhost ~]# postmap /etc/postfix/sender_access
[root@localhost ~]# vim /etc/postfix/main.cf
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_non_fqdn_ recipient,
reject_unknown_recipient_domain
[root@localhost ~]# postfix restart
1) 安装MailScanner 扫描调度工具
[root@localhost ~]# tar zxvf MailScanner-4.75.11-1.rpm.tar.gz
[root@localhost ~]# cd MailScanner-4.75.11-1
[root@localhost MailScanner-4.75.11-1]# ./install.sh
2) 修改配置文件MailScanner
[root@localhost ~]# vim /etc/MailScanner/MailScanner.conf
Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA =postfix
Required SpamAssassin Score =7
High SpamAssassin Score = 10
Spam Actions = deliver header “X-Spam-Status: Yes”
High Soring Spam Actions = delete forward [email protected]
3) 配置Postfix 支持调用MailScanner
[root@localhost ~]# vim /etc/postfix/main.cf
header_checks = regexp: /etc/postfix/header_checks
[root@localhost ~]# vim /etc/postfix/header_checks
/^Received:/HOLD
4) 调整邮件过滤队列的目录属主、属组,并启动MailScanner 服务程序
[root@localhost ~]# chown –R postfix.postfix
/var/spool/MailScanner/incoming
[root@localhost ~]# chown –R postfix.postfix
/var/spool/MailScanner/quarantine
[root@localhost ~]# service MailScanner start
[root@localhost ~]# chkconfig –level 35 MailScanner on
1) 安装并配置SpamAssassin 垃圾邮件过滤器
[root@localhost ~]# mount /dev/cdrom /media
[root@localhost ~]# cd /media
[root@localhost media]# rpm –ivh spamassassin-3.1.7-4.e15.i386.rpm
2) 修改配置文件local.cf
(位于“/etc/mail/spamassassin/local.cf”,一般不需要进行任何修改,保
持默认设置即可)
3) 启动SpamAssassin 服务
[root@localhost ~]# service spamassassin start
[root@localhost ~]# chkconfig –level 35 spamassassin on
1) 安装F-Port 软件包安装过程中出现提示是按回车键接受默认设置
[root@localhost ~]# tar zxvf fp-Linux-i686-ws.tar.gz –C /opt/
[root@localhost ~]# cd /opt/f-prot/
[root@localhost f-prot]# ./install-f-prot.pl
2) 升级F-Port 病毒库(服务器要能够访问Internet 互联网)
[root@localhost f-prot]# /opt/f-prot/fpupdate
[root@localhost f-prot]# crontab –e (计划任务)
00 8 * * * /opt/f-prot/fpupdate
[root@localhost f-prot]# service crond start
[root@localhost f-prot]# chkconfig –level 35 crond on
本文出自 “碧云天” 博客,转载请与作者联系!