| 1 |
|
| 2 |
 |
| 4 |
|
| 5 |
# Qpsmtpd - qmail perl simple mail transfer protocol daemon |
| 6 |
|
| 7 |
[Web site](http://smtpd.github.io/qpsmtpd/), [FAQ](https://github.com/smtpd/qpsmtpd/wiki/faq), [Email List](mailto:[email protected]) |
| 8 |
|
| 9 |
Qpsmtpd is an extensible SMTP engine written in Perl. See `plugins/quit_fortune` for a cute example. |
| 10 |
|
| 11 |
# License |
| 12 |
|
| 13 |
Qpsmtpd is licensed under the MIT License; see the LICENSE file for |
| 14 |
more information. |
| 15 |
|
| 16 |
# What's new? |
| 17 |
|
| 18 |
See the Changes file! :-) |
| 19 |
|
| 20 |
# Installation |
| 21 |
|
| 22 |
## Required Perl Modules |
| 23 |
|
| 24 |
* Net::DNS |
| 25 |
* MIME::Base64 |
| 26 |
* Mail::Header (part of the MailTools distribution) |
| 27 |
|
| 28 |
If your Perl is older than 5.8.0, you will also need |
| 29 |
|
| 30 |
* Data::Dumper |
| 31 |
* File::Temp |
| 32 |
* Time::HiRes |
| 33 |
|
| 34 |
The easiest way to install modules from CPAN is with the CPAN shell. |
| 35 |
Run it with |
| 36 |
|
| 37 |
perl -MCPAN -e shell |
| 38 |
|
| 39 |
## qpsmtpd installation |
| 40 |
|
| 41 |
Make a new user and a directory where you'll install qpsmtpd. I |
| 42 |
usually use "smtpd" for the user and /home/smtpd/qpsmtpd/ for the |
| 43 |
directory. |
| 44 |
|
| 45 |
Put the files there. If you install from git you can just do |
| 46 |
run the following command in the /home/smtpd/ directory. |
| 47 |
|
| 48 |
git clone git://github.com/smtpd/qpsmtpd.git |
| 49 |
|
| 50 |
Beware that the master branch might be unstable and unsuitable for anything |
| 51 |
but development, so you might want to get a specific release, for |
| 52 |
example (after running git clone): |
| 53 |
|
| 54 |
git checkout -b local_branch v0.93 |
| 55 |
|
| 56 |
chmod o+t ~smtpd/qpsmtpd/ (or whatever directory you installed qpsmtpd |
| 57 |
in) to make supervise start the log process. |
| 58 |
|
| 59 |
Edit the file config/IP and put the ip address you want to use for |
| 60 |
qpsmtpd on the first line (or use 0 to bind to all interfaces). |
| 61 |
|
| 62 |
If you use the supervise tools, then you are practically done! |
| 63 |
Just symlink /home/smtpd/qpsmtpd into your /services (or /var/services |
| 64 |
or /var/svscan or whatever) directory. Remember to shutdown |
| 65 |
qmail-smtpd if you are replacing it with qpsmtpd. |
| 66 |
|
| 67 |
If you don't use supervise, then you need to run the ./run script in |
| 68 |
some other way. |
| 69 |
|
| 70 |
The smtpd user needs write access to ~smtpd/qpsmtpd/tmp/ but should |
| 71 |
not need to write anywhere else. This directory can be configured |
| 72 |
with the `spool_dir` configuration and permissions can be set with |
| 73 |
`spool_perms`. |
| 74 |
|
| 75 |
As of version 0.25 the distributed ./run script runs tcpserver with |
| 76 |
the -R flag to disable identd lookups. Remove the -R flag if that's |
| 77 |
not what you want. |
| 78 |
|
| 79 |
|
| 80 |
# Configuration |
| 81 |
|
| 82 |
Configuration files can go into either /var/qmail/control or into the |
| 83 |
config subdirectory of the qpsmtpd installation. Configuration should |
| 84 |
be compatible with qmail-smtpd making qpsmtpd a drop-in replacement. |
| 85 |
|
| 86 |
If qmail is installed in a nonstandard location you should set the |
| 87 |
$QMAIL environment variable to that location in your "./run" file. |
| 88 |
|
| 89 |
If there is anything missing, then please send a patch (or just |
| 90 |
information about what's missing) to the mailinglist or a PR to github. |
| 91 |
|
| 92 |
|
| 93 |
# Better Performance |
| 94 |
|
| 95 |
For better performance we recommend using "qpsmtpd-forkserver" or |
| 96 |
running qpsmtpd under Apache 2.x. If you need extremely high |
| 97 |
concurrency and all your plugins are compatible, you might want to try |
| 98 |
the "qpsmtpd-async" model. |
| 99 |
|
| 100 |
# Plugins |
| 101 |
|
| 102 |
The qpsmtpd core only implements the SMTP protocol. No useful |
| 103 |
function can be done by qpsmtpd without loading plugins. |
| 104 |
|
| 105 |
Plugins are loaded on startup where each of them register their |
| 106 |
interest in various "hooks" provided by the qpsmtpd core engine. |
| 107 |
|
| 108 |
At least one plugin MUST allow or deny the RCPT command to enable |
| 109 |
receiving mail. The `rcpt_ok` is one basic plugin that does |
| 110 |
this. Other plugins provide extra functionality related to this; for |
| 111 |
example the `resolvable_fromhost` plugin described above. |
| 112 |
|
| 113 |
|
| 114 |
# Configuration files |
| 115 |
|
| 116 |
All the files used by qmail-smtpd should be supported; so see the man |
| 117 |
page for qmail-smtpd. Extra files used by qpsmtpd include: |
| 118 |
|
| 119 |
## plugins |
| 120 |
|
| 121 |
List of plugins, one per line, to be loaded in the order they |
| 122 |
appear in the file. Plugins are in the plugins directory (or in |
| 123 |
a subdirectory of there). |
| 124 |
|
| 125 |
|
| 126 |
## rhsbl_zones |
| 127 |
|
| 128 |
Right hand side blocking lists, one per line. For example: |
| 129 |
|
| 130 |
dsn.rfc-ignorant.org does not accept bounces - http://www.rfc-ignorant.org/ |
| 131 |
|
| 132 |
See http://www.rfc-ignorant.org/ for more examples. |
| 133 |
|
| 134 |
|
| 135 |
## `dnsbl_zones` |
| 136 |
|
| 137 |
Normal ip based DNS blocking lists ("RBLs"). For example: |
| 138 |
|
| 139 |
relays.ordb.org |
| 140 |
spamsources.fabel.dk |
| 141 |
|
| 142 |
|
| 143 |
## `spool_dir` |
| 144 |
|
| 145 |
If this file contains a directory, it will be the spool directory |
| 146 |
smtpd uses during the data transactions. If this file doesn't exist, it |
| 147 |
will default to use $ENV{HOME}/tmp/. This directory should be set with |
| 148 |
a mode of 700 and owned by the smtpd user. |
| 149 |
|
| 150 |
## `spool_perms` |
| 151 |
|
| 152 |
The default spool permissions are 0700. If you need some other value, |
| 153 |
chmod the directory and set it's octal value in `config/spool_perms`. |
| 154 |
|
| 155 |
## `tls_before_auth` |
| 156 |
|
| 157 |
If this file contains anything except a 0 on the first noncomment line, then |
| 158 |
AUTH will not be offered unless TLS/SSL are in place, either with STARTTLS, |
| 159 |
or SMTP-SSL on port 465. |
| 160 |
|
| 161 |
## everything (?) that qmail-smtpd supports. |
| 162 |
|
| 163 |
In my test qpsmtpd installation I have a "config/me" file containing |
| 164 |
the hostname I use for testing qpsmtpd (so it doesn't introduce itself |
| 165 |
with the normal name of the server). |
| 166 |
|
| 167 |
|
| 168 |
# Problems |
| 169 |
|
| 170 |
In case of problems, always check the logfile first. |
| 171 |
|
| 172 |
By default, qpsmtpd logs to log/main/current. Qpsmtpd can log a lot of |
| 173 |
debug information. You can get more or less by adjusting the number in |
| 174 |
config/loglevel. Between 1 and 3 should give you a little. Setting it |
| 175 |
to 10 or higher will get lots of information in the logs. |
| 176 |
|
| 177 |
If the logfile doesn't give away the problem, then post to the |
| 178 |
mailinglist (subscription instructions above). If possible, put |
| 179 |
the logfile on a webserver and include a reference to it in the mail. |
| 180 |
|