openQmail

A modern mail transfer agent suite around eQmail

User Tools

Site Tools


Modules


qboot

a set of configurable boot scripts.

Version: qboot-devel
Released: 26th May 2017
Download: openqmail-latest         
Checksum: sha256sum

The boot scripts will be discussed on the openqmail mailing list.

The common use case to run *qmail is under daemontools. eQmail refuses to do so for several reasons which are outside the scope here.

Install

$ make
$ make install

Now files are installed in  etc/bootctrl/  - beware of the relative path - and provides a good starting point for

Configuration

Change into folder  etc/bootctrl/  and do

$ ln -s tcprules-default.cdb tcprules-smtp.cdb
$ ln -s qmail-tcpd qmail-smtp.rc

As the common place for init scripts is  /etc/init.d/  do

$ cd /etc/init.d
$ ln -s /usr/local/qmail/etc/eqmaild qmaild
$ cd $OLDPWD
$ /etc/init.d/eqmaild start
Starting qmail-send ...           OK
Starting qmail-smtp ...           OK

Now eQmail should run at localhost and port 25. Test it:

$ telnet localhost 25
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 <hostname> ESMTP
quit
221 <hostname>
Connection closed by foreign host.
$

If until here all works fine, lets start another service listen on submission port. As you maybe have realized already there is a file  qmail-subm.env . More detailled explanation will be follow below. At the moment it is important to know that this file is used to define the port for submission service (default: 587).

$ ln -s tcprules-default.cdb tcprules-subm.cdb
$ ln -s qmail-tcpd qmail-subm.rc
$ /etc/init.d/qmaild restart
Stopping qmail-send ...           OK
Starting qmail-send ...           OK
Stopping qmail-subm ...         FAILED     --> logic ;-)
Starting qmail-subm ...           OK

Test it with  openssl s_client -connect 127.0.0.1:587 . This works similar with any other service: qmail-qmtp or smtps.

To give a bit more clarification:

  •  eqmaild  is a simple wrapper which handles files with suffix  .rc  in in good old UNIX tradition of boot scripts with parameters  start | stop | restart | status .
  •  qmail-init.rc  handles the heart of *qmail:  qmail-send . Fortunately there is no further configuration required.
  •  qmail-tcpd  handles different services to listen on network through symbolic links

Lets go a bit more in detail with

qmail-tcpd

 qmail-tcpd  executes  qmail-tcpsrv  - which itself is a tcpserver. Refer to qmail-tcpsrv.1 and tcprules.1 to learn more about tcpserver. There are 3 files required to start a service. Lets use the submission service:

  • a boot script qmail-subm.rc - usually a symbolic link  qmail-tcpd –> qmail-subm.rc 
  • a tcprules database tcprules-subm.cdb
  • a config/environment file qmail-subm.env *

The red marked part is the link between the files, means  qmail-subm.rc  looks for a cdb and a env file with the corresponding subm.

 qmail-tcpd  has some build in defaults to listen on port 25 and all ip addresses!

tcprules database(s)

 qmail-tcpsrv  read the its configuration (tcprules) from a cdb. A cdb will be build by  mktcprules  from a corresponding text file: tcprules-default.txt –> tcprules.default.cdb. If a link exists with the same name like a text file it will be replaced by the new cdb.

If different services using the same rules set, a symbolic link can be used. Thus there are no duplicate rule sets to maintain. An alternative cdb with independant naming conventions can be defined in the env file (see below).

env file

Simple make a copy of an existing one if an env file for a service doesn't exists:

$ cp qmail-subm.env qmail-smtp.env

After changes the related services have to be restarted.

The first section will be used to set/overwrite basic options. The most common requirement to have an env file is to define a port for a service. To override port 25 (default) do

PORT=587

Define another tcprules cdb

RULES=/etc/tcprules/tcp.smtp.cdb

In section Extended Startup Options you can configure plugins which will be executed before and/or after  qmail-smtpd . Typical ones are spamdyke as PRE plugin or tool for authentication as POST plugins. It is allowed to define additional vars and combine them. The boot script uses PRESMTPD and POSTSMTPD only.

The section Environment Vars lets you define - what surprise - environment vars. They have to be defined in format of  setenv :

setenv NORESULT 1

This for example suppress the output of OK/FAILED of the boot script (useful for better system integration).

Beware that  setenv  doesn't require a '=' (equal sign)! Surround values of env vars with quotation marks if they include spaces!

Last modified: 2019/04/09 16:17

Page Tools