wd and cc

— Happy every day

caphit qmail 配置

Posted at — Jan 16, 2006
参考网址
http://lifewithqmail.org(中文版http://lifewithqmail.org/LWQ-CN.html)
http://qmail.te8.com/rpms/glibc-2.3.1/(patch下载地址)
http://www.fehcom.de/qmail/qmail.html
http://www.pipeline.com.au/staff/mbowe/isp/vpopmail-mysql.htm
http://bbs.chinaunix.net/forum/viewtopic.php?t=254662
ucspi-tcp
http://cr.yp.to/ucspi-tcp.html
ucspi-tcp-0.88.a_record.patch,ucspi-tcp-0.88.errno.patch,ucspi-tcp-0.88.nodefaultrbl.patch
(或者)ucspi-tcp-0.88.a_record.patch,ucspi-tcp-0.88.errno.patch,ucspi-tcp-0.88.nobase.patch
patch -d ucspi-tcp.xxx -p1 < ucspi-tcp-xxx.patch
make&&make setup check
daemontools
http://cr.yp.to/daemontools.html
daemontools-0.76.errno.patch
package/install
Adding svscanboot to inittab...init should start svscan now.
cmd5checkpw
http://www.fehcom.de/qmail/auth/cmd5checkpw-030_tgz.bin
make&&make setup
qmail 1.03
http://cr.yp.to/qmail.html
http://www.fehcom.de/qmail/qmail.html
http://www.fehcom.de/qmail/spamcontrol/spamcontrol-2311_tgz.bin
tar zxvf spamcontrol-2311_tgz.bin
编辑conf-spamcontrol
建立用户组
groupadd nofiles
useradd -g nofiles -d /var/qmail qmaild -s /sbin/nologin
useradd -g nofiles -d /var/qmail qmaill -s /sbin/nologin
useradd -g nofiles -d /var/qmail qmailp -s /sbin/nologin
useradd -g nofiles -d /var/qmail/alias alias -s /sbin/nologin
groupadd qmail
useradd -g qmail -d /var/qmail qmailq -s /sbin/nologin
useradd -g qmail -d /var/qmail qmailr -s /sbin/nologin
useradd -g qmail -d /var/qmail qmails -s /sbin/nologin
./install_spamcontrol.sh
make setup check
./config-fast xxxx.com
vpopmail
http://sourceforge.net/projects/vpopmail/
groupadd vchkpw;useradd vpopmail
CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.* TO [email protected] IDENTIFIED BY 'vpoppasswd';
配置(用igenus需要enable-many-domains)
./configure --enable-logging=p
--enable-domain-quotas=y
--enable-auth-module=mysql
--enable-tcprules-prog=/usr/local/bin/tcprules
--enable-tcpserver-file=/etc/tcp.smtp
--disable-mysql-limits
--enable-mysql-logging
--enable-many-domains
make&&make install-strip
vi vpopmail.mysql
vi vlimits.default
echo "xxxx.com" > /home/vpopmail/etc/defaultdomain
vi /home/vpopmail/domains/.quotawarn.msg
From: CAPH Postmaster
Reply-To: [email protected]
To: SomeCompany User:;
Subject: Mail quota warning
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

