Qmail BSDI Install

It is Friday 19 April 2024 - 09:20:25.
Your IP address is 3.141.100.120

news personal professional computing outdoors reference travel humor

Computing

Reference

Emoticons Hardware Internet Security

Protocols

DNS MAIL WWW SQL SNMP (manage) RADIUS AppleTalk

Specific

FreeBSD MacOS

Legacy

PalmOS BSDI

1. Get the following files and place them in /usr/src/qmail:
qmail-1.03.tar.gz ftp://koobera.math.uic.edu
ucspi-tcp-0.88.tar.gz http://pobox.com/~djb/ucspi-tcp.html

2. Install auxiliary programs:

# cd /usr/src/qmail
# gunzip ucspi-tcp-0.80.tar.gz ; tar -xvf ucspi-tcp-0.80.tar.gz
# cd ucspi-tcp-0.80
# make ; make man ; make setup

# gunzip checkpassword-0.81.tar.gz ; tar -xvf checkpassword-0.81.tar
# cd ../checkpassword-0.81
# make ; make setup check

# gunzip rblsmtpd-0.70.tar.gz ; tar -xvf rblsmtpd-0.70.tar
# cd ../rblsmtpd-0.70
# make ; make setup check

3. Create the qmail home directory:
# mkdir /var/qmail

4. Set up the qmail group and the qmail users.
# addgroup nofiles
# adduser -g nofiles -H/var/qmail/alias -G,,, -s/dev/null -P'*' alias
# adduser -g nofiles -H/var/qmail -G,,, -s/dev/null -P'*' qmaild
# adduser -g nofiles -H/var/qmail -G,,, -s/dev/null -P'*' qmaill
# adduser -g nofiles -H/var/qmail -G,,, -s/dev/null -P'*' qmailp
# addgroup qmail
# adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmailq
# adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmailr
# adduser -g qmail -H/var/qmail -G,,, -s/dev/null -P'*' qmails

5. Compile the qmail program:
# cd /usr/src/qmail
# gunzip qmail-1.03.tar.gz ; tar -xvf qmail-1.03.tar
# cd qmail-1.03
# patch < ../qmail-1.03-rbl.diffs
# patch < ../qmail-1.03-popbull.diffs
# make
# cp qmail-popbull /usr/local/bin/
6. Create the formatted man pages, *.0:
# make man
7. Create the qmail directory tree:
# make setup
8. Run instcheck to make sure it doesn't print any warnings:
# make check
7. You MUST tell qmail your hostname.
# ./config
qmail-config finds your fully-qualified hostname and puts it in control/me.
If you want to learn configuration possibilities, see qmail-control.0.

8. Minimal survival command:
# (cd ~alias; touch .qmail-postmaster .qmail-mailer-daemon .qmail-root)
# chmod 644 ~alias/.qmail*

* root. Under qmail, root never receives mail. Your system may generate
mail messages to root every night. Set up an alias for root
in ~alias/.qmail-root.

9. qmail-local delivers mail by default into ~user/Mailbox.

Put ``setenv MAIL $HOME/Maildir'' in your system-wide .cshrc,
``MAIL=$HOME/Maildir; export MAIL'' in your system-wide .profile,
``inbox-path=$HOME/Maildir'' in your system-wide pine.conf.

10. Enable deliveries of messages injected into qmail:

Copy /var/qmail/boot/home to /var/qmail/rc. Edit to taste.
# /var/qmail/rc &

12. Look for a "qmail: running" line in syslog. qmail-send always prints either
``cannot start'' or ``running''. (The big number is a splogger timestamp.)

13. Do a ps and look for the qmail daemons. There should be four of
them, all idle: qmail-send, running as qmails; qmail-lspawn, running
as root; qmail-rspawn, running as qmailr; and qmail-clean, running
as qmailq. You will also see the splogger process.

