SOLARIS+QMAIL+VPOPMAIL+IGENUS+QMAILAMDIN
一、准备工作:安装gcc、make、autoconf、automake等编译工具,建立网络连接,配置域名。
二、安装patch工具:
# gzip ?d patch-2.5.4-sol8-intel-local.gz
# pkgadd ?d patch-2.5.4-sol8-intel-local
# mv /usr/bin/patch /usr/bin/patch.bak
# cp /usr/local/bin/patch /usr/bin/patch
三、安装ucspi-tcp-0.88
# gzip -d ucspi-tcp-0.88.tar.gz
# tar xvf ucspi-tcp-0.88.tar
# cd ucspi-tcp-0.88
# patch -p1 < ../ucspi-tcp-0.88.a_record.patch
# patch -p1 < ../ucspi-tcp-0.88.errno.patch
# patch -p1 < ../ucspi-tcp-0.88.nobase.patch
# make
# make setup check
四、安装qmail
1.建目录:
# mkdir /var/qmail
# mkdir /var/qmail/alias
2.建组及用户:
# groupadd nofiles
# groupadd qmail
# useradd -g nofiles -m -d /var/qmail/alias -s /bin/false alias
# useradd -g nofiles -m -d /var/qmail -s /bin/false qmaild
# useradd -g nofiles -m -d /var/qmail -s /bin/false qmaill
# useradd -g nofiles -m -d /var/qmail -s /bin/false qmailp
# useradd -g qmail -m -d /var/qmail -s /bin/false qmailq
# useradd -g qmail -m -d /var/qmail -s /bin/false qmailr
# useradd -g qmail -m -d /var/qmail -s /bin/false qmails
3.打补丁及编绎安装qmail
# gzip -d qmail-1.03.tar.gz
# tar xvf qmail-1.03.tar
# gzip -d qmail-smtpd-auth-0.31.tar.gz
# tar xvf qmail-smtpd-auth-0.31.tar
# cp qmail-smtpd-auth-0.31/base64.* qmail-1.03
# patch -d qmail-1.03 < qmail-smtpd-auth-0.31/auth.patch
# cd qmail-1.03
# patch -p1 < ../qmail-103.patch
# patch -p1 < ../qmailqueue-patch
# patch -p1 < ../qmail-1.03.qmail_local.patch
# patch -p1 < ../qmail-maildir++.patch
# patch -p1 < ../qmail-1.03.errno.patch
修改qmail-smtpd.c将函数straynewline中的451改为553.(在53行)
查找“http://”两次,改其中的url如下(这样可以使QMAIL更安全些):
void straynewline() { out("451 See http://nero.3322.org.\r\n");
out("214 llzqq home page: http://nero.3322.org\r\n");
# make setup check
出现错误后,修改auto-ccld.sh文件中CC,LD成你所用的环境就可以了。
# ./config-fast nero.3322.org
4.添加别名用户:
# touch /var/qmail/alias/.qmail-root
# touch /var/qmail/alias/.qmail-postmaster
# touch /var/qmail/alias/.qmail-mailer-daemon
5.如果存在postfix和sendmail,停用现在的mail服务
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail
# chmod 777 /usr/sbin/sendmail
五、安装vpopmail
1.建立目录:
# mkdir /export/home/vpopmail
# mkdir /export/home/vpopmail/etc
2.添加用户和组:
# groupadd vchkpw
# useradd -g vchkpw -s /bin/false -m -d /export/home/vpopmail vpopmail
3.添加mysql的vpopmail用户,用于操作vpopmail数据库
# mysql -u root ?p******
mysql>create database vpopmail;
mysql>grant all on vpopmail.* to vpopmail@localhost identified by "password";
4.编译安装vpopmail
# gzip -d vpopmail-5.2.1.tar.gz
# tar xvf vpopmail-5.2.1.tar
# cd vpopmail-5.2.1
# vi vmysql.h
========================= vmysql.h========================
#define MYSQL_UPDATE_SERVER "localhost" (mysql服务器名)
#define MYSQL_UPDATE_USER "vpopmail" (用户名)
#define MYSQL_UPDATE_PASSWD "*****" (改成你设置的密码)
#define MYSQL_READ_SERVER "localhost" (mysql服务器名)
#define MYSQL_READ_USER "vpopmail" (用户名)
#define MYSQL_READ_PASSWD "*****" (改成你设置的密码)
在54行和58行后加 \
#define TABLE_LAYOUT "pw_name char(32) not null, \
pw_domain char(64) not null, <===== 54
pw_passwd char(40), \
pw_uid int, pw_gid int, \
pw_gecos char(4, \
pw_dir char(160), <===== 58
pw_shell char(20), \
primary key (pw_name, pw_domain ) "
========================= vmysql.h========================
5.创建tcp.smtp文件(或者使用/etc/tcp.smtp)
# vi /export/home/vpopmail/etc/tcp.smtp
127.0.0.1:allow,RELAYCLIENT=""
:allow
# cd /export/home/vpopmail/etc
# tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp
6.进行编译:
./configure
--prefix=/export/home/vpopmail
--enable-mysql=y
--enable-incdir=/opt/sfw/mysql/include/mysql --enable-libdir=/opt/sfw/mysql/lib/mysql --enable-default-domain=nero.3322.org
--enable-passwd=n
--enable-defaultquota=52428800s --enable-tcprules-prog=/usr/local/bin/tcprules --enable-tcpserver-file=/export/home/vpopmail/etc/tcp.smtp --enable-vpopuser=vpopmail
--enable-vpopgroup=vchkpw
--enable-ip-alias-domains=n
需要改下面两个文件中的“cc -s”为“gcc -s”
./cdb/conf-cc
./cdb/conf-ld
# make
# make install-strip
7.创建虚拟域
# cd /export/home/vpopmail/bin
# ./vadddomain nero.3322.org
如果不成功的话,则必须先删除创建的域(vdeldomain 域名),
# ./vadduser llzqq@nero.3322.org
# ./vadduser test@nero.3322.org
如果添加domain时,提示Domain already exists,但却删除domain又提示Domain does not exist.则采用下面的处理方法.
删除/var/qmail/control目录下rcpthosts,virtualdomains文件中有关domain的信息;同时删除/var/qmail/user目录下assign文件中有关domain的信息;然后运行/var/qmail/bin/qmail-newu.这时候就可以正常添加domain了.
六、smtp-auth的设置
1.修改vchkpw的属性
# cd /export/home/vpopmail/bin
# chmod 4755 vchkpw
# chown root:sys vchkpw
如果使用带验证的smtp,smtp进程要调用密码验证程序,则必须要使用 setuid 和setgid。提高vchkpw的权限,才能完成setgid操作。
2.安装cmd5checkpw
# gzip -d cmd5checkpw-0.22.tar.gz
# tar xvf cmd5checkpw-0.22.tar
# cd cmd5checkpw-0.22
# make
# mkdir /usr/man/man8
# make install
七、生成qmail的启动脚本
# cp /var/qmail/boot/home /var/qmail/rc
对rc文件进行修改,以决定投送方式:
# vi /var/qmail/rc
这里要注意,这三个文件中的命令最好写在一行.
=====================================rc=====================================
#!/bin/sh
# Using splogger to send the log through syslog.
# Using dot-forward to support sendmail-style ~/.forward files.
# Using qmail-local to deliver messages to ~/Mailbox by default.
exec env - PATH="/var/qmail/bin:$PATH" qmail-start ./Maildir/ splogger qmail &
=====================================rc=====================================
编辑smtp服务的启动脚本
# vi /var/qmail/smtp
====================================smtp====================================
#!/bin/sh
QMAILDUID=qmaild