安装配置httpd文件
由于extmail要进行本地邮件的投递操作,所以必须以邮件投递代理所认可的用户身份运行httpd服务器。本利中打开了httpd服务器的suexec功能,所以使用一下方法来实现虚拟主机运行身份的指定。
<VirtualHost *:8081>
ServerName mail.dtedugongbing.com
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html/
CustomLog logs/mail.qupeiyin.net.log common
suexecusergroup postfix postfix
</VirtualHost>
suexec:
默认情况下,运行httpd程序的用户会以相同的身份运行httpd的cgi功能,如果要实现两者的运行身份分离,就使用到了suexec参数。
也可以直接修改user、group两个全局控制用户权限的参数。
user postfix
Group postfix
listen 8081
修改CGI执行文件属主为postfix运行身份用户。
chown -R postfix:postfix /var/www/extsuite/extmail/cgi/
通过WEB界面配置extmail。
登录邮箱管理后台,默认密码为extmail*123*
后台界面:
邮件加密传输SSL的运用
TCPDUMP
数据包抓包分析工具,常用的还有wireshark的tshark。
tcpdum语法:
tcpdump [optins] [protocol][direction][hosts][value][logical oprations][other expression]
反垃圾邮件工具:
内容过滤:
APACHE:spanassassin,垃圾邮件分拣器,对英文支持比较好,中午支持并不太好。属于内容过滤器。
病毒邮件网关:
clamav:开源杀毒软件,通常作为病毒邮件服务器网关
邮件服务器呼叫器:
用于调用反垃圾工具及病毒网关等。
常见工具:amavisd-new(常用),mailscanner,mimedefang
RBL:实时黑名单列表,通常是付费的,是提供反垃圾邮件的一种方法。
补充知识:
使用maildrop替换postfix默认的邮件投递代理(MDA)virtual。
1、安装前先将courier-authlib的头文件、库文件、执行文件进行系统定位。并创建用于启动maildrop的用户及uid。
下面进入报错的解决方案:
extmail报错:
Can‘t locate CGI.pm in @INC (@INC contains: /var/www/extsuite/extmail/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /var/www/extsuite/extmail/libs/Ext/CGI.pm line 20. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/CGI.pm line 20. Compilation failed in require at /var/www/extsuite/extmail/libs/Ext/App.pm line 23. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/App.pm line 23. Compilation failed in require at /var/www/extsuite/extmail/libs/Ext/App/Login.pm line 16. BEGIN failed--compilation aborted at /var/www/extsuite/extmail/libs/Ext/App/Login.pm line 16. Compilation failed in require at index.cgi line 20.
解决:yum install perl-CGI
报错: Can‘t locate /var/www/cgi-bin/extmail//lang//en_US in @INC (@INC contains: /var/www/extsuite/extmail/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at /var/www/extsuite/extmail/libs/Ext/Lang.pm line 65.
解决:没有主文件
[[email protected] extmail]# cp webmail.cf.default webmail.cf
[[email protected] extmail]# pwd /var/www/extsuite/extmail
报错:
Unix::Syslog not found, please install it first! (in cleanup) Undefined subroutine &Ext::Logger::do_closelog called at /var/www/extsuite/extmail/libs/Ext/Logger.pm line 86.
解决方案:
没有这个包: Unix-Syslog-1.1.tar.gz
# perl Makefile.PL
安装这个包的报错
Can‘t locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 1. BEGIN failed--compilation aborted at Makefile.PL line 1.
解决
yum install -y perl-ExtUtils-MakeMaker
# perl Makefile.PL # make install
报错
DBI connect(‘database=extmail;host=localhost;mysql_socket=/var/lib/mysql/mysql.sock‘,‘db_user‘,...) failed: Access denied for user ‘db_user‘@‘localhost‘ (using password: YES) at /var/www/extsuite/extmail/libs/Ext/Auth/MySQL.pm line 45
解决:进入数据库失败,修改主配置文件。 SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail
报错 Can‘t chdir to /home/domains/extmail.org/postmaster/Maildir/, No such file or directory
解决:
SYS_MAILDIR_BASE = /home/vmail
# mail [email protected] 发封邮件让它创建邮件目录
extmail后台的配置
后台的操作 同样的操作
NameVirtualHost *:80 <VirtualHost *:80> ServerName mail.example.com DocumentRoot /path/to/your/document/root/ ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html SuexecUserGroup vuser vgroup </VirtualHost>
只需要下面2行插入,mail前台配置中 ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html
最终Apache写入的配置:
<VirtualHost *:80>
ServerName mail.extmail.org
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html
ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
SuexecUserGroup vmail vmail
</VirtualHost>
/var/www/extsuite/extman chown vmail.vmail . -R
验证码
/var/www/extsuite/extman
cp webman.cf.default webman.cf
vim webman.cf SYS_CAPTCHA_ON = 1
SYS_CAPTCHA_LEN = 4
关于主页的显示:
vim /etc/rc.local
/var/www/extsuite/extman/daemon/cmdserver &
后台图形监控报错:
Can‘t locate RRDs.pm in @INC (@INC contains: /var/www/extsuite/extman/libs /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/GraphLog.pm line 23. Compilation failed in require at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. BEGIN failed--compilation aborted at /var/www/extsuite/extman/libs/Ext/MgrApp/ViewLog.pm line 22. Compilation failed in require at viewlog.cgi line 18.
解决方法: 下载软件包:rrdtool-perl-1.3.8-6.el6.x86_64.rpm yum localinstall rrdtool-perl-1.3.8-6.el6.x86_64.rpm
虽然显示出来监控目录,但是点击没反映:
# cp mailgraph_ext/ /usr/local/ -r 为什么要cp到/usr/local/下?
/usr/local/mailgraph_ext vim mailgraph-init会发现执行脚本的路经:BASEDIR=/usr/local/mailgraph_ext
# /usr/local/mailgraph_ext/mailgraph-init start
报错: Starting mail statistics grapher: mailgraph_ext Can‘t locate File/Tail.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296. BEGIN failed--compilation aborted at /usr/local/mailgraph_ext/mailgraph_ext.pl line 296. Starting queue statistics grapher: qmonitor
下载包: File-Tail-0.99.3.tar.gz
tar -zxf File-Tail-0.99.3.tar.gz # cd File-Tail-0.99.3 # perl Makefile.PL
报错: File::Tail will be installed without debugging information. This information isn‘t usefull unless you intend to tinker with the code. To install with debugging enabled, use: perl Makefile.PL LOGIT Checking if your kit is complete... Looks good Warning: prerequisite Time::HiRes 1.12 not found. Writing Makefile for File::Tail
解决方法: # yum install perl-Time-HiRes -y # perl Makefile.PL # make install
# /usr/local/mailgraph_ext/mailgraph-init start
之后就会看到图形化监控。
参考文件: Linux 邮件服务器 之跟我一步一步来实现一个邮件系统