A qmail QMQP service handles incomming QMQP connections. It runs qmail-qmqpd under tcpserver and uses multilog to store log messages. Both tcpserver and multilog are supervised.
Install ucspi-tcp 0.86 or above.
Install and configure qmail 1.03. Installing qmail means creating the /var/qmail directory tree. Configuring qmail means setting up some basic control files in /var/qmail/control, setting up some basic aliases in /var/qmail/alias, and setting up /var/qmail/rc. If you have followed the instructions in INSTALL from the beginning through step 8, you must have done all these things.
The following instructions assume that any process is currently not listening on the TCP port 628, the standard QMQP port. If some process is currently listening on the TCP port 628, you have to stop that process or have that process not listen on the port before going any further. Here is a (probably incomplete) check list:
If you are running qmail-qmqpd under tcpserver, give that tcpserver a TERM signal and comment out the tcpserver invocation in your system boot scripts.
You should have already set up a qmail delivery service. If you haven't, mail messages received via QMQP will be left in the queue without being delivered anywhere.
You will have to make three decisions:
The qmail daemon account name, normally qmaild. The tcpserver program and the qmail-qmqpd program run under this account. If this account does not exist, create it now.
The qmail log account name, normally qmaill. Logging programs run under this account. If this account does not exist, create it now.
The qmail QMQP service directory, normally /var/qmail/service/qmqpd. This is where logs and a few configuration files are stored.
Create the service directory by running the qmail-qmqpd-conf program:
qmail-qmqpd-conf qmaild qmaill /var/qmail/service/qmqpd
Change directory to the service directory:
Optionally, if you have already set up /etc/qmqp.tcp for tcpserver and want to preserve the rules, copy /etc/qmqp.tcp to tcp:
cp /etc/qmqp.tcp tcp
Warning: /etc/qmqp.tcp and /etc/qmqp.cdb will no longer be used. Instead, tcp and tcp.cdb in the service directory will be used. Sorry for the incompatibility with the official qmail documentation.
Add lines to tcp allowing connections from your QMQP clients. For example, if you want to allow connections from 22.214.171.124 and 126.96.36.199, add
to tcp. You can do this by running the add-client script:
./add-client 188.8.131.52 184.108.40.206
Take care not to remove the existing :deny line unless you want to be an open relay.
Compile tcp into a binary format for tcpserver:
(You have to run make in the service directory whenever you update tcp.)
Tell svscan about the new service:
ln -s /var/qmail/service/qmqpd /service
svscan will start the service within five seconds.
Check the service status:
svstat /service/qmqpd /service/qmqpd/log
The output should look something like:
/service/qmqpd: up (pid 6345) 6 seconds /service/qmqpd/log: up (pid 6347) 6 seconds
Run svstat several times and make sure that the process IDs shown do not change.
Check the log messages:
tail -f /service/qmqpd/log/main/current | tai64nlocal
The directory /service/qmqpd/log/main contains log files to which tcpserver (and possibly its children) stores the log messages. The output should look something like:
tcpserver: status: 0/40
Use ps to browse the process tree. It should contain the following portion:
svscan /service supervise qmqpd /usr/local/bin/tcpserver -vDUHR -lyour.host -xtcp.cdb -- 0 628 ... supervise log multilog t ./main
Two new supervise processes should have been added as svscan's children, one for tcpserver (running as qmaild) and the other for multilog (running as qmaill). The process IDs of tcpserver and multilog should match with svstat's output. All these processes should be idle at this time.