Tetsu Ushijima
qmail-conf

How to set up a qmail POP3 service

A qmail POP3 service handles incomming POP3 connections. It runs qmail-popup under tcpserver, uses a password checker such as checkpassword to do authentication, uses qmail-pop3d to handle POP3 transactions, 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-pop3d-conf program:

              qmail-pop3d-conf /bin/checkpassword qmaill /var/qmail/service/pop3d
    
  3. Change directory to the service directory:

              cd /var/qmail/service/pop3d
    
  4. Add lines to tcp allowing connections from your POP3 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
    
  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/pop3d /service
    

    svscan will start the service within five seconds.

Testing the service

  1. Check the service status:

              svstat /service/pop3d /service/pop3d/log
    

    The output should look something like:

              /service/pop3d: up (pid 6345) 6 seconds
              /service/pop3d/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/pop3d/log/main/current | tai64nlocal
    

    The directory /service/pop3d/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 pop3d
                  /usr/local/bin/tcpserver -vDHR -l0 -xtcp.cdb -- 0 110 ...
                supervise log
                  multilog t ./main
    

    Two new supervise processes should have been added as svscan's children, one for tcpserver (running as root) 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.

  4. Do a POP3 login from your authorized POP3 client host:

  5.           % telnet 127.0.0.1 110
              Trying 127.0.0.1...
              Connected to localhost.
              Escape character is '^]'.
              +OK <pid.timestamp@your.server.host>
              user you
              +OK 
              pass abcd1234
              +OK 
              quit
              +OK 
              Connection closed by foreign host.
              %
    

    (This example assumes that connections from 127.0.0.1 is allowed. Replace you and abcd1234 with your login name and password.)

    The log messages show something like:

              tcpserver: status: 1/40
              tcpserver: pid 523 from 127.0.0.1
              tcpserver: ok 523 0:127.0.0.1:110 :127.0.0.1::1025
              tcpserver: end 523 status 256
              tcpserver: status: 0/40