INSTALL QMAIL di Linux

Cara gampang: pake RPM ! cari paket yang sesuai dengan linux yang digunakan
RPM yang sudah pernah saya coba adalah RPM untuk linux dengan inetd

Baiknya melakukan patch pada source sesuai kebutuhan,
Source qmail dan beberapa pacth dapat diambil di: http://em.ca/~bruceg/qmail+patches/

---
echo "Download semua packages yang dibutuhkan ..."
#  
# pacth untuk oversize DNS packet pada  qmail: big-todo.103.patch
# patch agar qmail dapat maksimum melakukan proses pengiriman paralel sampai 200 proses: big-concurrency.patch
# daemon tools untuk koneksi client-server (seperti inetd): ucspi-tcp, 
# tools untuk menanagemen prose daemon: daemontools, 
# tools anti email spam: rblsmtpd
# binary database untuk mempercepat pembacaan file konfgirasi (control): cdb

  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/qmail-1.03.tar.gz 
  nohup wget -t0 http://www.ckdhr.com/ckd/qmail-103.patch
  nohup wget -t0 http://www.qmail.org/big-todo.103.patch 
  nohup wget -t0 http://www.qmail.org/big-concurrency.patch
  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/ucspi-tcp-0.88.tar.gz 
  nohup wget -t0 ftp://koobera.math.uic.edu/www/daemontools/daemontools-0.61.tar.gz
  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/rblsmtpd-0.70.tar.gz
  nohup wget -t0 ftp://koobera.math.uic.edu/www/cdb/cdb-0.75.tar.gz 

# Download juga beberapa tools yang penting seperti :
# 
# tools untuk support alias (/etc/alias) sendmail: fastforward
# tools untuk suport email forward menggunakan  file .forward: dotforward
# tools untuk mengalisis record dari aktifitas qmail: qmailanalog 
# tools untuk authentivikasi user untuk POP3: checkpassword

  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/fastforward-0.51.tar.gz
  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/dot-forward-0.71.tar.gz
  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/qmailanalog-0.70.tar.gz 
  nohup wget -t0 ftp://koobera.math.uic.edu/www/software/checkpassword-0.81.tar.gz


 
echo "Download qmail start up file"

  nohup wget -t0 http://Web.InfoAve.net/~dsill/qmail-script-dt61.txt

