Tetsu Ushijima
qmail-conf

How to set up a qmail QMTP service

A qmail QMTP service handles incomming QMTP connections. It runs qmail-qmtpd under tcpserver and uses multilog to store log messages. Both tcpserver and multilog are supervised.

Preparation

Setting up the service

  1. You will have to make three decisions:

  2. Create the service directory by running the qmail-qmtpd-conf program:

              qmail-qmtpd-conf qmaild qmaill /var/qmail/service/qmtpd
    
  3. Change directory to the service directory:

              cd /var/qmail/service/qmtpd
    
  4. Optionally, if you want to allow relaying from selected clients through the service, add lines to tcp allowing connections and setting the RELAYCLIENT environment variable for the selected clients. For example, if you want to allow relaying from 127.0.0.1 and 192.168.1.*, add

              127.0.0.1:allow,RELAYCLIENT=""
              192.168.1.:allow,RELAYCLIENT=""
    

    to tcp. You can do this by running the add-relayclient script:

              ./add-relayclient 127.0.0.1 192.168.1.
    
  5. Compile tcp into a binary format for tcpserver:

              make
    

    (You have to run make in the service directory whenever you update tcp.)

  6. Tell svscan about the new service:

              ln -s /var/qmail/service/qmtpd /service
    

    svscan will start the service within five seconds.

Testing the service

  1. Check the service status:

              svstat /service/qmtpd /service/qmtpd/log
    

    The output should look something like:

              /service/qmtpd: up (pid 6345) 6 seconds
              /service/qmtpd/log: up (pid 6347) 6 seconds
    

    Run svstat several times and make sure that the process IDs shown do not change.

  2. Check the log messages:

              tail -f /service/qmtpd/log/main/current | tai64nlocal
    

    The directory /service/qmtpd/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
    
  3. Use ps to browse the process tree. It should contain the following portion:

              svscan /service
                supervise qmtpd
                  /usr/local/bin/tcpserver -vDUHR -lyour.host -xtcp.cdb -- 0 209 ...
                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.