本方案的系统环境是RedHat 8.0。RedHat 8.0默认安装的是Sendmail 8.12.5 ,本测试环境中选择最新版本Sendmail8.12.9,所以需要先卸载旧版本: rpm -e sendmail-8.12.5
安装Sendmail+sasl支持
1、安装认证库 如果先前已经安装有旧版本的 Cyrus SASL,请先将其移除,方法是手工删除/usr/lib/sasl或/usr/local/lib/sasl目录。 安装过程如下: #cd /home/test #tar xvfz cyrus-sasl-1.5.28.tar.gz # cd cyrus-sasl-1.5.28 # ./configure -prefix=/usr --enable-login --with-pwcheck # make # make install 安装完成后,建立一个/var/pwcheck目录,pwcheck程序要用此目录。 接下来必须设置Sendmail的使用者身分查验方式,这里使用系统帐号与密码来进行验证。 安装结束以后,因为默认的安装路径为/usr/local/lib ,所以将认证库拷贝到/usr/lib中(openwebmail默认路径为/usr/lib)。 # cp /usr/local/lib/lib* /usr/lib # ln -s /usr/local/lib/sasl2 /usr/lib/sasl # cd /usr/lib/sasl # echo "pwcheck_method:pwcheck" > Sendmail.conf
2、安装Sendmail # cd /home/test # rpm -Uvh sendmail*.rpm 生成sendmail.cf文件,一般是编译sendmail.mc来生成sendmail.cf,这样的好处是通过编译,会查看出一些Sendmail的设置错误和漏洞。 # cd /etc/mail # vi sendmail.mc 笔者的sendmail.mc内容略(需要的读者可以向责编来函索要),但需要注意以下方面。 首先,为了支持Outlook或Foxmail,要将 TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl 的注释去掉,打开相应的认证机制。 其次,要设置相应的mta和msa的所用端口: DAEMON_OPTIONS(`Port=25,Name=MTA')dnl DAEMON_OPTIONS(`Port=587,Name=MSA,M=Ea')dnl 第三,为了允许通过网络连接Sendmail,并禁止不可解析的域名relay邮件,要将下面的代码注释掉: dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA') dnl FEATURE(`accept_unresolvable_domains' 最后保存。
3、编译sendmail.mc 生成sendmail.cf文件 # m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf # echo "chinafood.org" > local-host-names # sendmail -bd -q20m (启动sendmail) # pwcheck & (启动认证程序)
检测结果
检测SASL是否工作: #telnet localhost 25 输出类似如下: Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 chinafood.chinafood.org ESMTP Sendmail 8.12.9/8.12.9; Mon, 14 Jul 2003 14:37:27 +0800 ehlo chinafood.org 250-chinafood.chinafood.org Hello localhost.localdomain [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES …… 250-AUTH LOGIN PLAIN …… 只要输出有LOGIN PLAIN就OK了。 到这里,Sendmail就配置完了,您可以添加一个用户试试看,邮件用户是系统用户,如: #useradd test #passwd test (设置密码) 设置您的Foxmail或者Outlook,要设置上用户需要SMTP认证。
pop3安装
redhat8.0中有它的rpm包,是imap-2001a-15.i386.rpm。 # rpm -ivh imap-2001a-15.i386.rpm 修改/etc/xinetd.d/ipop3,把其中disable =yes更改为disable =no # /etc/rc.d/init.d/xinetd restart 重启POP3服务 [root@fyhtest xinetd.d]# telnet localhost 110 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. +OK POP3 localhost v2001.78rh server ready 有以上显示的为正确。
安装Open WebMail
1、编译Apache #cd /home/test # tar xzvf apache_1.3.26.tar.gz # cd apache_1.3.26 # ./configure --prefix=/usr/httpd --enable-module=most --enable-shared=max # make # make install 然后设置站点,并修改如下行: DocumentRoot "/usr/httpd/htdocs" ScriptAlias /cgi-bin/ "/usr/httpd/cgi-bin/" AddHandler cgi-script .cgi .pl
2、安装其他软件 perl: # rpm -Uvh perl-5.8.0-55.i386.rpm CGI.pm: # tar xzvf CGI.pm-2.74.tar.gz # cd CGI.pm-2.7.4 # perl Makefile # make # make install 以下软件安装方法相同,在此不再介绍: MIME-Base64-2.12.tar.gz Text-Iconv-1.2.tar.gz Authen-PAM-0.12.tar.gz
3.Open WebMail安装配置 首先安装Open WebMail: # tar xzvf openwebmail-2.10.tgz # cp -R cgi-bin /usr/httpd/ # cd data # cp -R openwebmail /usr/httpd/htdocs # chmod -R 755 /usr/httpd/cgi-bin # chmod 4755 /usr/sbin/perl (设置perl的suid为) # ln -s /usr/sbin/perl /usr/sbin/suidperl (openwebmail默认用suidperl解释)
然后修改/usr/httpd/cgi-bin/openwebmail/auth_unix.pl文件: my $unix_passwdfile_plaintext="/etc/passwd"; my $unix_passwdfile_encrypted="/etc/shadow"; my $unix_passwdmkdb="none";
最后修改/usr/httpd/cgi-bin/openwebmail/etc/openwebmail.conf,笔者的文件内容如下: domainnames auto auth_module auth_unix.pl mailspooldir /var/spool/mail dbm_ext .db dbmopen_ext %dbm_ext% dbmopen_haslock no ow_cgidir /usr/httpd/cgi-bin/openwebmail ow_cgiurl /cgi-bin/openwebmail ow_htmldir /usr/httpd/htdocs/openwebmail ow_htmlurl /openwebmail logfile /var/log/openwebmail.log spellcheck /usr/bin/ispell
<default_signature> -- Open WebMail Project (http://openwebmail.org) </default_signature> 然后运行/usr/httpd/cgi-bin/openwebmail/openwebmail-tool.pl -init,并启动apache: /usr/httpd/bin/apachectl start
到此,你可以浏览一下看安装是否成功:http://youdomain/cgi-bin/openwebmail/openwebmail.pl。例如我的地址:http://211.154.167.60/cgi-bin/openwebmail/openwebmail.pl效果如下图。

|