Slackware 12.2 - Qmail / vpopmail / mysql / dovecot / roundcube =============================================================== Public domain ******************************************************************************** ### Installing Daemontools [daemontools original download link](http://cr.yp.to/daemontools/daemontools-0.76.tar.gz) [daemontools patch original download link](http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch) mkdir -p /usr/local/daemontools/{package,command,service} ln -sfn /usr/local/daemontools/command /command ln -sfn /usr/local/daemontools/service /service cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/daemontools-0.76.tar.gz" wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Patches/daemontools-0.76.errno.patch" tar -C /usr/local/daemontools/package -zxpf daemontools-0.76.tar.gz cd /usr/local/daemontools/package/admin/daemontools-0.76 patch -p1 < /usr/src/daemontools-0.76.errno.patch package/install if ! grep -q svscanboot /etc/inittab then echo "SV:123456:respawn:/command/svscanboot" >> /etc/inittab fi init q ps auxw | grep svs ******************************************************************************** ### Install ucspi-tcp [ucspi-tcp original download link](http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz) [ucspi-tcp patch original download link](http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/ucspi-tcp-0.88.errno.patch) [rblsmtpd patch original download link](http://pyropus.ca/software/misc/rblsmtpd-nodefaultrbl.patch) cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/ucspi-tcp-0.88.tar.gz" wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Patches/ucspi-tcp-0.88.errno.patch" wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Patches/rblsmtpd-nodefaultrbl.patch" tar zxf ucspi-tcp-0.88.tar.gz cd ucspi-tcp-0.88 patch -p1 < ../ucspi-tcp-0.88.errno.patch patch -p1 < ../rblsmtpd-nodefaultrbl.patch make make setup check ******************************************************************************** ### Install QMail [netqmail original download link](http://www.qmail.org/netqmail-1.06.tar.gz) mkdir -p /usr/local/qmail ln -sfn /usr/local/qmail /var/qmail 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 cd /usr/src/ wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/netqmail-1.06.tar.gz" tar zxf netqmail-1.06.tar.gz cd netqmail-1.06 make setup check ******************************************************************************** ### libev installation [libev original download link](http://dist.schmorp.de/libev/libev-3.9.tar.gz) cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/libev-3.9.tar.gz" tar zxf libev-3.9.tar.gz cd libev-3.9 ./configure && make && make install ldconfig ******************************************************************************** ### MySQL Initialize mysql_install_db --user=mysql chmod +x /etc/rc.d/rc.mysqld /etc/rc.d/rc.mysqld start sleep 5 mysql -e "drop database test" mysql -e "delete from mysql.user where user=''" HOSTS=$(mysql -e "select host, user from mysql.user" | awk '{ if (/root/) print $1}') QUERY="" for HOST in $HOSTS; do QUERY="set password for 'root'@'${HOST}' = password ('passdb');${QUERY}" done mysql -e "${QUERY}" ******************************************************************************** ### vpopmail database mysql -ppassdb -e "CREATE DATABASE vpopmail" mysql -ppassdb -e "GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopmail@localhost IDENTIFIED BY 'passvpop'" ******************************************************************************** ### vpopmail installation [vpopmail original download link](http://downloads.sourceforge.net/project/vpopmail/vpopmail-devel/5.5.0/vpopmail-5.5.0.tar.bz2) groupadd -g 89 vchkpw useradd -m -g vchkpw -u 89 -d /var/qmail/vpopmail vpopmail mkdir -p /var/qmail/vpopmail/etc/ cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/vpopmail-5.5.0.tar.bz2" tar jxf vpopmail-5.5.0.tar.bz2 chown -R root.root vpopmail-5.5.0 cd vpopmail-5.5.0 echo "localhost|0|vpopmail|passvpop|vpopmail" > /var/qmail/vpopmail/etc/vpopmail.mysql chown vpopmail.vchkpw /var/qmail/vpopmail/etc/vpopmail.mysql chmod 640 /var/qmail/vpopmail/etc/vpopmail.mysql touch /var/qmail/control/tcp.smtp ./configure \ --enable-logging=p \ --enable-passwd=n \ --enable-roaming-users \ --enable-clear-passwd \ --enable-tcpserver-file=/var/qmail/control/tcp.smtp make cd backends/mysql/ ./configure \ --enable-valias \ --disable-auth-logging make mkdir -p /var/qmail/vpopmail/lib/ make install cd ../.. make install-strip chown -R vpopmail.vchkpw /var/qmail/vpopmail cp vusaged/contrib/rc.vusaged /etc/rc.d/ chmod +x /etc/rc.d/rc.vusaged echo "if [ -x /etc/rc.d/rc.vusaged ];then /etc/rc.d/rc.vusaged start ;fi" >> /etc/rc.d/rc.local if ! grep -q vpopmail /etc/ld.so.conf ; then echo "/usr/local/qmail/vpopmail/lib/" >> /etc/ld.so.conf ;fi ldconfig ******************************************************************************** ### /var/qmail/bin/qmailctl #!/bin/sh PATH="/var/qmail/bin:$PATH" export PATH QMAILDUID=$(id -u qmaild) NOFILESGID=$(id -g qmaild) case "$1" in start) echo "Starting qmail MTA ..." 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 ;; stop) echo "Stopping qmail MTA ..." echo " qmail-smtpd" svc -d /service/qmail-smtpd /service/qmail-smtpd/log echo " qmail-send" svc -d /service/qmail-send /service/qmail-send/log ;; 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 /var/qmail/control/tcp.smtp.cdb /var/qmail/control/tcp.smtp.tmp < /var/qmail/control/tcp.smtp chmod 644 /var/qmail/control/tcp.smtp.cdb echo "Reloaded /var/qmail/control/tcp.smtp" ;; help) cat <&1 ******************************************************************************** ### /var/qmail/supervise/qmail-smtpd/log/run #!/bin/sh exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s10485760 n100 /var/qmail/log/smtpd ******************************************************************************** ### Crating Virtual Domains and postmaster password /var/qmail/vpopmail/bin/vadddomain professorhack.com 123456 /var/qmail/vpopmail/bin/vaddaliasdomain professorhack.com mail.professorhack ******************************************************************************** ### Adding Virtual Users /var/qmail/vpopmail/bin/vadduser pejman@professorhack.com test123 ******************************************************************************** ### Adding Virtual Aliases /var/qmail/vpopmail/bin/valias -i postmaster@professorhack.com root@professorhack.com /var/qmail/vpopmail/bin/valias -i postmaster@professorhack.com mailer-daemon@professorhack.com /var/qmail/vpopmail/bin/valias -i postmaster@professorhack.com abuse@professorhack.com /var/qmail/vpopmail/bin/valias -v professorhack.com ******************************************************************************** ### Qmail Options echo ./Maildir/ > /var/qmail/control/defaultdelivery echo 20 > /var/qmail/control/concurrencyincoming chmod 644 /var/qmail/control/concurrencyincoming echo mail.professorhack.com > /var/qmail/control/me echo professorhack.com > /var/qmail/control/helohost chmod 644 /var/qmail/control/me echo professorhack.com > /var/qmail/control/doublebouncehost echo doublebounce > /var/qmail/control/doublebounceto echo "#" > /var/qmail/vpopmail/domains/professorhack.com/.qmail-doublebounce ******************************************************************************** ### /var/qmail/vpopmail/domains/professorhack.com/.qmail-default | /var/qmail/vpopmail/bin/vdelivermail '' delete ******************************************************************************** ### Relaying Options echo '127.0.0.1:allow,RELAYCLIENT=""' >> /var/qmail/control/tcp.smtp qmailctl cdb ******************************************************************************** ### Startup scripts 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 mkdir -p /var/qmail/log/{smtpd,send} chown -R qmaill /var/qmail/log/ ******************************************************************************** ### Starting Services /etc/rc.d/rc.vusaged start ln -s /var/qmail/supervise/qmail-send /service ln -s /var/qmail/supervise/qmail-smtpd /service ******************************************************************************** ### Test Services sleep 5 ps -A | grep qmail netstat -a | egrep "smtp|pop3" qmailctl stat ps -efl | grep "service errors" | grep -v grep ******************************************************************************** ### dovecot [dovcot original download link](http://www.dovecot.org/releases/1.2/dovecot-1.2.11.tar.gz) cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/dovecot-1.2.11.tar.gz" tar zxf dovecot-1.2.11.tar.gz cd dovecot-1.2.11 ./configure \ --prefix=/usr/local/qmail/dovecot \ --with-checkpassword \ --with-prefetch-userdb \ --without-static-userdb \ --without-vpopmail \ --without-passwd \ --without-passwd-file \ --without-shadow \ --without-nss make && make install ******************************************************************************** ### Commands groupadd dovecot useradd -g dovecot dovecot mkdir -p /var/qmail/log/dovecot mkdir -p /usr/local/qmail/dovecot/var/run/dovecot cd /usr/local/qmail/dovecot/etc cp dovecot-example.conf dovecot.conf sed 's,#.*$,,' dovecot.conf | grep -v '^ *$' ******************************************************************************** ### /usr/local/qmail/dovecot/etc/dovecot.conf protocols = imap listen = 127.0.0.1 disable_plaintext_auth = no log_path = /var/qmail/log/dovecot/error.log info_log_path = /var/qmail/log/dovecot/info.log ssl = no mail_location = maildir:~/Maildir mail_uid = 89 mail_gid = 89 first_valid_uid = 89 last_valid_uid = 89 first_valid_gid = 89 last_valid_gid = 89 protocol imap { } protocol pop3 { } protocol lda { } auth default { mechanisms = plain #passdb pam { #} passdb checkpassword { args = /var/qmail/vpopmail/bin/vchkpw } userdb prefetch { } #userdb passwd { #} user = root count = 1 } dict { } plugin { } ******************************************************************************** ### Config check /usr/local/qmail/dovecot/sbin/dovecot -n ******************************************************************************** ### /etc/rc.d/rc.dovecot #!/bin/sh PROCESS="dovecot" PREFIX="/usr/local/qmail/dovecot" DAEMON="$PREFIX/sbin/dovecot" PIDFILE="$PREFIX/var/run/dovecot/master.pid" TIMEOUT="100" start() { echo -n "Starting $PROCESS . . ." PID=$(ps -A | egrep " ${PROCESS}$" | awk '{print$1}') if [ "$PID" != "" ]; then echo "$PROCESS is already running (PID=$PID)" else if [ -f $PIDFILE ] ; then rm $PIDFILE fi $DAEMON > /dev/null 2>&1 echo " Ok" fi } stop() { echo -n "Stoping $PROCESS . . ." PID=$(ps -A | egrep " ${PROCESS}$" | awk '{print$1}') if [ "$PID" != "" ] ; then kill -TERM $PID sleep 1 fi time=0 while [ $time != "$TIMEOUT" ] ; do PID=$(ps -A | egrep " ${PROCESS}$" | awk '{print$1}') if [ "$PID" == "" ] ; then break else time=`expr $time + 1` echo -n ".$time" sleep 1 fi done echo " Ok" } case "$1" in 'start') start ;; 'stop') stop ;; 'restart') stop sleep 1 start ;; *) echo "usage $0 start|stop|restart" ;; esac ******************************************************************************** ### /usr/local/sbin/recovery.sh #!/bin/bash # Dovecot Recovery PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin" if ! ps ax | grep -v grep | egrep -q '/dovecot$'; then /etc/rc.d/rc.dovecot restart fi ******************************************************************************** ### Commands echo "if [ -x /etc/rc.d/rc.dovecot ]; then /etc/rc.d/rc.dovecot start ;fi" >> /etc/rc.d/rc.local echo "if [ -x /etc/rc.d/rc.dovecot ]; then /etc/rc.d/rc.dovecot stop ;fi" >> /etc/rc.d/rc.local_shutdown chmod +x /etc/rc.d/rc.local_shutdown chmod +x /etc/rc.d/rc.dovecot chmod +x /usr/local/sbin/recovery.sh /etc/rc.d/rc.dovecot start ******************************************************************************** ### crontab -e * * * * * /usr/local/sbin/recovery.sh &> /dev/null ******************************************************************************** ### Apache Web server sed -i -e 's,AllowOverride None,AllowOverride All,' /etc/httpd/httpd.conf sed -i -e 's,#Include /etc/httpd/mod_php.conf,Include /etc/httpd/mod_php.conf,' /etc/httpd/httpd.conf sed -i -e 's,DirectoryIndex index.html,DirectoryIndex index.php index.html,' /etc/httpd/httpd.conf chmod +x /etc/rc.d/rc.httpd /etc/rc.d/rc.httpd stop /etc/rc.d/rc.httpd start ******************************************************************************** ### Roundcube [roundcube original download link](http://downloads.sourceforge.net/project/roundcubemail/roundcubemail/0.3.1/roundcubemail-0.3.1.tar.gz) cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/roundcubemail-0.3.1.tar.gz" tar zxf roundcubemail-0.3.1.tar.gz mkdir -p /var/qmail/roundcube cp -r roundcubemail-0.3.1/* /var/qmail/roundcube/ chown -R apache.apache /var/qmail/roundcube/temp chown -R apache.apache /var/qmail/roundcube/logs mysql -ppassdb -e "CREATE DATABASE roundcubemail" mysql -ppassdb -e "GRANT ALL PRIVILEGES ON roundcubemail.* TO roundcube@localhost IDENTIFIED BY 'passround'" mysql -ppassdb -e "FLUSH PRIVILEGES" mysql -ppassdb roundcubemail < /var/qmail/roundcube/SQL/mysql.initial.sql ******************************************************************************** ### /var/qmail/roundcube/config/main.inc.php ******************************************************************************** ### /var/qmail/roundcube/config/db.inc.php ******************************************************************************** ### Commands rm -rf /var/www/htdocs/roundcube/installer/ ln -sfn /var/qmail/roundcube /var/www/htdocs/ ******************************************************************************** ### Reverse DNS Check [http://zentus.com/rhost-check.html](http://zentus.com/rhost-check.html) [original download link](http://www.zentus.com/rhost-check.c) cd /usr/src wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/rhost-check.c" gcc -O -o rhost-check rhost-check.c mv rhost-check /var/qmail/bin ******************************************************************************** ### /usr/src/rhost-check.c /* * Public domain 2008 David Crawshaw * http://www.zentus.com/rhost-check.html * Usage: tcpserver -R -h -p 0 smtp rhost-check rblsmtpd qmail-smtpd */ #include #include #include int main(int argc, char* argv[]) { if (argc < 2) { fputs("usage: rhost-check program [arguments]\n", stderr); return 111; } if (getenv("TCPREMOTEHOST") == 0) { putenv("RBLSMTPD=-We do not accept mail from IP addresses without reverse DNS !!!"); } execvp(argv[1], argv+1); fputs("error: execution of rhost-check failed\n", stderr); return 111; } ******************************************************************************** ### /var/qmail/supervise/qmail-smtpd/run #!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` 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 2000000 \ /usr/local/bin/tcpserver -v -h -p -R \ -l "$LOCAL" -x /var/qmail/control/tcp.smtp.cdb \ -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \ /var/qmail/bin/rhost-check \ /usr/local/bin/rblsmtpd \ /var/qmail/bin/qmail-smtpd "$LOCAL" \ /var/qmail/vpopmail/bin/vchkpw /bin/true 2>&1 ******************************************************************************** ### Commands qmailctl restart qmailctl stat ******************************************************************************** ### jgreylist [jgreylist.c original download link](http://qmail.jms1.net/scripts/jgreylist.c) [jgreylist-clean original download link](http://qmail.jms1.net/scripts/jgreylist-clean) mkdir -p /var/qmail/jgreylist chmod 0700 /var/qmail/jgreylist chown qmaild:nofiles /var/qmail/jgreylist cd /usr/src/ wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/jgreylist.c" wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/jgreylist-clean" gcc -o jgreylist jgreylist.c /bin/mv jgreylist /var/qmail/bin/ /bin/mv jgreylist-clean /var/qmail/bin/ chown root:nofiles /var/qmail/bin/jgreylist chmod 0755 /var/qmail/bin/jgreylist chmod +x /var/qmail/bin/jgreylist-clean ln -sfn /var/qmail/bin/jgreylist-clean /etc/cron.daily/jgreylist-clean ******************************************************************************** ### Change /var/qmail/supervise/qmail-smtpd/run #!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild` MAXSMTPD=`cat /var/qmail/control/concurrencyincoming` LOCAL=`head -1 /var/qmail/control/me` export JGREYLIST_DIR=/var/qmail/jgreylist export JGREYLIST_NOREV="" export JGREYLIST_BY_IP="0" export JGREYLIST_HOLDTIME="120" export JGREYLIST_LOG="1" export JGREYLIST_LOG_PID="1" export JGREYLIST_LOG_SMTP="0" export JGREYLIST_TIMEOUT="60" export JGREYLIST_LIMIT="20" 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 10000000 \ /usr/local/bin/tcpserver -v -h -R -p \ -l "$LOCAL" -x /var/qmail/control/tcp.smtp.cdb \ -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \ /var/qmail/bin/jgreylist \ /var/qmail/bin/qmail-smtpd "$LOCAL" \ /var/qmail/vpopmail/bin/vchkpw /bin/true 2>&1 ******************************************************************************** ### /var/qmail/control/tcp.smtp 127.0.0.1:allow,RELAYCLIENT="",JGREYLIST="" ******************************************************************************** ### Commands qmailctl cdb qmailctl restart sleep 5 qmailctl stat ******************************************************************************** ### log files tail -n 100 -f /var/qmail/log/*/current | tai64nlocal ******************************************************************************** ### rbldns - Install djbdns [djbdns original download link](http://cr.yp.to/djbdns/djbdns-1.05.tar.gz) [djbdns patch original download link](http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/djbdns-1.05.errno.patch) cd /usr/local/daemontools/package wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Source-packages/djbdns-1.05.tar.gz" wget -c "http://pmoghadam.com/homepage/Pages/Deposit/Patches/djbdns-1.05.errno.patch" tar zxf djbdns-1.05.tar.gz cd djbdns-1.05 patch -p1 < ../djbdns-1.05.errno.patch make make setup check ******************************************************************************** ### rbldns - dnscache caching-recursive mkdir -p /usr/local/djbdns groupadd dns useradd dnscache -g dns -d /usr/local/djbdns -s /bin/false useradd dnscachelog -g dns -d /usr/local/djbdns -s /bin/false dnscache-conf dnscache dnscachelog /usr/local/djbdns/dnscache 172.16.20.2 wget ftp://ftp.internic.net/domain/named.root -q -O - | grep ' A ' | awk '{print$4}' > /etc/dnsroots.global cp /etc/dnsroots.global /usr/local/djbdns/dnscache/root/servers/@ ln -sfn /usr/local/djbdns/dnscache /service/dnscache sleep 5 echo 100000000 > /service/dnscache/env/CACHESIZE echo 104857600 > /service/dnscache/env/DATALIMIT svc -t /service/dnscache sleep 5 svstat /service/dnscache touch /usr/local/djbdns/dnscache/root/ip/172.16.20.2 ps -A | grep dnscache ps auxw | grep dnscache ******************************************************************************** ### rbldns - dnscache forward-only echo 8.8.8.8 > /usr/local/djbdns/dnscache/root/servers/@ echo 1 > /usr/local/djbdns/dnscache/env/FORWARDONLY svc -t /service/dnscache sleep 5 svstat /service/dnscache ******************************************************************************** ### *.rbldns.professorhack.com echo 127.0.0.1 > /usr/local/djbdns/dnscache/root/servers/rbldns.professorhack.com svc -h /service/dnscache ******************************************************************************** ### /etc/resolv.conf nameserver 172.16.20.2 ******************************************************************************** ### rbldns config # http://ladro.com/docs/dns/rblsmtpd.html # top level DNS for *.mail.professorhack.com : # &mail.professorhack.com::mail.professorhack.com:600 mkdir -p /usr/local/djbdns groupadd dns useradd rbldns -g dns -d /usr/local/djbdns -s /bin/false useradd rbldnslog -g dns -d /usr/local/djbdns -s /bin/false rbldns-conf rbldns rbldnslog /usr/local/djbdns/rbldns 127.0.0.1 rbldns.professorhack.com ln -sfn /usr/local/djbdns/rbldns /service/rbldns svc -t /service/dnscache sleep 5 svstat /service/rbldns /service/dnscache lsof -n -i:53 ps -A | grep rbldns ps auxw | grep rbldns tail -f /service/rbldns/log/main/current ******************************************************************************** ### /usr/local/djbdns/rbldns/root/data :127.0.0.2:rbldns.professorhack.com Real-time Blackhole List for $ ******************************************************************************** ### rbldns add ip cd /usr/local/djbdns/rbldns/root/ echo 192.168.5.100 >> data make dnsqr a 100.5.168.192.rbldns.professorhack.com dnsqr txt 100.5.168.192.rbldns.professorhack.com ******************************************************************************** ### /usr/local/qmail/supervise/qmail-smtpd/run ... ... exec /usr/local/bin/softlimit -m 10000000 \ /usr/local/bin/tcpserver -v -h -R -p \ -l "$LOCAL" -x /var/qmail/control/tcp.smtp.cdb \ -c "$MAXSMTPD" -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \ /usr/local/bin/rblsmtpd -b -r rbldns.professorhack.com \ /var/qmail/bin/jgreylist \ /var/qmail/bin/qmail-smtpd "$LOCAL" \ /var/qmail/vpopmail/bin/vchkpw /bin/true 2>&1 ******************************************************************************** ### Commands svc -t /service/{*,*/log} sleep 5 svstat /service/{*,*/log} ******************************************************************************** ### rbldns patch : /usr/local/daemontools/package/djbdns-1.05/rbldns.c.patch # rbldns patch by Pejman Moghadam - http://www.pmoghadam.com # change default TTL from 2048 to 120 # diff -u rbldns.c.orig rbldns.c > rbldns.c.patch --- rbldns.c.orig 2010-05-13 09:46:18.000000000 +0430 +++ rbldns.c 2010-05-13 09:46:56.000000000 +0430 @@ -65,12 +65,12 @@ } if (flaga) { - if (!response_rstart(q,DNS_T_A,2048)) return 0; + if (!response_rstart(q,DNS_T_A,120)) return 0; /* patch : changed from 2048 to 120 */ if (!response_addbytes(data,4)) return 0; response_rfinish(RESPONSE_ANSWER); } if (flagtxt) { - if (!response_rstart(q,DNS_T_TXT,2048)) return 0; + if (!response_rstart(q,DNS_T_TXT,120)) return 0; /* patch : changed from 2048 to 120 */ ch = dlen - 4; if (!response_addbytes(&ch,1)) return 0; if (!response_addbytes(data + 4,dlen - 4)) return 0; ******************************************************************************** ### rbldns - patch apply cd /usr/local/daemontools/package/djbdns-1.05 patch < rbldns.c.patch svc -d /service/dnscache /service/rbldns make make setup check svc -u /service/dnscache /service/rbldns sleep 5 svstat /service/{*,*/log} dnsqr a 100.5.168.192.rbldns.professorhack.com dnsqr txt 100.5.168.192.rbldns.professorhack.com ******************************************************************************** _BY: Pejman Moghadam_ _TAG: qmail, vpopmail, mysql, dovecot, roundcube, rbldns, daemontools, ucspi-tcp, sendmail, greylist, djbdns, dnscache, dns, djb_ _DATE: 2010-05-13 16:36:44_