Tetsu Ushijima
qmail-conf

How to set up a qmail QMQP service

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.

Preparation

Setting up the service

  1. You will have to make three decisions:

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

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

              cd /var/qmail/service/qmqpd
    
  4. 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.

  5. Add lines to tcp allowing connections from your QMQP clients. For example, if you want to allow connections from 1.2.3.4 and 1.2.3.5, add

              1.2.3.4:allow
              1.2.3.5:allow
    

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

              ./add-client 1.2.3.4 1.2.3.5
    

    Take care not to remove the existing :deny line unless you want to be an open relay.

  6. Compile tcp into a binary format for tcpserver:

              make
    

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

  7. Tell svscan about the new service:

              ln -s /var/qmail/service/qmqpd /service
    

    svscan will start the service within five seconds.

Testing the service

  1. 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.

  2. 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
    
  3. 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.