Setting up Taylor UUCP with qmail on FreeBSD 5.1
My site used sendmail with Taylor's UUCP on RH 9.0 before I ventured to check out qmail. I was forced to do so as I found sendmail's configuration files a big bore. I find qmail cute, and you'll agree with me once you get over the initial hitches, which I hope to chip in with some ready information. I don't intend to replace any official information, just help quickly get things going, and yeah, qmail on the legendary BSDs must feel like magic to anyone who use them.
This is a very brief how-to on interfacing qmail with Taylor UUCP v1.06. For a more detailed explanation on qmail, refer to Dan Bernstein's site or the very friendly Life with qmail. If you've heard about qmail, I presume you're a little confused with sendmail – and I'm glad to give you company – I also assume you've had experience configuring UUCP – in short, recognise UUCP's configuration, system and passwd files.
Let's talk about setting up qmail, first.
Setting up qmail
Download the qmail package from Dan Bernstein's site: cr.yp.to/qmail.
You can also try the qmail.org site – I did. The package from this site is called netqmail. Download netqmail into directory /usr, and proceed with these steps -
(you can probably copy and paste these steps into a script and run that, instead)
pw
useradd qmails -g qmail -d /var/qmail -s /nonexistent
cd
/usr
tar zxvf netqmail-1.05.tar.gz
cd /usr/netqmail-1.05
sh collate.sh
cd /usr/netqmail-1.05/netqmail-1.05
make setup check
If the above fails, try ./config-fast <your hostname>
Configuring qmail to run from inetd
You need to invoke qmail from within some kind of a tcp-wrapper, like inetd + tcpd. FreeBSD comes with inetd as the default wrapper, so uncomment the line in /etc/inetd.conf corresponding to the smtp service:
smtp stream tcp nowait qmaild /var/qmail/bin/tcp-env tcp-env /var/qmail/bin/qmail-smtpd
These
are not two different lines – they're one. Of course, all
you need to do is remove the hash symbol (#) at the beginning of this
line. Take up the task of editing this line only if you don't find it
in your inetd.conf,
which I should think is unusual.
kill
-HUP <pid of inetd>
This
ensures that qmail is invoked by inetd everytime there's an incoming
SMTP connection.
Configuring qmail to run from xinetd
If you're running qmail on a Linux based system (these usually come with xinetd pre-installed) you need to have a file /etc/xinetd.d/smtp with the following lines -
Of course, if you're running Linux, you need to restart xinetd by the
/etc/rc.d/init.d/xinetd restart method.
You can telnet port 25 on localhost to see if qmail's able to accept connections.
Setting up qmail to use procmail
We have only set qmail to accept SMTP connections so far. To decide what to do with the data collected by the daemon, you have a variety of options:
have qmail deliver to the Mailbox in user home directories
have
qmail deliver to traditional /var/mail
(the BSDs) or
/var/spool/mail
(Linux)
have qmail deliver to Maildir in user home directories
I
have chosen II, and my delivery agent is procmail. I assume you've
got procmail installed, as well. If not, install it using the BSD
port collection -
/usr/ports/mail/procmail.
I start and stop qmail with this script called /var/qmail/rc -
case "$1" in
start)
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start '|preline procmail' splogger qmail &
exit 0
;;
stop)
exec killall qmail-send
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
Using
qmail
We're
all set. Run /var/qmail/rc start,
and check if processes
qmail-send, qmail-rspawn
are in place. If they are not, you need to check
/var/log/maillog to debug if something's gone wrong.
Setting up Taylor UUCP
I had problems installing Taylor UUCP 1.07 from source, so I installed 1.06 from the ports collection. Once you're through with the installation, run uuchk.
If you see:
Spool directory /var/spool/uucp
Public directory /var/spool/uucppublic
Lock directory /var/spool/lock
Log file /var/spool/uucp/Log
Statistics file /var/spool/uucp/Stats
Debug file /var/spool/uucp/Debug
Global debugging level
uucico -l will strip login names and passwords
uucico will strip UUCP protocol commands
Start uuxqt once per uucico invocation
uuchk: no systems found
uuchk
in the above case is not able to read your configuration files. As of
1.06, it tries to reach out for them in /usr/local/uucp
or /usr/local/conf/uucp.
The best way to check out is to locate for sys.sample,
passwd.sample, config.sample, etc. The directory you
locate these files in is the directory you should move your actual
configuration files to. My original configuration files were in
/etc/uucp, and I had a tough time figuring out why uucp couldn't find
them.
UUCP prerequisites
The
UUCP configuration file config is
the most important, containing directory locations for the UUCP spool
(mail) files. My spool directory is
/var/spool/uucp.
All of your UUCP
customers need to have a directory under this spool directory, each
containing subdirectories called D.,
X. and C.You
also need to have a file called SEQF for each customer. All files and
directories under /var/spool/uucp
must be owned by uucp,
the user for the UUCP programs to be able to write to them.
Running uucico
You can begin your UUCP server by executing uucico -l. A telnet on port 540 should reveal a UUCP login prompt.
Helping qmail understand we're a UUCP server
For this, you need to edit the following files:
/var/qmail/control/rcpthosts
/var/qmail/control/virtualdomains
/var/qmail/alias/.qmail-uucpfqdn-default
/var/qmail/control/rcpthosts needs to simply contain the domain names we accept mails for, each on a separate line.
My /var/qmail/control/virtualdomains contain the following lines:
:alias-uucp
<domain>:uucpfqdn-<domain>
My /var/qmail/alias/.qmail-uucpfqdn-default file contains
(on a single line)
|preline -d /usr/bin/uux - -r -gC -a"$SENDER" `echo $EXT | cut -f2 -d-`!rmail "(${EXT3}@$HOST)"
To check if mails coming into your UUCP domains are being processed, check out the /var/spool/uucp/Log file. You should see entries like
uucico--(2004-10-07 23:37:26 9594) Incoming call (login uabc port stdin)
uux abc alias (2004-10-07 23:38:53.44 79638) Queuing rmail 123@abc.x (D.003P)
where abc is your customer name. The first line implies that your UUCP server is able to handle incoming requests – the second, that its able to process incoming mail.
Questions/comments? Mail them to faq with this site as the domain; I'll be glad to respond.
-- Sumanth NS