Your mailbox on the server is now more than 90% full.
So that you can continue to receive mail,
you need to remove some messages from your mailbox.
If you require assistance with this,
please contact our support department :
email : [email protected]
Tel : 010 68372647
echo "Message rejected. Not enough storage space in user's mailbox to accept message." > /home/vpopmail/domains/.over-quota.msg
/var/qmail/rc
vi /var/qmail/rc
#!/bin/sh
# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default
exec env - PATH="/var/qmail/bin:$PATH"
qmail-start "`cat /var/qmail/control/defaultdelivery`"
echo ./Maildir/ >/var/qmail/control/defaultdelivery
chmod 755 /var/qmail/rc
mkdir /var/log/qmail
/var/qmail/bin/qmailctl
vi /var/qmail/bin/qmailctl
#!/bin/sh
# description: the qmail MTA
PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
LOG_AUTH=1
export LOG_AUTH
QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
case "$1" in
start)
echo "Starting qmail"
if svok /service/qmail-send ; then
svc -u /service/qmail-send /service/qmail-send/log
else
echo "qmail-send supervise not running"
fi
if svok /service/qmail-smtpd ; then
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
else
echo "qmail-smtpd supervise not running"
fi
if svok /service/qmail-pop3d ; then
svc -u /service/qmail-pop3d /service/qmail-pop3d/log
else
echo qmail-pop3d supervise not running
fi
if [ -d /var/lock/subsys ]; then
touch /var/lock/subsys/qmail
fi
;;
stop)
echo "Stopping qmail..."
echo " qmail-smtpd"
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo " qmail-smtpd"
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo " qmail-send"
svc -d /service/qmail-send /service/qmail-send/log
echo " qmail-pop3d"
svc -d /service/qmail-pop3d /service/qmail-pop3d/log
if [ -f /var/lock/subsys/qmail ]; then
rm /var/lock/subsys/qmail
fi
;;
stat)
svstat /service/qmail-send
svstat /service/qmail-send/log
svstat /service/qmail-smtpd
svstat /service/qmail-smtpd/log
svstat /service/qmail-pop3d
svstat /service/qmail-pop3d/log
qmail-qstat
;;
doqueue|alrm|flush)
echo "Flushing timeout table and sending ALRM signal to qmail-send."
/var/qmail/bin/qmail-tcpok
svc -a /service/qmail-send
;;
queue)
qmail-qstat
qmail-qread
;;
reload|hup)
echo "Sending HUP signal to qmail-send."
svc -h /service/qmail-send
;;
pause)
echo "Pausing qmail-send"
svc -p /service/qmail-send
echo "Pausing qmail-smtpd"
svc -p /service/qmail-smtpd
echo "Pausing qmail-pop3d"
svc -p /service/qmail-smtpd
echo "Pausing qmail-pop3d"
svc -p /service/qmail-pop3d
;;
cont)
echo "Continuing qmail-send"
svc -c /service/qmail-send
echo "Continuing qmail-smtpd"
svc -c /service/qmail-smtpd
echo "Continuing qmail-pop3d"
svc -c /service/qmail-pop3d
;;
restart)
echo "Restarting qmail:"
echo "* Stopping qmail-smtpd."
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo "* Sending qmail-send SIGTERM and restarting."
svc -t /service/qmail-send /service/qmail-send/log
echo "* Restarting qmail-smtpd."
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
echo "* Restarting qmail-pop3d."
svc -t /service/qmail-pop3d /service/qmail-pop3d/log
;;
cdb)
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
tcprules /etc/tcp.pop3.cdb /etc/tcp.pop3.tmp < /etc/tcp.pop3
chmod 644 /etc/tcp.smtp.cdb
chmod 644 /etc/tcp.pop3.cdb
echo "Reloaded /etc/tcp.smtp."
echo "Reloaded /etc/tcp.pop3."
;;
help)
cat < stop -- stops mail service (smtp connections refused, nothing goes out)
start -- starts mail service (smtp connection accepted, mail can go out)
pause -- temporarily stops mail service (connections accepted, nothing leaves)
cont -- continues paused mail service
stat -- displays status of mail service
cont -- continues paused mail service
stat -- displays status of mail service
cdb -- rebuild the tcpserver cdb file for smtp
restart -- stops and restarts smtp, sends qmail-send a TERM & restarts it
doqueue -- schedules queued messages for immediate delivery
reload -- sends qmail-send HUP, rereading locals and virtualdomains
queue -- shows status of queue
alrm -- same as doqueue
flush -- same as doqueue
hup -- same as reload
HELP
;;
*)
echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"
exit 1
;;
esac
exit 0
chmod 755 /var/qmail/bin/qmailctl
ln -s /var/qmail/bin/qmailctl /usr/bin
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
supervise 脚本
mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
mkdir -p /var/qmail/supervise/qmail-pop3d/log
qmail-send
/var/qmail/supervise/qmail-send/run
#!/bin/sh
exec /var/qmail/rc
/var/qmail/supervise/qmail-send/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
qmail-smtpd
/var/qmail/supervise/qmail-smtpd/run
#!/bin/sh
#QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`
QMAILDUID=`id -u vpopmail`
QMAILDGID=`id -g vpopmail`
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
LOCAL=`head -1 /var/qmail/control/me`
if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then
echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in
echo /var/qmail/supervise/qmail-smtpd/run
exit 1
fi
if [ ! -f /var/qmail/control/rcpthosts ]; then
echo "No /var/qmail/control/rcpthosts!"
echo "Refusing to start SMTP listener because it'll create an open relay"
exit 1
fi
exec /usr/local/bin/softlimit -m 30000000
/usr/local/bin/tcpserver -v -H -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD"
-u "$QMAILDUID" -g "$QMAILDGID" 0 smtp /usr/local/bin/rblsmtpd -r relays.ordb.org
/var/qmail/bin/qmail-smtpd
/home/vpopmail/bin/vchkpw /bin/true /bin/cmd5checkpw /bin/true 2>&1
/var/qmail/supervise/qmail-smtpd/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t
/var/log/qmail/smtpd
qmail-pop3d
/var/qmail/supervise/qmail-pop3d/run
#!/bin/sh
LOCAL=`head -1 /var/qmail/control/me`
exec /usr/local/bin/softlimit -m 30000000
/usr/local/bin/tcpserver -x /etc/tcp.pop3.cdb
-H -l $LOCAL
-v -c 20 -R 0 pop3
/var/qmail/bin/qmail-popup $LOCAL
/home/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir 2>&1
/var/qmail/supervise/qmail-pop3d/log/run
#!/bin/sh
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t
/var/log/qmail/pop3d
chmod 755 /var/qmail/supervise/qmail-send/run;chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run;chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
chmod 755 /var/qmail/supervise/qmail-pop3d/run;chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
mkdir -p /var/log/qmail/smtpd;chown qmaill /var/log/qmail /var/log/qmail/smtpd
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /var/qmail/supervise/qmail-pop3d /service
touch .qmail-root .qmail-postmaster
ln -s .qmail-postmaster /var/qmail/alias/.qmail-mailer-daemon
chmod 644 /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster
clamav
http://www.clamav.net/
groupadd clamav
useradd -g clamav -s /sbin/nologin clamav -d /tmp
./configure
make check
make install
maildrop
./configure
make;make install-strip;make install-man
spamassassin
perl Makefile.PL
make
make install
cp spamd/redhat-rc-script.sh /etc/init.d/spamd
qmail-scanner
groupadd qscand;useradd -g qscand -s /sbin/nologin qscand -d /tmp
./configure --spooldir /var/qmailscan --qmaildir /var/qmail --bindir /var/qmail/bin --qmail-queue-binary
/var/qmail/bin/qmail-queue --admin postmaster --domain xxx.com --notify sender,admin --local-domains "xxx.com,xxx.com.cn,xxx.com.cn" --silent-viruses auto --debug yes --unzip 1
--block-password-protected 0 --add-dscr-hdrs 0 --archive 0 --redundant yes --log-details syslog --log-crypto 0
--fix-mime 2 --ignore-eol-check 0 --scanners "clamscan,fast_spamassassin"
cp qmail-scanner-queue.pl /var/qmail/bin
chown qscand:qscand /var/qmail/bin/qmail-scanner-queue.pl
chmod 4755 /var/qmail/bin/qmail-scanner-queue.pl
vi /etc/tcp.smtp
127.:allow,RELAYCLIENT="",MFDNSCHECK="",BADMIMETYPE="",RBLSMTPD="",QMAILQUEUE="/var/
qmail/bin/qmail-scanner-queue.pl"
qmailctl cdb
qmailctl restart
contrib/test_installation.sh -doit测试
comments powered by Disqus