14. Local-local test: Send yourself an empty message. (Replace ``me''
with your username. Make sure to include the ``to:'' colon.)
% echo to: me | /var/qmail/bin/qmail-inject
The message will show up immediately in ~/Maildir, and syslog will
show something like this:
qmail: new msg 53
qmail: info msg 53: bytes 246 from <me@domain> qp 20345 uid 666
qmail: starting delivery 1: msg 53 to local me@domain
qmail: delivery 1: success: did_1+0+0/
qmail: end msg 53
(53 is an inode number; 20345 is a process ID; your numbers will
probably be different.)

15. Local-error test: Send a message to a nonexistent local address.
% echo to: nonexistent | /var/qmail/bin/qmail-inject
qmail: new msg 53
qmail: info msg 53: bytes 246 from <me@domain> qp 20351 uid 666
qmail: starting delivery 2: msg 53 to local nonexistent@domain
qmail: delivery 2: failure: No_such_address.__#5.1.1_/
qmail: bounce msg 53 qp 20357
qmail: end msg 53
qmail: new msg 54
qmail: info msg 54: bytes 743 from <> qp 20357 uid 666
qmail: starting delivery 3: msg 54 to local me@domain
qmail: delivery 3: success: did_1+0+0/
qmail: end msg 54
You will now have a bounce message in ~/Maildir.

16. Local-remote test: Send an empty message to your account on another
machine.
% echo to: me@wherever | /var/qmail/bin/qmail-inject
qmail: new msg 53
qmail: info msg 53: bytes 246 from <me@domain> qp 20372 uid 666
qmail: starting delivery 4: msg 53 to remote me@wherever
qmail: delivery 4: success: 1.2.3.4_accepted_message./...
qmail: end msg 53
There will be a pause between ``starting delivery'' and ``success'';
SMTP is slow. Check that the message is in your mailbox on the other
machine.

17. Local-postmaster test: Send mail to postmaster, any capitalization.
% echo to: POSTmaster | /var/qmail/bin/qmail-inject
Look for the message in ~alias/Maildir.

18. Double-bounce test: Send a message with a completely bad envelope.
% /var/qmail/bin/qmail-inject -f nonexistent
To: unknownuser
Subject: testing

This is a test. This is only a test.
%
(Use end-of-file, not dot, to end the message.) Look for the double
bounce in ~alias/Maildir.

19. Group membership test:
% cat > ~me/.qmail-groups |groups >> MYGROUPS; exit 0
% /var/qmail/bin/qmail-inject me-groups < /dev/null
% cat ~me/MYGROUPS
MYGROUPS will show your normal gid and nothing else. (Under Solaris,
make sure to use /usr/ucb/groups; /usr/bin/groups is broken.)

20. You must replace the sendmail invocation in your
boot scripts with an appropriate qmail invocation.

Find sendmail in your boot scripts. It's in /etc/rc.
sendmail -bd -q15m
Comment out this line, and add this to /etc/rc.local:

csh -cf '/var/qmail/rc &'

22. Replace sendmail with a link to qmail's ``sendmail'' wrapper:
# mv /usr/sbin/sendmail /usr/sbin/sendmail.bak
# ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

23. Add the following to /etc/rc.local.
/usr/local/bin/tcpserver -x/etc/tcp.smtp.cdb -u1009 -g101 0 smtp \
/usr/local/bin/rblsmtpd -b -t2 -r dul.maps.vix.com \
/usr/local/bin/rblsmtpd -b -t2 /var/qmail/bin/qmail-smtpd &
Comment out comsat in /etc/inetd.conf.
The -uXXX is the UID of qmaild and -g is the GID of nofiles.

24. Create the /etc/tcp.smtp file.

127.0.0.1:allow,RELAYCLIENT=""
208.246.108.:allow,RELAYCLIENT=""
208.246.109.:allow,RELAYCLIENT=""
208.246.110.:allow,RELAYCLIENT=""
208.246.111.:allow,RELAYCLIENT=""
209.14.30.:deny
209.14.198.:deny