# ---
if [ $# != 1 ];
then echo not enough argument;
     exit 0;
fi

$1=HOSTNAME

echo "Ekstrak semua packages..."
sleep 5

  tar zxvf qmail-1.03.tar.gz
  tar zxvf ucspi-tcp-0.85.tar.gz
  tar zxvf daemontools-0.61.tar.gz
  tar zxvf rblsmtpd-0.70.tar.gz
  tar zxvf cdb-0.75.tar.gz
  tar zxvf vpopmail-3.4.11.tar.gz

echo "Buat direktori defaut dimana qmail diinstall (/var/qmail)"

  mkdir -p /var/qmail

echo "Buat UID dan GID buat qmail.."
sleep 5
  
  groupadd nofiles
  useradd -g nofiles -d /var/qmail/alias alias
  useradd -g nofiles -d /var/qmail qmaild
  useradd -g nofiles -d /var/qmail qmaill
  useradd -g nofiles -d /var/qmail qmailp
  groupadd qmail
  useradd -g qmail -d /var/qmail qmailq
  useradd -g qmail -d /var/qmail qmailr
  useradd -g qmail -d /var/qmail qmails


echo "Mulai install qmail ..."
sleep 5

  cp qmail-103.patch qmail-1.03/
  cd qmail-1.03/
  patch < qmail-103.patch
  make setup check
  ./config-fast $HOSTNAME

echo "Mulai install Ucspi-tcp ... "
sleep 5
  
  cd ../ucspi-tcp-0.85/
  make; make setup check

echo "Mulai install daemontools ..."
sleep 5

  cd ../daemontools-0.61/
  make; make man; make setup check

echo "Mulai install rblsmtpd ..."
sleep 5

  cd ../rblsmtpd-0,70/
  make setup check

echo "Mulai install cdb ..."
sleep 5

  cd ../cdb-0.75/
  make; make setup check

echo "Setup untuk qmail ..."
echo "Set default spool mail buat user adalah Maildir/"
sleep 5

  cd ../
  echo ./Maildir/ > var/qmail/control/defaultdelivery
  cat > /var/qmail/rc << __EOF
  #!/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`" splogger qmail
__EOF

echo "Setup untuk start up file ..."
sleep 5

  cp qmail-script-dt61.txt /etc/rc.d/init.d/qmail
  chmod 755 /etc/rc.d/init.d/qmail
  ln -s /etc/init.d/qmail /usr/local/sbin
  ln -s ../init.d/qmail /etc/rc.d/rc0.d/K30qmail
  ln -s ../init.d/qmail /etc/rc.d/rc1.d/K30qmail
  ln -s ../init.d/qmail /etc/rc.d/rc2.d/S80qmail
  ln -s ../init.d/qmail /etc/rc.d/rc4.d/S80qmail
  ln -s ../init.d/qmail /etc/rc.d/rc5.d/S80qmail
  ln -s ../init.d/qmail /etc/rc.d/rc6.d/K30qmail

echo "Setup daemontools untuk qmail services ... "
echo "Directori service qmail berada di /var/qmail/supervise"
sleep 5

  mkdir -p /var/qmail/supervise/qmail-send/log
  mkdir -p /var/qmail/supervise/qmail-smtpd/log
  chmod +t /var/qmail/supervise/qmail-send
  chmod +t /var/qmail/supervise/qmail-smtpd
  
  cat > /var/qmail/supervise/qmail-send/run << __EOF
  #!/bin/sh
  exec /var/qmail/rc
  __EOF
  
  cat > /var/qmail/supervise/qmail-send/log/run << __EOF
  #!/bin/sh
  exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail
  __EOF

  cat > /var/qmail/supervise/qmail-smtpd/run >> __EOF
  #!/bin/sh
  QMAILDUID=`id -u qmaild`
  NOFILESGID=`id -g qmaild`
  exec /usr/local/bin/softlimit -m 2000000 \
    /usr/local/bin/tcpserver -v -p -x /etc/tcp.smtp.cdb \
    -u $QMAILDUID -g $NOFILESGID 0 smtp /var/qmail/bin/qmail-smtpd 2>&1
  __EOF

  cat > /var/qmail/supervise/qmail-smtpd/log/run >> __EOF
  #!/bin/sh
  exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t /var/log/qmail/smtpd
  __EOF

  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

echo "Setup buat log file"
sleep 5

  mkdir -p /var/log/qmail
  mkdir -p /var/log/qmail/smtpd
  chown qmaill /var/log/qmail /var/log/qmail/smtpd

echo "Setup buat anti relaying"
echo "relay dapat dilakukan untuk network 127. 192.168. dan tentu saja localhost"
echo "file konfigurasi relay adalah /etc/tcp.smtp.cdb"
sleep 5

  echo '127.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp
  echo '192.168.:allow,RELAYCLIENT=""' >>/etc/tcp.smtp
  echo ':allow" >>/etc/tcp.smtp
  tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp  		#/usr/local/sbin/qmail cdb
  chmod qmail /etc/tcp.smtp.cdb

echo "Stop sendmail ..."
sleep 5

  killall -9 sendmail    
  mv /usr/lib/sendmail /usr/lib/sendmail.old                  # ignore errors
  mv /usr/sbin/sendmail /usr/sbin/sendmail.old                # ignore errors
  chmod 0 /usr/lib/sendmail.old /usr/sbin/sendmail.old        # ignore errors
  ln -s /var/qmail/bin/sendmail /usr/lib
  ln -s /var/qmail/bin/sendmail /usr/sbin

echo "Bikin system alias ... "		    
echo "Silahkan edit file2 untuk user alias (.qmail) yang berada di /var/qmail/alias"
sleep 5

  (cd ~alias; touch .qmail-default .qmail-postmaster .qmail-mailer-daemon .qmail-root)
  chmod 644 ~alias/.qmail*

# ---
# end of script


Catatan:
Jika tidak ingin menggunakan script qmail-script-dt61.txt dan tidak ingin menggunakan supervise
untuk startup qmail, gunakan sperti script contoh berikut:

 # start smtp server menggunakan tcpserver dengan  -u = qmaild uid ... -g =nofiles gid
 /usr/local/bin/tcpserver -v -u 503 -g 504 0 smtp /var/qmail/bin/qmail-smtpd 2>&1 | /var/qmail/bin/splogger smtpd 3 &

 #start pop server menggunakan tcpserver $FQDN = hostname
 /usr/local/bin/tcpserver 0 110 /var/qmail/bin/qmail-popup $FQDN \
   /usr/local/bin/checkvpw /var/qmail/bin/qmail-pop3d Maildir/ &
 
 #start qmail
 /var/qmail/rc &

Jika ingin lebih mudah, gunakan inetd atau xinetd untuk mengganti tcpserver dalam membuka/
menjalankan daemon smtp qmail (qmail-smtpd). Tambahkan baris berikut di /etc/inetd.conf
jika menggunakan inetd:

  smtp    stream  tcp     nowait  qmaild  /usr/sbin/tcpd /var/qmail/bin/tcp-env /var/qmail/bin/qmail-smtpd
 
untuk xinetd, buatlah file di /etc/xinetd.d/ (untuk disteribusi Linux RedHat) bernama qmail 
yang isinya seperti ini:

  service smtp
  {
        flags           = REUSE NAMEINARGS
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = qmaild
        server          = /usr/sbin/tcpd
        server_args     = /var/qmail/bin/tcp-env -R /var/qmail/bin/qmail-smtpd
  }


---
eryan12@yahoo.com
http://eryan.dhs.org

    Source: geocities.com/hackermuda/exploits

               ( geocities.com/hackermuda)