Steps to Build a Slackware qmail Toaster

Here is what we are using:

Start install of qmail, ucspi-tcp, daemontools, and cdb tools

  1. mkdir /downloads
  2. cd /downloads
  3. wget latest versions of qmail, ucspi-tcp, and daemontools
  4. mkdir -p /var/qmail
  5. mkdir /usr/src/qmail
  6. groupadd nofiles
  7. useradd -g nofiles -d /var/qmail/alias -s /sbin/nologin -p'*' alias
  8. useradd -g nofiles -d /var/qmail -s /sbin/nologin -p'*' qmaild
  9. useradd -g nofiles -d /var/qmail -s /sbin/nologin -p'*' qmaill
  10. useradd -g nofiles -d /var/qmail -s /sbin/nologin -p'*' qmailp
  11. groupadd qmail
  12. useradd -g qmail -d /var/qmail -s /sbin/nologin -p'*' qmailq
  13. useradd -g qmail -d /var/qmail -s /sbin/nologin -p'*' qmailr
  14. useradd -g qmail -d /var/qmail -s /sbin/nologin -p'*' qmails
  15. groupadd vchkpw
  16. useradd -g vchkpw -d /home/vpopmail -s /sbin/nologin -p'*' vpopmail
  17. cd /usr/src/qmail
  18. tar zxvf /downloads/qmail-1.03.tar.gz
  19. tar zxvf /downloads/ucspi-tcp-0.88.tar.gz
  20. mkdir -p /package
  21. chmod 1755 /package
  22. cd /package
  23. tar zxvf /downloads/daemontools-0.76.tar.gz
  24. mkdir /var/log/qmail
  25. cd /var/log/qmail
  26. mkdir qmail-send qmail-smtpd qmail-pop3d qmail-updater spamd vpopmaild
  27. chown -R qmaill:root /var/log/qmail
  28. chmod -R 750 /var/log/qmail
  29. mkdir -p /var/qmail/supervise
  30. cd /var/qmail/supervise
  31. mkdir -p qmail-smtpd/log qmail-send/log qmail-pop3d/log qmail-updater/log spamd/log vpopmaild/log
  32. chmod +t qmail-smtpd qmail-send qmail-pop3d qmail-updater spamd vpopmaild
  33. echo 211 > /usr/src/qmail/qmail-1.03/conf-split
  34. echo 255 > /usr/src/qmail/qmail-1.03/conf-spawn
  35. cd /downloads
  36. wget latest vpopmail and Simscan from Inter7
  37. tar zxvf vpopmail-5.4.18.tar.gz
  38. tar zxvf simscan-1.3.1.tar.gz


Install libdomainkeys

  1. cd /downloads
  2. wget latest libdomainkeys from domainkeys.sourceforge.net
  3. tqar zxvf libdomainkeys-0.68.tar.gz
  4. cd libdomainkeys-0.68
  5. echo -lresolv > dns.lib
  6. make
  7. ./test - you may get an error on the last test, "------TC30 '(pause)'". This appears to be harmless and the code works anyway.
  8. install -m 644 libdomainkeys.a /usr/local/lib/
  9. install -m 644 domainkeys.h /usr/local/include/
  10. install -m 644 dktrace.h /usr/local/include/
  11. install -m 755 dknewkey /usr/local/bin/
  12. mkdir -p /etc/domainkeys/domain.tld
  13. cd /etc/domainkeys/domain.tld
  14. dknewkey default 1024 > default.pub
  15. edit default.pub to the following:
    • _domainkey.domain.tld. IN TXT "t=y; o=~; r=postmaster@domain.tld"
    • default._domainkey.domain.tld. IN TXT "t=y; leave the rest of the key as is"
  16. chown -R root.vchkpw /etc/domainkeys
  17. chmod -R g=u-w,o= /etc/domainkeys
  18. Add DNS TXT records:
  19. reload the zone