Compile it with the /etc/tcpmakectl you are about to create:
#!/bin/sh
/usr/local/bin/tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp \
< /etc/tcp.smtp
chmod 644 /etc/tcp.*
echo "Reloaded /etc/tcp.smtp..."

25. Configure your DNS server(s) for the domains rbl.maps.vix.com,
dul.maps.vix.com, and any other anti-spam lists you subscribe to.

26. Reboot.

27. Disable all the sendmail and binmail programs in your system. The
safest approach is to chmod 0 everything. Some locations to check:
/usr/sbin/sendmail, /usr/lib/sendmail.bak, /usr/lib/sendmail.mx,
/bin/mail, /usr/libexec/mail.local.

28. Make sure that ``mail'' still invokes a reasonable mailer. Under
SVR4 you may want to link mail to mailx.

Post-upgrade tests (can be done immediately after step 24):

29. SMTP server test: Forge some mail locally via SMTP.
% telnet 127.0.0.1 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 domain ESMTP
helo dude
250-domain
250-PIPELINING
250 8BITMIME
mail <me@domain>
250 ok
rcpt <me@domain>
250 ok
data
354 go ahead
Subject: testing

This is a test.
.
250 ok 812345679 qp 12345
quit
221 domain
Connection closed by foreign host.
%
Look for the message in your mailbox.
30. Remote-local test: Send yourself some mail from another machine.
31. Remote-error test: I think you can figure this one out.
32. UA test: Try sending mail, first to a local account, then to a
remote account, with your normal user agent.
33. Remote-postmaster test: Send mail from another machine to
PoStMaStEr@domain. Look for the message in ~alias/Maildir.

If you have questions about qmail, contact qmail@pobox.com.

QMAIL-POP3D

34. Edit /etc/services and make sure port 110 is open.
pop3 110/tcp
Comment out the default popper in /etc/inetd.conf.

35. Start the qpop3d server at boot time but adding the following
to /etc/rc.local:

/usr/local/bin/tcpserver 0 pop3 /var/qmail/bin/qmail-popup \
HOSTNAME /usr/local/bin/checkpassword /var/qmail/bin/qmail-pop3d \
Maildir &

RCPTHOSTS file should include all virtual domains and any that you secondary MX for.


maildir2smtp is designed to pass messages along a SLIP or
PPP link. To set this up on the disconnected end, create
a new maildir in ~alias:

# maildirmake ~alias/pppdir
# chown -R alias ~alias/pppdir

Put

:alias-ppp

into control/virtualdomains and

./pppdir/

into ~alias/.qmail-ppp-default. Don't forget the extra
slash in pppdir/. Then, in the PPP startup script, do

maildir2smtp ~alias/pppdir alias-ppp- $IP `hostname`

replacing $IP with the remote IP address.

My /etc/ppp/ip-up script, for example, looks like this:

#!/bin/sh

# qmail controlfiles are in
QCD='/var/qmail/control'

# our mailhandling host
SMARTHOST=`cat $QCD/SMARTHOST | sed '/^#/d'`

# find smarthost's ip-address
SMARTIP=`host $SMARTHOST | cut -d" " -f4`

# find own hostname; dynamically assigned!
# $4 is the assigned ipaddress, passed along by pppd
ME=`host $4|head -1|cut -d" " -f2`
echo "$ME" > $QCD/HOSTNAME

# send batched mail to smarthost
/var/qmail/bin/maildirsmtp ~alias/pppdir alias-ppp- $SMARTIP $ME

# fetch mail from POP/IMAP servers for users specified in
# $QCD/POPPERS
for user in `cat $QCD/POPPERS | sed '/^#/d'`
do su - $user -c /usr/local/bin/fetchmail -s
done

I don't know if this is the most elegant way, but it works well for me. Note that SMARTHOST and POPPERS are not part of qmail. I just put them in that directory to have all the mail stuff in one place. Maybe /etc would be more appropriate.


© Matt Simerson 1999-2004 - Email suggestions or updates.