一、利用RedHat 7.2中的默认配置方便地设置一台利用SASL库进行用户名和密码认证的SMTP服务器,以允许外面的用户以用户名和密码认证来relay邮件。
配置Sendmail
1. 选择‘服务器系统’安装Redhat 7.2
2. 进入目录 /usr/share/sendmail-cf/cf 。
如果你没有该目录,说明你还没有安装sendmail-cf-8.11.6-3 RPM包,从你的安装CD中安装它。
3. 修改文件redhat.mc如下
divert(-1)
dnl This is the sendmail macro config file. If you make changes to this file,
dnl you need the sendmail-cf rpm installed and then have to generate a
dnl new /etc/sendmail.cf by running the following command:
dnl
dnl m4 /etc/mail/sendmail.mc > /etc/sendmail.cf
dnl
include(`../m4/cf.m4')
VERSIONID(`linux setup for Red Hat linux')dnl
OSTYPE(`linux')
define(`confDEF_USER_ID',``8:12'')dnl
undefine(`UUCP_RELAY')dnl
undefine(`BITNET_RELAY')dnl
define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST',true)dnl
define(`confDONT_PROBE_INTERFACES',true)dnl
define(`PROCMAIL_MAILER_PATH',`/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/sendmail.st')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
DAEMON_OPTIONS(`Port=25,Name=MTA')dnl
DAEMON_OPTIONS(`Port=587,Name=MSA,M=Ea')dnl
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail)dnl
FEATURE(`access_db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl This changes sendmail to only listen on the loopback device 127.0.0.1
dnl and not on any other network devices. Comment this out if you want
dnl to accept email over the network.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
dnl We strongly recommend to comment this one out if you want to protect
dnl yourself from spam. However, the laptop and users on computers that do
dnl not have 24x7 DNS do need this.
dnl FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
其中,我加了下面的行:
1. TRUST_AUTH_MECH(`DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
2. define(`confAUTH_MECHANISMS', `DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
4. DAEMON_OPTIONS(`Port=25,Name=MTA')dnl
5. DAEMON_OPTIONS(`Port=587,Name=MSA,M=Ea')dnl
注:
第1,2行 移走前面的注释,打开相应的各种认证机制。
第3,4行 设置相应的MTA和MSA所在的端口号。
注意:要是你的系统是redhat 7.1的话,sendmail也是系统默认安装的话,还要打开以下注解:
1. dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
2. dnl FEATURE(`accept_unresolvable_domains')dnl
第1行 允许通过网络连接Sendmail。
第2行 禁止不可解析的域名relay邮件
最后运行
#m4 /usr/share/sendmail-cf/cf/redhat.mc > /etc/sendmail.cf
写到/etc/sendmail.cf文件中
安装pop3,从redhat 7.2的光盘上有imap-2000c-15.i386.rpm
rpm -ivh imap-2000c-15.i386.rpm
OK!
验证:netstat -a |grep pop
输出 ------tcp 0 0 * : pop3 *:* listen
ok了!
安装apache:
要是系统默认安装,就可以跳过。要是没有安装,从www.apache.org上下载最新版本。我用的是httpd-2.0.39.tar.gz,官方说是当前最好的了。
安装步骤:
tar -zxvf httpd-2.0.29.tar.gz
cd httpd.2.0.29
./configure --prefix=/var/www
make
make instal
启动:/var/www/bin/apachectl start
(详细配置,你可以看httpd.2.0.29目录中的install文件)
OK!到这,apache配置完成。
3、安装openwebmail。
下载相关的软件:
1、CGI.pm-2.74.tar.gz
2、MIME-Base64-2.12.tar.gz
3、libnet-1.0901.tar.gz
4、Download openwebmail-1.65.tgz程式套件,
5、perl.5.XX (redhat 7.2系统自带)
把前三个文件放在/tep目录下:
(1)For CGI.pm do the following:
cd /tmp
tar -zxvf CGI.pm-2.74.tar.gz
cd CGI.pm-2.74
perl Makefile.PL
make
make install
(2)For MIME-Base64 do the following:
cd /tmp
tar -zxvf MIME-Base64-2.12.tar.gz
cd MIME-Base64-2.12
perl Makefile.PL
make
make install
(3)For libnet do the following:
cd /tmp
tar -zxvf libnet-1.0901.tar.gz
cd libnet-1.0901
perl Makefile.PL
make
make install
(4)For openwebmial 主程式
cd /var/www
tar -zxvf openwebmail-1.65.tgz
mv /var/www/data/openwebmail /var/www/htdocs/
修改设定值:
(1)vi /var/www/cgi-bin/openwebmail/auth_unix.pl)
my $unix_passwdfile to /etc/shadow (找到这两行,修改。)
my $unix_passwdmkdb to none
(2)vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
下列是 RedHat 7.2 openwebmail.conf 的內容,请修改如下:
--------------------------------------------------------------------------------------
# Open WebMail configuration file
# This file contains just the overrides from openwebmail.conf.default
# please make all changes to this file.
# This file set options for all domains and all users.
# To set options on per domain basis, please put them in sites.conf/domainname
# To set options on per user basis, please put them in users.conf/username
domainnames auto
auth_module auth_unix.pl
mailspooldir /var/spool/mail
dbm_ext .db
dbmopen_ext none
ow_cgidir /var/www/cgi-bin/openwebmail
ow_htmldir /var/www/htdocs/openwebmail
logfile /var/log/openwebmail.log
spellcheck /usr/bin/aspell
default_language zh_CH.GB2312 -----默认简体中文