Patch & Install qmail

  1. cd /downloads
  2. Get John Simpson's latest combined patch set from qmail.jms1.net, this combines a whole lot of crap we would have to do manually and you can go to his site to see all what this does
  3. cd /usr/src/qmail/qmail-1.03
  4. patch < /downloads/simscan-1.3.1/contrib/qmail-queue-custom-error.patch
  5. patch < /downloads/patches/qmail-1.03-jms1.6cf.patch
  6. patch < /downloads/patches/qmail-1.03-jms1.6b+dk.2.patch
  7. patch < /downloads/vpopmail-5.4.18/contrib/qmail-maildir++.patch
  8. make
  9. make setup check
  10. ./config-fast your_fqdn_hostname
  11. make cert
  12. chown -R vpopmail:qmail /var/qmail/control/clientcert.pem /var/qmail/control/servercert.pem
  13. cd /usr/src/qmail/ucspi-tcp-0.88
  14. patch < /downloads/qmailrocks/patches/ucspi-tcp-0.88.errno.patch
  15. make && make setup check
  16. cd /package/admin/daemontools-0.76/src
  17. patch < /downloads/qmailrocks/patches/daemontools-0.76.errno.patch
  18. cd ..
  19. package/install
  20. do ps ax, and should see svscanboot running


Install EZmlm

  1. cd /downloads
  2. wget latest ezmlm stuff from http://www.ezmlm.org
  3. tar zxvf ezmlm-idx-5.0.2.tar.gz
  4. tar zxvf ezmlm-0.53.tar.gz
  5. mv ezmlm-idx-0.xx/* ezmlm-0.53/
  6. cd ezmlm-0.53
  7. patch < idx.patch
  8. edit conf-sub and replace 1st line with the word "mysql"
  9. edit sub_mysql/conf-sqlcc and edit location of include files (/usr/local/mysql/include/mysql)
  10. edit sub_mysql/conf-sqlld and edit location of libraries (/usr/local/mysql/lib/mysql)
  11. make
  12. make setup


Autoresponder

  1. cd /downloads
  2. wget latest autoresponder from http://www.inter7.com/index.php?page=development
  3. tar zxvf autorespond-2.0.5.tar.gz
  4. cd autorespond-2.0.5
  5. make
  6. make install


Vpopmail with MySQL Support

  1. mkdir -p /home/vpopmail/etc
  2. chown vpopmail:vchkpw /home/vpopmail/etc
  3. echo "localhost|0|vpopmailuser|password|vpopmail" > /home/vpopmail/etc/vpopmail.mysql
  4. chmod 640 /home/vpopmail/etc/vpopmail.mysql
  5. mysql -u root -p
  6. CREATE DATABASE vpopmail;
  7. GRANT select,insert,update,delete,create,drop ON vpopmail.* TO vpopmailuser@localhost IDENTIFIED BY 'password';
  8. quit;
  9. cd /downloads/vpopmail-5.4.18
  10. ./configure --enable-logging=y --enable-domain-quotas --enable-auth-module=mysql --disable-many-domains --enable-auth-logging --enable-sql-logging --enable-valias --enable-mysql-limits --enable-onchange-script
  11. make
  12. make install-strip
  13. Run vpopmaild under daemontools
  14. /home/vpopmail/bin/vadddomain some.domain


Maildrop

  1. cd /downloads
  2. wget latest maildrop from courier-mta.org
  3. tar jxvf maildrop-2.0.2.tar.bz2
  4. cd maildrop-2.0.2
  5. ./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota
  6. make
  7. make install-strip
  8. make install-man


Qmailadmin

  1. cd /downloads
  2. wget latest qmailadmin sourece from Inter7
  3. tar zxvf qmailadmin-1.2.11.tar.gz
  4. cd qmailadmin-1.2.11
  5. ./configure --enable-cgibindir=/usr/local/apache/share/cgi-bin --enable-htmldir=/usr/local/apache/share/htdocs --disable-ezmlm-mysql --program-suffix=.cgi --enable-cgipath=/cgi-bin/qmailadmin.cgi
  6. make
  7. make install-strip


Finalize qmail

  1. cd /var/qmail/supervise/qmail-pop3d
  2. pico run
  3. cd log
  4. pico run
  5. cd ../../qmail-smtpd
  6. pico run
  7. cd log
  8. pico run
  9. cd ../../qmail-send
  10. pico run
  11. cd log
  12. pico run
  13. cd /var/qmail
  14. pico rc
  15. cd bin
  16. pico qmailctl
  17. chmod 755 /var/qmail/rc /var/qmail/bin/qmailctl
  18. chmod 751 /var/qmail/supervise/qmail-pop3d/run
  19. chmod 751 /var/qmail/supervise/qmail-pop3d/log/run
  20. chmod 751 /var/qmail/supervise/qmail-smtpd/run
  21. chmod 751 /var/qmail/supervise/qmail-smtpd/log/run
  22. chmod 751 /var/qmail/supervise/qmail-send/run
  23. chmod 751 /var/qmail/supervise/qmail-send/log/run
  24. chmod 751 /var/qmail/supervise/vpopmaild/run
  25. chmod 751 /var/qmail/supervise/vpopmaild/log/run
  26. echo ./Maildir > /var/qmail/control/defaultdelivery
  27. echo 255 > /var/qmail/control/concurrencyremote
  28. chmod 644 /var/qmail/control/concurrencyremote
  29. echo 30 > /var/qmail/control/concurrencyincoming
  30. chmod 644 /var/qmail/control/concurrencyincoming
  31. echo 3 > /var/qmail/control/spfbehavior
  32. chmod 644 /var/qmail/control/spfbehavior
  33. echo 1 > /var/qmail/control/mfcheck
  34. chmod 644 /var/qmail/control/mfcheck
  35. echo "-r sbl-xbl.spamhaus.org -r bl.spamcop.net" > /var/qmail/control/blacklists
  36. chmod 644 /var/qmail/control/blacklists
  37. echo 5242800 > /var/qmail/control/databytes
  38. chmod 644 /var/qmail/control/databytes
  39. echo 20 > /var/qmail/control/maxrcpt
  40. chmod 644 /var/qmail/control/maxrcpt
  41. ln -s /var/qmail/bin/qmailctl /usr/bin
  42. ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /var/qmail/supervise/qmail-pop3d /service
  43. qmailctl stop
  44. echo '127.:allow,RELAYCLIENT=""' >> /etc/tcp.smtp
  45. qmailctl cdb
  46. echo some_address > /var/qmail/alias/.qmail-root
  47. ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-postmaster
  48. ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-mailer-daemon
  49. ln -s /var/qmail/alias/.qmail-root /var/qmail/alias/.qmail-anonymous
  50. chmod 644 /var/qmail/alias/.qmail*


Uninstalling Sendmail

  1. /etc/rc.d/rc.sendmail stop
  2. pkgtool
  3. ln -s /var/qmail/bin/sendmail /usr/lib/sendmail
  4. ln -s /var/qmail/bin/sendmail /usr/bin/sendmail
  5. ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail


Start qmail

  1. qmailctl stop
  2. qmailctl start
  3. qmailctl stat (should show pop3d, send, smtpd, vpopmaild all running and log for each)
  4. send a test message to postmaster@domain_you_created_earlier.com
  5. test POP3 functionality
  6. test SMTP TLS functionality


Courier imap/imaps with Courierpassd

  1. cd /downloads
  2. wget latest courier-authlib from http://www.courier-mta.org
  3. tar jxvf courier-authlib-0.59.tar.bz2
  4. cd courier-authlib-0.59
  5. ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --without-authuserdb --without-authldap --without-authpwd --without-authshadow --without-authpgsql --without-authmysql --without-authcustom --without-authpipe --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib
  6. make && make check
  7. make install-strip && make install-configure
  8. echo /usr/local/lib/courier-authlib >> /etc/ld.so.conf
  9. ldconfig
  10. echo /usr/local/sbin/authdaemond start >> /etc/rc.d/rc.lcoal
  11. /usr/local/sbin/authdaemond start (check /var/log/maillog to see if started)
  12. cd ..
  13. wget latest courier-imap from http://www.courier-mta.org
  14. tar jxvf courier-imap-4.1.2.tar.bz2
  15. courier imap must be compiled by a non-root user, so: su bob
  16. chown -R bob:wheel courier-imap-4.1.2
  17. cd courier-imap-4.1.2
  18. su bob
  19. ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-authvchkpw --with-authdaemon --without-authuserdb --without-authldap --without-authpwd --without-authshadow --without-authpgsql --without-authmysql --without-authcustom --without-authpipe --disable-root-check --with-ssl --with-authchangepwdir=/usr/local/libexec/authlib
  20. make && make check
  21. now we have to be root again, so: exit
  22. make install-strip && make install-configure
  23. edit /usr/local/etc/imapd.cnf and change local information. Make sure CN = your mail server's FQDN
  24. edit /usr/local/etc/pop3d.cnf and change local information. Make sure CN = your mail server's FQDN
  25. /usr/local/sbin/mkimapdcert
  26. /usr/local/sbin/mkpop3dcert
  27. edit /usr/local/etc/imapd and change the following settings:
  28. edit /usr/local/etc/imapd-ssl and change the following settings:
  29. edit /usr/local/etc/pop3d and change the following settings:
  30. edit /usr/local/etc/pop3d-ssl and change the following settings:
  31. cp /usr/local/libexec/imapd.rc /etc/rc.d/rc.imapd
  32. cp /usr/local/libexec/imapd-ssl.rc /etc/rc.d/rc.imapd-ssl
  33. cp /usr/local/libexec/pop3d-ssl.rc /etc/rc.d/rc.pop3d-ssl
  34. echo /etc/rc.d/rc.imapd start >> /etc/rc.d/rc.lcoal
  35. echo /etc/rc.d/rc.imapd-ssl start >> /etc/rc.d/rc.lcoal
  36. echo /etc/rc.d/rc.pop3d-ssl start >> /etc/rc.d/rc.lcoal
  37. /etc/rc.d/rc.imapd start
  38. /etc/rc.d/rc.imapd-ssl start
  39. /etc/rc.d/rc.pop3d-ssl start
  40. cd /downloads
  41. wget latest Courierpassd
  42. tar zxvf courierpassd-1.1.2.tar.gz
  43. cd courierpassd-1.1.2
  44. ./configure --prefix=/usr/local --exec-prefix=/usr/local --with-badpassdelay=5
  45. make && make install
  46. echo courierpassd stream tcp nowait root /usr/local/sbin/courierpassd -s imap >> /etc/inetd.conf
  47. edit /etc/services
  48. /etc/rc.d/rc.inetd restart
  49. Test out courierpassd
  50. /home/vpopmail/bin/vuserinfo postmaster@some_domain_you_created_earlier.com - you should see you changed password


ClamAV

  1. cd /downloads
  2. wget latest ClamAV source from http://www.clamav.net
  3. tar zxvf clamav-0.88.7.tar.gz
  4. cd clamav-0.88.7
  5. ./configure --prefix=/usr --sysconfdir=/etc --with-user=vpopmail --with-group=vchkpw
  6. make && make check && make install
  7. echo /usr/lib >> /etc/ld.so.conf
  8. ldconfig
  9. Edit /etc/clamd.conf and do the following:
  10. Edit /etc/freshclamd.conf and do the following:
  11. mkdir /var/log/clamav
  12. chown -R vpopmail.vchkpw /var/log/clamav
  13. mkdir /var/lib/clamav
  14. chown -R vpopmail.vchkpw /var/lib/clamav
  15. mkdir /var/run/clamav
  16. chown -R vpopmail.vchkpw /var/run/clamav
  17. echo #!/bin/sh > /etc/cron.daily/freshclam
  18. echo /usr/bin/freshclam --quiet >> /etc/cron.daily/freshclam
  19. chmod 755 /etc/cron.dail/freshclam
  20. /usr/bin/freshclam
  21. echo /usr/sbin/clamd >> /etc/rc.d/rc.local
  22. /usr/sbin/clamd &


SpamAssassin

  1. cd /downloads
  2. perl -MCPAN -e 'install "Digest::SHA1"'
  3. perl -MCPAN -e 'install "Digest::HMAC"'
  4. perl -MCPAN -e 'install "Net::DNS"'
  5. perl -MCPAN -e 'install "Time::HiRes"'
  6. perl -MCPAN -e 'install "HTML::Tagset"'
  7. perl -MCPAN -e 'install "HTML::Parser"'
  8. perl -MCPAN -e 'install "DB_File"'
  9. perl -MCPAN -e 'install "Pod::Usage"'
  10. perl -MCPAN -e 'install "Parse::Syslog"'
  11. perl -MCPAN -e 'install "Statistics::Distributions"'
  12. perl -MCPAN -e 'install "Mail::SPF::Query"'
  13. wget latest SpamAssassin source from http://spamassassin.apache.org
  14. tar zxvf Mail-SpamAssassin-3.1.3.tar.gz
  15. cd Mail-SpamAssassin-3.1.3
  16. perl Makefile.PL
  17. make && make install
  18. groupadd spamd
  19. useradd -g spamd -s /bin/false spamd
  20. pico /etc/rc.d/rc.spamd
  21. chmod 755 /etc/rc.d/rc.spamd
  22. edit /etc/mail/spamassassin/local.cf and make these changes:
  23. echo /etc/rc.d/rc.spamd start >> /etc/rc.d/rc.local


Simscan

  1. cd /downloads
  2. wget latest ripMIME source from http://www.pldaniels.com/ripmime
  3. tar zxvf ripmime-1.4.0.6.tar.gz
  4. cd ripmime-1.4.0.6
  5. make && make install
  6. cd /downloads/simscan-1.3.1
  7. echo .mp3 > /var/qmail/control/ssattach
  8. echo .bat >> /var/qmail/control/ssattach
  9. echo .exe >> /var/qmail/control/ssattach
  10. ./configure --enable-user=vpopmail --enable-clamav=y --enable-clamdscan=/usr/bin/clamdscan --enable-custom-smtp-reject=y --enable-per-domain=y --enable-attach=y --enable-spam=y --enable-spam-hits=10 --enable-spamc-user=y --enable-spamc=/usr/bin/spamc --enable-dropmsg=n --enable-qmaildir=/var/qmail --enable-qmail-queue=/var/qmail/bin/qmail-queue --enable-ripmime=/usr/local/bin/ripmime --enable-received=y --enable-spamassassin-path=/usr/bin/spamassassin --enable-clamavdb-path=/var/lib/clamav --enable-sigtool-path=/usr/bin/sigtool
  11. make && make install-strip
  12. chmod g+s /var/qmail/simscan
  13. add this to the first line of /var/qmail/supervise/qmail-smtpd/run below #!/bin/sh:
  14. echo :clam=yes,spam=yes,spam_hits=5.0,attach=.mp3:.exe:.bat > /var/qmail/control/simcontrol
  15. /var/qmail/bin/simscanmk
  16. /var/qmail/bin/simscanmk -g
  17. qmailctl stop
  18. qmailctl start
  19. echo :allow,QMAILQUEUE="/var/qmail/bin/simscan",NOP0FCHECK="1" >> /etc/tcp.smtp
  20. qmailctl cdb


Validrcptto Stuff

  1. wget latest cdb package from DJB's site: http://cr.yp.to/cdb
  2. tar zxvf cdb-0.75.tar.gz
  3. cd cdb-0.75
  4. Edit error.h (as per JMS @ http://qmail.jms1.net/scripts/mkvalidrcptto.shtml) and do this:
  5. make
  6. make setup check
  7. perl -MCPAN -e 'install "CDB_File"'
  8. cd /usr/local/bin
  9. wget http://qmail.jms1.net/scripts/mkvalidrcptto
  10. chmod 755 mkvalidrcptto
  11. cd /var/qmail/supervise
  12. mkdir -m 1755 qmail-updater
  13. mkdir -m 755 qmail-updater/log
  14. cd qmail-updater/log
  15. create a run file with the following:
  16. chmod 755 run
  17. cd ..
  18. wget http://qmail.jms1.net/scripts/pipe-watcher
  19. wget http://qmail.jms1.net/scripts/update-qmail
  20. wget http://qmail.jms1.net/scripts/service-qmail-updater-run
  21. mv service-qmail-updater-run run
  22. chmod 755 pipe-watcher update-qmail run
  23. edit update-qmail and do this:
  24. ln -s /var/qmail/supervise/qmail-updater /service/
  25. as a non-root user, do: "touch /tmp/update-qmail"
  26. ls -al /var/qmail/control and you should see updated validrcptto and .cdb files
  27. cd /home/vpopmail/etc
  28. wget http://qmail.jms1.net/scripts/onchange
  29. chown vpopmail.vchkpw onchange
  30. chmod 750 onchange
  31. qmailctl restart
  32. In one shell, do: tail -f /var/log/qmail/qmail-updater/current |tai64nlocal
  33. In another shell, do: echo testing > /tmp/update-qmail
  34. Watch log spool in first shell to see if checks for updates


SquirrelMail

  1. cd /downloads
  2. wget latest SquirrelMail source from http://www.squirrelmail.org
  3. cd /usr/local/apache/share/htdocs
  4. tar zxvf /downloads/squirrelmail-1.4.7.tar.gz
  5. mv squirrelmail-1.4.7 webmail
  6. cd webmail
  7. config/conf.pl
  8. set the following
  9. mkdir /tmp/sqattachments
  10. chmod 733 /tmp/sqattachments
  11. cd ..
  12. chown -R root.apache data/
  13. mysql -u root -p