You are currently not logged in! Enter your authentication credentials below to log in. You need to have cookies enabled to log in.
(last modified for qpsmptd-0.40-0.2.noarch.rpm, which contains 0.40rc1)
First, the RPMs are in an apt repository, so the most convenient way is with a tool which can read apt repositories and automatically resolve dependencies.
If you are running RHEL, you can use up2date by adding the following line to /etc/sysconfig/rhn/sources
:
apt hjp http://www.hjp.at apt/redhat qpsmtpd
Otherwise you can install apt4rpm (e.g., from http://dag.wieers.com/home-made/apt/ or http://apt.freshrpms.net/), then add the following sources to it:
rpm http://www.hjp.at/apt redhat qpsmtpd rpm-src http://www.hjp.at/apt redhat qpsmtpd
and then install the packages with
apt-get install qpsmtpd ...
If you are missing some modules, you can probably find them at rpmforge. Just add their repository to the sources file.
Alternatively, you can download the RPMs from http://www.hjp.at/apt/redhat/RPMS.qpsmtpd/ (and the source RPMs from http://www.hjp.at/apt/redhat/SRPMS.qpsmtpd/) and install them locally with rpm
.
The packages have been made in a way to minimize dependencies on packages which are not available on “standard” Red Hat systems. Therefore qpsmtpd-apache has been split off into its own package, and qpsmtpd includes an init.d-style startup script for forkserver and does not need daemontools. Also for the sake of this tutorial I am going to assume that you are using postfix.
In addition to the base package you probably want at least qpsmtpd-plugins-openfusion
or qpsmtpd-plugin-aliases
and qpsmtpd-plugin-rcpt_accept
, so you can reject mails to non-local recipients.
After installing the rpms, you have to edit /etc/sysconfig/qpsmtpd-forkserver
to make forkserver listen on some other interface than localhost. You can simply remove the -l option to listen to all interfaces or you can explicitely list all interfaces that forkserver should listen on by repeating -l several times. For example, you may want to process only mails incoming from the internet with qpsmtpd, but pass mails from your own users directly to postfix.
Of course you will also have to make sure that postfix doesn't listen on the same interfaces as qpsmtpd by editing inet_interfaces
in /etc/postfix/main.cf
or removing the smtp
line from /etc/postfix/master.cf
altogether.
Next you will have to enable at least one of the queuing plugins in /etc/qpsmtpd/plugins
. If you are using postfix or qmail, the choice should be clear. If you are running some other MTA (e.g. sendmail), you can use queue/smtp-forward
, but be warned that this plugin handles errors rather badly.
Finally, you should create a database of locally accepted recipients. There are a gazillion plugins (: provide a list) to get such a database from lots of different sources, unfortunately none of them is in the base package. I prefer the aliases plugins, maybe only because I have written them myself
. To use them, you need to install
qpsmtpd-plugin-aliases
and qpsmtpd-plugin-rcpt_accept
:
apt-get install qpsmtpd-plugin-aliases qpsmtpd-plugin-rcpt_accept
Then add the following lines to /etc/qpsmtpd/plugins
:
# this plugin initializes the note "recipient_options" and therefore # has to run before all other "rcpt" plugins which access this note. aliases_check # this plugin needs to run after all other "rcpt" plugins rcpt_accept # Rewrite recipients just before queuing. aliases_rewrite
and create a simple text file /etc/qpsmtpd/aliases
with entries like these:
postmaster@,domain.example: me@thishost.example user1,firstname1.lastname1@domain.example: user1@thishost.example user2,firstname2.lastname2@domain.example: user2@some.other.host.example list@domain.example: user1@domain.example, user2@domain.example, user3@other-domain.example
This causes the aliases plugin to accept mails to <postmaster>, <postmaster@domain.example>, <user1@domain.example>, <firstname1.lastname1@domain.example>, etc. and deliver them to the addresses on the right side of the colon. The mail-addresses are expanded recursively, if an address expands to itself, it passed to the queuing plugin unaltered. See the man page for a detailed description.
Now that you have a basic configuration, you should test it.
Start qpsmtpd-forkserver:
/etc/init.d/qpsmtpd-forkserver start
In the following examples, we assume that your host is called mx.example and that you have the aliases file from the the previous section. Of course you have to use your real hostname and your addresses.
First test if delivery to an existing address works:
% telnet mx.example smtp Trying 10.1.2.3... Connected to mx.example. Escape character is '^]'. 220 mx.example ESMTP qpsmtpd 0.31.1 ready; send us your mail, but not your spam. ehlo thishost.example 250-mx.example Hi thishost.example [10.3.4.5] 250-PIPELINING 250 8BITMIME mail from:<> 250 <>, sender OK - how exciting to get mail from you! rcpt to:<user1@domain.example> 250 <user1@domain.example>, recipient ok 354 go ahead Subject: test . 250 Queued! (Queue-Id: 4FE94FC2F) quit 221 mx.example closing connection. Have a wonderful day.
If telnet cannot connect, qpsmtpd either didn't start or listen to the correct address.
If you get an error in response to the RCPT command, there is probably a problem with the aliases plugin.
If you get an error after the final dot of the email, you probably didn't configure a queuing plugin.
You can find the log file in /var/log/qpsmtpd. By default it is very detailed.
If it looks ok so far, you should also check if the mail was delivered to the correct mailbox.
Then check if non-existing addresses are rejected:
% telnet mx.example smtp Trying 10.1.2.3... Connected to mx.example. Escape character is '^]'. 220 mx.example ESMTP qpsmtpd 0.31.1 ready; send us your mail, but not your spam. ehlo thishost.example 250-mx.example Hi thishost.example [10.3.4.5] 250-PIPELINING 250 8BITMIME mail from:<> 250 <>, sender OK - how exciting to get mail from you! rcpt to:<nosuchuser@domain.example> 550 no such user <nosuchuser@domain.example> quit 221 mx.example closing connection. Have a wonderful day.