jump to navigation

Install and Configure qmail on OpenSUSE11 July 3, 2009

Posted by skleton in OpenSUSE.
trackback

Qmail,(http://pobox.com/~djb/qmail.html) adalah sebuah MTA (Mail Transfer Agent) yang dibuat oleh Dan Breinstein (DJB), seorang profesor matematika pada Universitas Illinois Chicago.
Qmail didesain untuk memperbaiki lubang keamanan (security hole) pada MTA legendaris Unix, Sendmail. Para pendukung qmail menyediakan hadiah sebesar US $1000 bagi yang berhasil mendobrak sistem keamanan qmail. Oleh karena tidak ada seorangpun yang berhasil memenangkan hadiah tersebut, maka US $1000 itu diberikan kepada Free Software Foundation. Pencipta qmail, Dan Breinstein juga menyediakan hadiah sebesar US $500 bagi yang berhasil menemukan lubang keamanan pada qmail.

Ok, langsung aja kita mulai instalasi nya….

Download package yang dibutuhkan
==========================
rudhy:~ # cd /usr/src/
rudhy:/usr/src #wget http://cr.yp.to/software/qmail-1.03.tar.gz
rudhy:/usr/src #wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
rudhy:/usr/src #wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
rudhy:/usr/src #wget http://cr.yp.to/checkpwd/checkpassword-0.90.tar.gz
rudhy:/usr/src #wget http://qmail.cbn.net.id/moni.csi.hu/pub/glibc-2.3.1/qmail-1.03.errno.patch
rudhy:/usr/src #wget http://qmail.cbn.net.id/moni.csi.hu/pub/glibc-2.3.1/ucspi-tcp-0.88.errno.patch
rudhy:/usr/src #wget http://qmail.cbn.net.id/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch

Extract package, patching and install package daemontools
============================================
rudhy:/usr/src #tar -zxvf daemontools-0.76.tar.gz
rudhy:/usr/src # cd admin/daemontools-0.76/
rudhy:/usr/src/admin/daemontools-0.76 #patch -p1 < /usr/src/daemontools-0.76.errno.patch
rudhy:/usr/src/admin/daemontools-0.76 #cd src/
rudhy:/usr/src/admin/daemontools-0.76/src #nano error.h
ubah extern int errno; menjadi #include (errno.h)
rudhy:/usr/src/admin/daemontools-0.76/src #cd ..
rudhy:/usr/src/admin/daemontools-0.76 #package/install

Extract package, patching and install package ucspi-tcp
==========================================
rudhy:/usr/src #tar -xzvf ucspi-tcp-0.88.tar.gz
rudhy:/usr/src # cd ucspi-tcp-0.88/
rudhy:/usr/src/ucspi-tcp-0.88 #patch -p1 < /usr/local/ucspi-tcp-0.88.errno.patch
rudhy:/usr/src/ucspi-tcp-0.88 #nano error.h
ubah extern int errno; menjadi #include
rudhy:/usr/src/ucspi-tcp-0.88 #make
rudhy:/usr/src/ucspi-tcp-0.88 #make setup check

rudhy:/usr/src #tar -zxvf checkpassword-0.90.tar.gz
rudhy:/usr/src # cd checkpassword-0.90/
rudhy:/usr/src/checkpassword-0.90 #make setup check

rudhy:~ #mkdir /var/qmail
rudhy:~ #groupadd nofiles
rudhy:~ #useradd -g nofiles -d /var/qmail/alias alias
rudhy:~ #useradd -g nofiles -d /var/qmail qmaild
rudhy:~ #useradd -g nofiles -d /var/qmail qmaill
rudhy:~ #useradd -g nofiles -d /var/qmail qmailp
rudhy:~ #groupadd qmail
rudhy:~ #useradd -g qmail -d /var/qmail qmailq
rudhy:~ #useradd -g qmail -d /var/qmail qmailr
rudhy:~ #useradd -g qmail -d /var/qmail qmails
Instalasi qmail:
rudhy:~ # cd /usr/src/
rudhy:/usr/src #tar -xzvf qmail-1.03.tar.gz
rudhy:/usr/src # cd qmail-1.03/
rudhy:/usr/src/qmail-1.03 #patch -p1 < /usr/src/qmail-1.03.errno.patch
rudhy:/usr/src/qmail-1.03 #make setup check
rudhy:/usr/src/qmail-1.03 #./config-fast mail.domainku.com

Buat log file
=========
rudhy:~ #mkdir -p /var/log/qmail
rudhy:~ #mkdir -p /var/log/qmail-smtpd
rudhy:~ #mkdir -p /var/log/qmail-pop3d
rudhy:~ #chown qmaill:nofiles /var/log/qmail*

Buat skrip service qmail
=================
rudhy:~ #nano /var/qmail/bin/qmailctl
#!/bin/sh
# For Red Hat chkconfig
# chkconfig: - 80 30
# description: the qmail MTA
PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin
export PATH
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 [ -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-send"
svc -d /service/qmail-send /service/qmail-send/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
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
;;
cont)
echo "Continuing qmail-send"
svc -c /service/qmail-send
echo "Continuing qmail-smtpd"
svc -c /service/qmail-smtpd
;;
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
;;
cdb)
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
chmod 644 /etc/tcp.smtp.cdb
echo "Reloaded /etc/tcp.smtp."
;;
help)
cat <<HELP
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
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

Ubah permission nya menjadi:
rudhy:~ #chmod 755 /var/qmail/bin/qmailctl
Buat skrip supervise
===============
rudhy:~ #mkdir -p /var/qmail/supervise
rudhy:~ #mkdir -p /var/qmail/supervise/qmail-send
rudhy:~ #mkdir -p /var/qmail/supervise/qmail-smtpd
rudhy:~ #mkdir -p /var/qmail/supervise/qmail-pop3d
rudhy:~ #nano /var/qmail/supervise/qmail-send/run
#!/bin/sh
exec /var/qmail/rc

rudhy:~ #nano /var/qmail/rc
#!/bin/sh
exec env PATH="/var/qmail/bin:$PATH" \
qmail-start "`cat /var/qmail/control/defaultdelivery`"

Tambah kan /Maildir/ pada file defaultdelivery:
rudhy:~ #nano /var/qmail/control/defaultdelivery
./Maildir/

rudhy:~ #mkdir /var/qmail/supervise/qmail-send/log
rudhy:~ #/var/qmail/supervise/qmail-send/log/run
#!/bin/bash
exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail

Ubah permission nya:
rudhy:~ #chmod 755 /var/qmail/supervise/qmail-send/run
rudhy:~ #chmod 755 /var/qmail/rc
rudhy:~ #chmod 755 /var/qmail/supervise/qmail-send/log/run

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s