spamdyke Documentation
This file is updated with each version of spamdyke to reflect the latest features and behavior. If you need documentation for an older version, each version's README file is included in the download package for that version.
This document applies to spamdyke version 4.0.10.
- About spamdyke
- Support
- How spamdyke works: When a message is not blocked
- How spamdyke works: When a message is blocked
- Usage
- Configuration Files
- Configuration Directories
- Configuration Tests
- Log Messages
- SMTP Error Codes
- Logging All Data
- Permissions
- DNS Queries
- Filter Levels
- TLS
- SMTP AUTH
- Relaying
- Reverse DNS
- Blacklists
- DNS RBLs
- DNS RHSBLs
- Whitelists
- Rejecting Senders and Recipients
- DNS Whitelists
- Whitelisting Senders and Recipients
- Graylisting / Greylisting
- Earlytalkers
- Limiting Numbers of Recipients
- Timeouts
- Extra Utilities
Other Documentation
- The following additional documents are available:
- Installation instructions: INSTALL.txt
- Upgrading instructions: UPGRADING.txt
- Frequently Asked Questions: FAQ.html
- Change log: Changelog.txt
- To-do list: TODO.txt
- Upgrading instructions: UPGRADING.txt
About spamdyke
help
version
spamdyke is a filter for monitoring and intercepting incoming SMTP connections to a qmail server. It acts as a transparent middleman, observing the conversation without interference unless it sees something it should block. Because it can silently monitor, it can also log mail traffic in several different ways.
spamdyke is ©2008 Sam Clippinger, samc (at) silence (dot) org. It is distributed under the GNU General Public License (version 2 only) from http://www.spamdyke.org/
The --help
command line option will give a brief summary of the
available command line options. The --version
command line option
will give just the version and copyright statement.
Support
spamdyke support is available from the spamdyke-users mailing list: www.spamdyke.org/mailman/listinfo/spamdyke-users.
The mailing list archives are searchable thanks to mail-archive.com: www.mail-archive.com/spamdyke-users@spamdyke.org.
All of the spamdyke documentation and downloadable files are available from the spamdyke website: www.spamdyke.org.If all else fails, email the author directly at samc (at) silence (dot) org.
How spamdyke works: When a message is not blocked
spamdyke works by acting as a middleman between qmail and the network (in Unix terms, it's a pipe). When no spamdyke filters are triggered and a message is delivered normally, spamdyke silently passes data in both directions. As the SMTP conversation takes place, spamdyke collects a few pieces of data (e.g. the sender and recipient addresses) so they can be logged.
spamdyke does modify the incoming message in one way. The SMTP protocol requires the remote sender to end every line with a two character terminator -- a carriage return and a line feed. Unlike most other mail servers, qmail chooses to strictly enforce this requirement. If a remote sender uses only a line feed to end a line (a typical and easy mistake to make), qmail will reject the message:
451 See http://pobox.com/~djb/docs/smtplf.html.
How spamdyke works: When a message is blocked
spamdyke's filters are described in detail below. When one of them is triggered, spamdyke moves in to block the incoming message.
First, it considers the enabled filters and waits until there is no way the client can avoid a rejection. For example, if authentication could take place but has not done so, spamdyke will wait to see if the remote sender authenticates. Authenticated or whitelisted connections are never filtered.
Next, once spamdyke is certain the message should be filtered, it cuts the connection between the remote sender and qmail. In the background, spamdyke closes the connection to qmail, so qmail will exit normally, believing the remote sender disconnected.
spamdyke continues sending responses to the remote server, just as qmail would have. Once the remote sender has identified the sender and recipient, spamdyke sends an error code and refuses to accept the message. The remote server disconnects, never knowing that spamdyke hijacked the conversation. spamdyke, meanwhile, uses the sender and recipient information it gathered to construct its log messages.
Usage
spamdyke's behavior is controlled through options given on the command line or in configuration files (or both).
On the command line, long options should be prefixed
with two hyphens (--
). Some options have short versions, which
should be prefixed with one hyphen (-
).
In a configuration file, only the long versions are valid and an equals sign must separate the value from the option. See Configuration Files for details.
For example, consider the max-recipients
option, which restricts the
maximum number of recipients per message. On the command line, limiting the number
of recipients to 5 might look like this:
spamdyke --max-recipients 5 ...
spamdyke -a 5 ...
max-recipients=5
If the option's value contains spaces, it should be surrounded by quotes on the command line.
For example, consider the rejection-text-ip-blacklist
option, which changes
the error message spamdyke sends if the remote server's IP address is blacklisted.
On the command line, changing the message might look like this:
spamdyke --rejection-text-ip-blacklist "Go away spammer" ...
rejection-text-ip-blacklist=Go away spammer
After all options are given, spamdyke expects the rest of its command line to contain the qmail command. For example:
spamdyke -a 5 /var/qmail/bin/qmail-smtpd
ERROR: Missing qmail-smtpd command
--
) between the end of spamdyke's options and the qmail
command. For example:
spamdyke -a 5 -- /var/qmail/bin/qmail-smtpd
The following options are only valid on the command line:
Long Version | Short Version | Parameter | Description |
config-test |
Tests the configuration as much as possible and reports any errors that can be discovered without actually accepting an incoming message.
Use this option with all other options that are given during normal operation. To check file permissions properly, use the run-as-user option.
See Configuration Tests for details. |
||
config-test-smtpauth-password |
PASSWORD |
While testing the configuration with config-test , run the commands given with
smtp-auth-command to test authentication
processing. Use PASSWORD as the authentication password. This option has no
effect unless config-test , config-test-smtpauth-username and
smtp-auth-command are given.
If config-test-smtpauth-password is given multiple times, spamdyke will use the last value it finds.
If config-test-smtpauth-password is not given, spamdyke will not test the authentication
command(s).
See Configuration Tests for details. |
|
config-test-smtpauth-username |
USERNAME |
While testing the configuration with config-test , run the commands given with
smtp-auth-command to test authentication
processing. Use USERNAME as the authentication username. This option has no
effect unless config-test , config-test-smtpauth-password and
smtp-auth-command are given.
If config-test-smtpauth-username is given multiple times, spamdyke will use the last value it finds.
If config-test-smtpauth-username is not given, spamdyke will not test the authentication
command(s).
See Configuration Tests for details. |
|
help |
h |
Displays a summary of spamdyke's options, then exits. | |
version |
v |
Displays the spamdyke version and copyright statement, then exits. |
The following options are valid on the command line and in configuration files. Some options are not valid in files within configuration directories; those options are noted below. See Configuration Directories for details.
Long Version |
Short Version
(command line only) |
Parameter | Description |
access-file |
FILE |
Use FILE to determine if the remote host is allowed to connect and/or relay.
Only needed when using spamdyke to provide SMTP AUTH for an unpatched qmail
installation. Most often, FILE is /etc/tcp.smtp .
If access-file is given multiple times, each FILE is scanned (in the given order)
until a match is found.
If access-file is not given, spamdyke will not search any files for
relaying permission.
access-file is not valid within configuration directories.
See Relaying for details. |
|
config-dir |
DIR |
Search the directory structure starting at DIR for configuration files that
match the remote server's IP address, the remote server's rDNS name, the sender's email
address, the recipient's email address or any combination of the four criteria.
If config-dir is given multiple times, each DIR is scanned (in the given order)
until a match is found.
If config-dir is not given, spamdyke will not scan any directories for
configuration files.
config-dir is not valid within configuration directories.
See Configuration Directories for details. |
|
config-dir-search |
first , all-ip ,
all-rdns , all-sender or all-recipient
|
Search the directory structure given by config-dir using the given
search rules.
If config-dir-search is given multiple times, the given values
are used in combination.
If config-dir-search is not given, spamdyke will use a value of first .
config-dir-search is not valid within configuration directories.
See Configuration Directories for details. |
|
config-file |
f |
FILE |
Read additional configuration options from FILE as though they were given on
the command line.
If config-file is given multiple times, each FILE is read in
the given order.
If config-file is not given, spamdyke will not read a configuration file.
See Configuration Files for details. |
connection-timeout-secs |
t |
SECS |
Forcibly disconnect after a total of SECS seconds, regardless of activity. A
value of 0 disables this feature.
If connection-timeout-secs is given multiple times, spamdyke will use the last value it finds.
If connection-timeout-secs is not given, spamdyke will not enforce a connection timeout.
connection-timeout-secs is not valid within configuration directories.
See Timeouts for details. |
dns-blacklist-entry |
x |
DNSRBL |
Check the remote server's IP address against the realtime blackhole list
DNSRBL . If it is found, the connection is rejected.
NOTE: Using more than a few DNS blacklists can cause serious performance problems.
If dns-blacklist-entry is given multiple times, spamdyke will check each given DNSRBL
for the remote server's IP address.
If dns-blacklist-entry and dns-blacklist-file are not given, spamdyke will not check any blackhole lists.
See DNS RBLs for details. |
dns-blacklist-file |
FILE |
Check the remote server's IP address against each of the realtime blackhole lists
listed in FILE . If it is found on any of the lists, the connection is rejected.
NOTE: Using more than a few DNS blacklists can cause serious performance problems.
If dns-blacklist-file is given multiple times, spamdyke will check each of the blackhole lists
listed in each of the files for the remote server's IP address until a match is found.
If dns-blacklist-entry and dns-blacklist-file are not given, spamdyke will not search any files for
blackhole lists.
See DNS RBLs for details. |
|
dns-level |
none , normal or aggressive |
none : Do not perform any DNS queries. All DNS-based filters will behave as
though no response was received from any nameserver.
normal : Send single DNS queries to one nameserver at a time and wait for
responses. This mimics the standard system resolver library's behavior.
aggressive : Send multiple DNS queries to multiple DNS servers simultaneously
to find answers as quickly as possible.
If dns-level is given multiple times, spamdyke will use the last value it finds.
If dns-level is not given, spamdyke will use a value of aggressive .
dns-level is not valid within configuration directories.
See DNS Queries for details. |
|
dns-max-retries-primary |
NUM |
Query the primary nameserver(s) NUM times before also querying the
secondary nameserver(s). If NUM is larger than the value of
dns-max-retries-total , the value of dns-max-retries-total
is used instead.
If dns-max-retries-primary is given multiple times, spamdyke will use the last value it finds.
If dns-max-retries-primary is not given, spamdyke will use a value of 1 .
dns-max-retries-primary is not valid within configuration directories.
See DNS Queries for details. |
|
dns-max-retries-total |
NUM |
Send a maximum of NUM queries to any nameserver(s), primary or secondary.
If dns-max-retries-total is given multiple times, spamdyke will use the last value it finds.
If dns-max-retries-total is not given, spamdyke will use a value of 3 .
dns-max-retries-total is not valid within configuration directories.
See DNS Queries for details. |
|
dns-server-ip |
IPADDRESS[:PORT] |
Use IPADDRESS as a secondary nameserver. If PORT is given, DNS
queries will be send to that port number.
If dns-server-ip is given multiple times, each of the given nameservers will
be queried.
If dns-server-ip and dns-server-ip-primary are not given, spamdyke
will read the list of nameservers from /etc/resolv.conf .
dns-server-ip is not valid within configuration directories.
See DNS Queries for details. |
|
dns-server-ip-primary |
IPADDRESS[:PORT] |
Use IPADDRESS as a primary nameserver. If PORT is given, DNS
queries will be send to that port number.
If dns-server-ip-primary is given multiple times, each of the given nameservers will
be queried before any secondary nameservers are queried.
If dns-server-ip and dns-server-ip-primary are not given, spamdyke
will read the list of nameservers from /etc/resolv.conf .
dns-server-ip-primary is not valid within configuration directories.
See DNS Queries for details. |
|
dns-timeout-secs |
SECS |
Do not take more than a total of SECS seconds to perform a DNS query, including all
of the retries.
If dns-timeout-secs is given multiple times, spamdyke will use the last value it finds.
If dns-timeout-secs is not given, spamdyke will use the value 30 .
dns-timeout-secs is not valid within configuration directories.
See DNS Queries for details. |
|
dns-whitelist-entry |
DNSWHITELIST |
Check the remote server's IP address against the DNS whitelist DNSWHITELIST
(essentially a DNSRBL that contains whitelisted IPs). If it is found, all
filters are bypassed.
NOTE: Using more than a few DNS whitelists can cause serious performance problems.
If dns-whitelist-entry is given multiple times, spamdyke will check each given
DNSWHITELIST for the remote server's IP address.
If dns-whitelist-entry and dns-whitelist-file are not given,
spamdyke will not check any DNS whitelists.
See DNS Whitelists for details. |
|
dns-whitelist-file |
FILE |
Check the remote server's IP address against each of the DNS whitelists
(essentially a DNSRBL that contains whitelisted IPs) listed in FILE .
If it is found on any of the lists, all filters are bypassed.
NOTE: Using more than a few DNS whitelists can cause serious performance problems.
If dns-whitelist-file is given multiple times, spamdyke will check each
DNS whitelist listed in each given FILE for the remote server's IP address.
If dns-whitelist-entry and dns-whitelist-file are not given,
spamdyke will not check any DNS whitelists.
See DNS Whitelists for details. |
|
filter-level |
allow-all , normal , require-auth or reject-all |
allow-all : Allow all connections to bypass all filters, effectively whitelisting everything.
normal : Apply enabled filters according to the options on the command line and in the configuration file(s).
require-auth : Reject all connections that haven't authenticated using SMTP AUTH.
reject-all : Reject all connections, regardless of authentication or whitelists.
If filter-level is given multiple times, spamdyke will use the last value it finds.
If filter-level is not given, spamdyke will use a value of normal .
See Filter Levels for details. |
|
full-log-dir |
L |
DIR |
Log all SMTP data to files in DIR . This is handy for troubleshooting delivery
problems but it is not meant to be used long-term. This option imposes a performance
penalty!
If full-log-dir is given multiple times, spamdyke will use the last value it finds.
If full-log-dir is not given, spamdyke will not log all SMTP data.
full-log-dir is not valid within configuration directories.
See Logging All Data for details. |
graylist-dir |
g |
DIR |
Search for and create graylist files in directory structures within DIR .
This option has no effect unless graylist-level is given.
If graylist-dir is given multiple times, spamdyke will search each given directory in the given order for the
recipient's domain directory and stop when it finds the first one.
If graylist-dir is not given, spamdyke will not graylist connections.
See Graylisting / Greylisting for details. |
graylist-exception-ip-entry |
IPADDRESS |
Reverse the behavior of the graylist filter for remote servers whose IP
addresses match IPADDRESS . This option has no effect
unless graylist-level and graylist-dir are given.
If graylist-exception-ip-entry is given multiple times, spamdyke will match the remote server's IP address
against given IPADDRESS .
If graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry and
graylist-exception-rdns-file are not given, spamdyke will graylist each connection according to the
value of graylist-level .
See Graylisting / Greylisting for details. |
|
graylist-exception-ip-file |
FILE |
Reverse the behavior of the graylist filter for remote servers whose IP
addresses match entries in FILE . This option provides better
performance than graylist-exception-ip-entry for more than a few
entries. This option has no effect
unless graylist-level and graylist-dir are given.
If graylist-exception-ip-file is given multiple times, spamdyke will match the remote server's IP address
against each entry in each given FILE .
If graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry and
graylist-exception-rdns-file are not given, spamdyke will graylist each connection according to the
value of graylist-level .
See Graylisting / Greylisting for details. |
|
graylist-exception-rdns-dir |
DIR |
Reverse the behavior of the graylist filter for remote servers whose rDNS names
match files in DIR . This option provides much better performance
than graylist-exception-rdns-file for large numbers of entries.
This option has no effect
unless graylist-level and graylist-dir are given.
If graylist-exception-rdns-dir is given multiple times, spamdyke will
search each DIR for files that match the remote server's rDNS name.
If graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry and
graylist-exception-rdns-file are not given, spamdyke will graylist each connection according to the
value of graylist-level .
See Graylisting / Greylisting for details. |
|
graylist-exception-rdns-entry |
RDNSNAME |
Reverse the behavior of the graylist filter for remote servers whose rDNS names
match RDNSNAME . This option has no effect
unless graylist-level and graylist-dir are given.
If graylist-exception-rdns-entry is given multiple times, spamdyke will
match the remote server's rDNS name against each given RDNSNAME .
If graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry and
graylist-exception-rdns-file are not given, spamdyke will graylist each connection according to the
value of graylist-level .
See Graylisting / Greylisting for details. |
|
graylist-exception-rdns-file |
FILE |
Reverse the behavior of the graylist filter for remote servers whose rDNS names
match entries in FILE . This option provides better performance
than graylist-exception-rdns-entry for more than a few entries.
This option has no effect
unless graylist-level and graylist-dir are given.
If graylist-exception-rdns-file is given multiple times, spamdyke will
match the remote server's rDNS name against each entry in each given FILE .
If graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry and
graylist-exception-rdns-file are not given, spamdyke will graylist each connection according to the
value of graylist-level .
See Graylisting / Greylisting for details. |
|
graylist-level |
none ,
always ,
always-create-dir ,
only or
only-create-dir |
none : Do not graylist any connections.
always : Graylist all connections that have an existing recipient domain directory,
except those that match one of the options
graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry or
graylist-exception-rdns-file .
If local-domains-entry or local-domains-file is not given,
this value has no effect.
always-create-dir : Graylist all connections
except those that match one of the options
graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry or
graylist-exception-rdns-file .
If the recipient's domain directory does not exist, create it.
If local-domains-entry or local-domains-file is not given,
this value has no effect.
only : Do not graylist any connections unless the recipient's domain directory exists and
the connection matches one of the options
graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry or
graylist-exception-rdns-file .
If local-domains-entry or local-domains-file is not given,
this value has no effect.
only-create-dir : Do not graylist any connections unless
it matches one of the options
graylist-exception-ip-entry ,
graylist-exception-ip-file ,
graylist-exception-rdns-dir ,
graylist-exception-rdns-entry or
graylist-exception-rdns-file .
If the recipient's domain directory does not exist, create it.
If local-domains-entry or local-domains-file is not given,
this value has no effect.
If graylist-level is given multiple times, spamdyke will use the last value it finds.
If graylist-level is not given, spamdyke will use a value of none .
See Graylisting / Greylisting for details. |
|
graylist-max-secs |
M |
SECS |
Invalidate graylist entries after they are SECS seconds old.
A value of 0 prevents graylist entries from ever expiring.
Requires graylist-dir and graylist-level .
If graylist-max-secs is given multiple times, spamdyke will use the last value it finds.
If graylist-max-secs is not given, spamdyke will use a value of 0 .
See Graylisting / Greylisting for details. |
graylist-min-secs |
m |
SECS |
Require a graylist entry to be present for SECS seconds before allowing
incoming mail.
A value of 0 will not require any delay; mail will be accepted in any connection
immediately after the initial graylisting.
Requires graylist-dir and graylist-level .
If graylist-min-secs is given multiple times, spamdyke will use the last value it finds.
If graylist-min-secs is not given, spamdyke will use a value of 0 .
See Graylisting / Greylisting for details. |
greeting-delay-secs |
e |
SECS |
Delay sending the SMTP greeting banner SECS seconds to see if the remote server
begins sending data early. If it does, the connection is rejected.
If greeting-delay-secs is given multiple times, spamdyke will use the last value it finds.
If greeting-delay-secs is not given, spamdyke will use a value of 0 .
See Earlytalkers for details. |
hostname |
NAME |
Use NAME as the fully qualified domain name of this host. This value is only
used to create an encrypted challenge during SMTP AUTH challenge-response protocols.
If hostname is given multiple times, spamdyke will use the last value it finds.
If hostname , hostname-command and hostname-file are
not given, spamdyke will search for the host's name in the environment or will use a default name.
hostname is not valid within configuration directories.
See SMTP AUTH for details. |
|
hostname-command |
COMMAND |
Read the fully qualified domain name of this host from the output of COMMAND .
Most often, this value is /bin/hostname -f . This value is only used to create
an encrypted challenge during SMTP AUTH challenge-response protocols. This option is
ignored if hostname or hostname-file are given.
If hostname-command is given multiple times, spamdyke will use the last value it finds.
If hostname , hostname-command and hostname-file are
not given, spamdyke will search for the host's name in the environment or will use a default name.
hostname-command is not valid within configuration directories.
See SMTP AUTH for details. |
|
hostname-file |
FILE |
Read the fully qualified domain name of this host from the first line of FILE .
This value is only used to create an encrypted challenge during SMTP AUTH
challenge-response protocols. This option is ignored if hostname is given.
If hostname-file is given multiple times, spamdyke will use the last value it finds.
If hostname , hostname-command and hostname-file are
not given, spamdyke will search for the host's name in the environment or will use a default name.
hostname-file is not valid within configuration directories.
See SMTP AUTH for details. |
|
idle-timeout-secs |
T |
SECS |
Forcibly disconnect after SECS seconds of inactivity. A value of 0 disables
this feature.
If idle-timeout-secs is given multiple times, spamdyke will use the last value it finds.
If idle-timeout-secs is not given, spamdyke will use a value of 0 .
idle-timeout-secs is not valid within configuration directories.
See Timeouts for details. |
ip-blacklist-entry |
IPADDRESS |
Reject the connection if the remote server's IP address matches IPADDRESS .
If ip-blacklist-entry is given multiple times, spamdyke will check the remote server's IP address
against each given IPADDRESS .
If ip-blacklist-entry and ip-blacklist-file are not given, spamdyke will not attempt
to match the remote server's IP address against blacklist entries.
See Blacklists for details. |
|
ip-blacklist-file |
B |
FILE |
Reject the connection if the remote server's IP address matches an entry in
FILE . This option provides better performance than ip-blacklist-entry
for more than a few entries.
If ip-blacklist-file is given multiple times, spamdyke will check the remote server's IP address
against each entry in each given FILE .
If ip-blacklist-entry and ip-blacklist-file are not given, spamdyke will not attempt
to match the remote server's IP address against blacklist entries.
See Blacklists for details. |
ip-in-rdns-keyword-blacklist-entry |
KEYWORD |
Search the remote server's rDNS name for its IP address and KEYWORD .
If both are found, reject the connection.
If ip-in-rdns-keyword-blacklist-entry is given multiple times, spamdyke will
search the remote server's rDNS name for its IP address and each given KEYWORD .
If ip-in-rdns-keyword-blacklist-entry and ip-in-rdns-keyword-blacklist-file
are not given, spamdyke will not reject connections because the remote server's rDNS name contains
its IP address.
See Reverse DNS for details. |
|
ip-in-rdns-keyword-blacklist-file |
k |
FILE |
Search the remote server's rDNS name for its IP address and a keyword listed in FILE .
If both are found, reject the connection.
This option provides better performance than ip-in-rdns-keyword-whitelist-entry for
more than a few entries.
If ip-in-rdns-keyword-blacklist-file is given multiple times, spamdyke will
search the remote server's rDNS name for its IP address and each keyword listed in each given FILE .
If ip-in-rdns-keyword-blacklist-entry and ip-in-rdns-keyword-blacklist-file
are not given, spamdyke will not reject connections because the remote server's rDNS name contains
its IP address.
See Reverse DNS for details. |
ip-in-rdns-keyword-whitelist-entry |
KEYWORD |
Search the remote server's rDNS name for its IP address and KEYWORD .
If both are found, bypass all filters.
If ip-in-rdns-keyword-whitelist-entry is given multiple times, spamdyke will
search the remote server's rDNS name for its IP address and each given KEYWORD .
If ip-in-rdns-keyword-whitelist-entry and ip-in-rdns-keyword-whitelist-file
are not given, spamdyke will not bypass all filters because the remote server's rDNS name contains
its IP address.
See Reverse DNS for details. |
|
ip-in-rdns-keyword-whitelist-file |
FILE |
Search the remote server's rDNS name for its IP address and a keyword listed in FILE .
If both are found, bypass all filters.
This option provides better performance than ip-in-rdns-keyword-whitelist-entry for
more than a few entries.
If ip-in-rdns-keyword-whitelist-file is given multiple times, spamdyke will
search the remote server's rDNS name for its IP address and each keyword listed in each given FILE .
If ip-in-rdns-keyword-whitelist-entry and ip-in-rdns-keyword-whitelist-file
are not given, spamdyke will not bypass all filters because the remote server's rDNS name contains
its IP address.
See Reverse DNS for details. |
|
ip-whitelist-entry |
IPADDRESS |
If the remote server's IP address matches IPADDRESS , bypass all filters.
If ip-whitelist-entry is given multiple times, spamdyke will check the remote server's
IP address against each given IPADDRESS .
If ip-whitelist-entry and ip-whitelist-file are not given, spamdyke will
not attempt to match the remote server's IP address against whitelist entries.
See Whitelists for details. |
|
ip-whitelist-file |
W |
FILE |
If the remote server's IP address matches an entry in FILE , bypass all filters.
This option provides better performance than ip-whitelist-entry for more than a few entries.
If ip-whitelist-file is given multiple times, spamdyke will check the remote server's
IP address against each entry in each given FILE .
If ip-whitelist-entry and ip-whitelist-file are not given, spamdyke will
not attempt to match the remote server's IP address against whitelist entries.
See Whitelists for details. |
local-domains-entry |
DOMAIN |
Treat DOMAIN as a locally hosted domain (to determine if an email address is local
or remote).
If local-domains-entry is given multiple times, spamdyke will consider each given
DOMAIN to be local.
If local-domains-entry and local-domains-file are not given, spamdyke
will disable all filters that depend on distinguishing between local and remote addresses.
local-domains-entry is not valid within configuration directories.
See Rejecting Senders and Recipients for details. |
|
local-domains-file |
d |
FILE |
Search FILE for a list of locally hosted domains (to determine if an email address
is local or remote). Most often, FILE is /var/qmail/control/rcpthosts .
If local-domains-file is given multiple times, spamdyke will consider each entry
in each given FILE to be local.
If local-domains-entry and local-domains-file are not given, spamdyke
will disable all filters that depend on distinguishing between local and remote addresses.
local-domains-file is not valid within configuration directories.
See Rejecting Senders and Recipients for details. |
log-level |
l (lowercase ell) |
none ,
error ,
info ,
verbose ,
debug or
excessive
|
none : No logging.
error : Log errors only.
info : Everything from error plus connection messages.
verbose : Everything from info plus non-critical errors such as
network errors caused by the remote host, protocol errors, config-test status messages
and child process error messages.
debug : Everything from verbose plus high-level debugging messages
to show the processing path within spamdyke.
excessive : Everything from debug plus low-level debugging messages
to show data values and small status messages within spamdyke.
If log-level is given multiple times, spamdyke will use the last value it finds.
If log-level is not given, spamdyke will use a value of error .
log-level is not valid within configuration directories.
See Log Messages for details. |
log-target |
stderr or syslog |
stderr : Send log messages to standard error (stderr).
syslog : Send log messages to the system log file via syslogd.
If log-target is given multiple times, spamdyke will use a combination of the given values.
If log-target is not given, spamdyke will use a value of syslog .
log-target is not valid within configuration directories.
See Log Messages for details. |
|
max-recipients |
a |
NUM |
Allow a maximum of NUM recipients per connection.
If max-recipients is given multiple times, spamdyke will use the last value it finds.
If max-recipients is not given, spamdyke will not limit the number of recipients.
max-recipients is not valid within configuration directories.
See Limiting Numbers of Recipients for details. |
policy-url |
u |
URL |
Append URL to the rejection message to explain why the rejection occurred.
NOTE: most servers hide rejection messages from their users and most users
don't read bounce messages. Maximum 100 characters.
If policy-url is given multiple times, spamdyke will use the last value it finds.
If policy-url is not given, spamdyke will not append a URL to the rejection message.
See SMTP Error Codes for details. |
rdns-blacklist-dir |
b |
DIR |
Reject the connection if the remote server's rDNS name matches a file in DIR .
This option provides better performance than rdns-blacklist-file for
large numbers of entries.
If rdns-blacklist-dir is given multiple times, spamdyke will search each DIR
for files that match the remote server's rDNS name.
If rdns-blacklist-dir , rdns-blacklist-entry and rdns-blacklist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against blacklist entries.
See Blacklists for details. |
rdns-blacklist-entry |
DOMAIN |
Reject the connection if the remote server's rDNS name matches DOMAIN .
If rdns-blacklist-entry is given multiple times, spamdyke will attempt to match the remote
server's rDNS name against each given DOMAIN .
If rdns-blacklist-dir , rdns-blacklist-entry and rdns-blacklist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against blacklist entries.
See Blacklists for details. |
|
rdns-blacklist-file |
FILE |
Reject the connection if the remote server's rDNS name matches an entry in FILE .
This option provides better performance than rdns-blacklist-entry for more than a few entries.
If rdns-blacklist-file is given multiple times, spamdyke will search each given FILE
for entries that match the remote server's rDNS name.
If rdns-blacklist-dir , rdns-blacklist-entry and rdns-blacklist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against blacklist entries.
See Blacklists for details. |
|
rdns-whitelist-dir |
DIR |
If the remote server's rDNS name matches a file in DIR , bypass all filters.
This option provides better performance than rdns-whitelist-file for
large numbers of entries.
If rdns-whitelist-dir is given multiple times, spamdyke will search each DIR
for files that match the remote server's rDNS name.
If rdns-whitelist-dir , rdns-whitelist-entry and rdns-whitelist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against whitelist entries.
See Whitelists for details. |
|
rdns-whitelist-entry |
DOMAIN |
If the remote server's rDNS name matches DOMAIN , bypass all filters.
If rdns-whitelist-entry is given multiple times, spamdyke will attempt to match the remote
server's rDNS name against each given DOMAIN .
If rdns-whitelist-dir , rdns-whitelist-entry and rdns-whitelist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against whitelist entries.
See Whitelists for details. |
|
rdns-whitelist-file |
w |
FILE |
If the remote server's rDNS name matches an entry in FILE , bypass all filters.
This option provides better performance than rdns-whitelist-entry for more than a few entries.
If rdns-whitelist-file is given multiple times, spamdyke will search each given FILE
for entries that match the remote server's rDNS name.
If rdns-whitelist-dir , rdns-whitelist-entry and rdns-whitelist-file
are not given, spamdyke will not attempt to match the remote server's rDNS name against whitelist entries.
See Whitelists for details. |
recipient-blacklist-entry |
ADDRESS |
Reject any recipient addresses that match ADDRESS .
If recipient-blacklist-entry is given multiple times, spamdyke will attempt to match
each recipient address against each given ADDRESS .
If recipient-blacklist-entry and recipient-blacklist-file are not given,
spamdyke will not attempt to match recipient addresses against blacklist entries.
See Rejecting Senders and Recipients for details. |
|
recipient-blacklist-file |
S |
FILE |
Reject any recipient addresses that match entries in FILE .
This option provides better performance than recipient-blacklist-entry for
more than a few entries.
If recipient-blacklist-file is given multiple times, spamdyke will attempt to match
each recipient address against each entry in each given FILE .
If recipient-blacklist-entry and recipient-blacklist-file are not given,
spamdyke will not attempt to match recipient addresses against blacklist entries.
See Rejecting Senders and Recipients for details. |
recipient-whitelist-entry |
ADDRESS |
If the recipient's address matches ADDRESS , bypass all filters.
If recipient-whitelist-entry is given multiple times, spamdyke will attempt to match
each recipient address against each given ADDRESS .
If recipient-whitelist-entry and recipient-whitelist-file are not given,
spamdyke will not attempt to match recipient addresses against whitelist entries.
See Whitelisting Senders and Recipients for details. |
|
recipient-whitelist-file |
FILE |
If the recipient's email address matches an entry in FILE , bypass all filters.
This option provides better performance than recipient-whitelist-entry for
more than a few entries.
If recipient-whitelist-file is given multiple times, spamdyke will attempt to match
each recipient address against each entry in each given FILE .
If recipient-whitelist-entry and recipient-whitelist-file are not given,
spamdyke will not attempt to match recipient addresses against whitelist entries.
See Whitelisting Senders and Recipients for details. |
|
reject-empty-rdns |
r |
optional:0 ,
1 ,
false ,
true ,
no or
yes
|
Reject the connection if the remote server has no rDNS name.
If reject-empty-rdns is given multiple times, spamdyke will use the last value it finds.
If reject-empty-rdns is not given, spamdyke will not reject connections with missing rDNS names.
If reject-empty-rdns is given without an argument, spamdyke will use a value of yes .
See Reverse DNS for details. |
reject-ip-in-cc-rdns |
c |
optional:0 ,
1 ,
false ,
true ,
no or
yes
|
Search the remote server's rDNS name for its IP address and a two-letter
country code. If both are found, reject the connection.
If reject-ip-in-cc-rdns is given multiple times, spamdyke will use the last value it finds.
If reject-ip-in-cc-rdns is not given, spamdyke will not reject connections from servers
whose rDNS names contain their IP address and a country code.
If reject-ip-in-cc-rdns is given without an argument, spamdyke will use a value of yes .
See Reverse DNS for details. |
reject-missing-sender-mx |
optional:0 ,
1 ,
false ,
true ,
no or
yes
|
Check the domain name of the sender's email address for a mail exchanger (an MX
or an A record). If neither are found, reject the connection. Requires
local-domains-entry or local-domains-file .
If reject-missing-sender-mx is given multiple times, spamdyke will use the last value it finds.
If reject-missing-sender-mx is not given, spamdyke will not reject connections from senders
whose email domains do not have an MX record.
If reject-missing-sender-mx is given without an argument, spamdyke will use a value of yes .
See Rejecting Senders and Recipients for details. |
|
reject-unresolvable-rdns |
R |
optional:0 ,
1 ,
false ,
true ,
no or
yes
|
Reject the connection if the remote server's rDNS name does not resolve (search
for an A record).
If reject-unresolvable-rdns is given multiple times, spamdyke will use the last value it finds.
If reject-unresolvable-rdns is not given, spamdyke will not reject connections from remote
servers whose rDNS names do not resolve.
If reject-unresolvable-rdns is given without an argument, spamdyke will use a value of yes .
See Reverse DNS for details. |
rejection-text-access-denied |
TEXT |
Send TEXT to the client as an error message if
the remote server is not allowed to send mail due to an entry in the access file.
If rejection-text-access-denied is given multiple times, spamdyke will use the last value it finds.
If rejection-text-access-denied is not given, spamdyke will use the text
Refused. Access is denied.
See SMTP Error Codes for details. |
|
rejection-text-auth-failure |
TEXT |
Send TEXT to the client as an error message if
authentication fails for any reason.
If rejection-text-auth-failure is given multiple times, spamdyke will use the last value it finds.
If rejection-text-auth-failure is not given, spamdyke will use the text
Refused. Authentication failed.
rejection-text-auth-failure is not valid within configuration directories.
See SMTP Error Codes for details. |
|
rejection-text-auth-unknown |
TEXT |
Send TEXT to the client as an error message if
the remote server attempts to authenticate using an unsupported authentication method.
This should never happen.
If rejection-text-auth-unknown is given multiple times, spamdyke will use the last value it finds.
If rejection-text-auth-unknown is not given, spamdyke will use the text
Refused. Unknown authentication method.
rejection-text-auth-unknown is not valid within configuration directories.
See SMTP Error Codes for details. |
|
rejection-text-dns-blacklist |
TEXT |
Send TEXT to the client as an error message if
the remote server's IP address is found on a DNS blacklist (RBL).
The name of the matching RBL will be appended to TEXT .
Note: this flag has no effect if the RBL returns a text message; that text will be used instead.
If rejection-text-dns-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-dns-blacklist is not given, spamdyke will use the text
Refused. Your IP address is listed in the DNS RBL at
See SMTP Error Codes for details. |
|
rejection-text-earlytalker |
TEXT |
Send TEXT to the client as an error message if
the remote server sends data before the SMTP greeting banner is displayed.
If rejection-text-earlytalker is given multiple times, spamdyke will use the last value it finds.
If rejection-text-earlytalker is not given, spamdyke will use the text
Refused. You are not following the SMTP protocol.
See SMTP Error Codes for details. |
|
rejection-text-empty-rdns |
TEXT |
Send TEXT to the client as an error message if
the remote server has no rDNS name.
If rejection-text-empty-rdns is given multiple times, spamdyke will use the last value it finds.
If rejection-text-empty-rdns is not given, spamdyke will use the text
Refused. You have no reverse DNS entry.
See SMTP Error Codes for details. |
|
rejection-text-graylist |
TEXT |
Send TEXT to the client as an error message if
the recipient address has been graylisted.
If rejection-text-graylist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-graylist is not given, spamdyke will use the text
Your address has been graylisted. Try again later.
See SMTP Error Codes for details. |
|
rejection-text-ip-blacklist |
TEXT |
Send TEXT to the client as an error message if
the remote server's IP address is found in an IP blacklist file or matches an IP blacklist entry.
If rejection-text-ip-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-ip-blacklist is not given, spamdyke will use the text
Refused. Your IP address is blacklisted.
See SMTP Error Codes for details. |
|
rejection-text-ip-in-cc-rdns |
TEXT |
Send TEXT to the client as an error message if
the remote server's rDNS name contains the remote server's IP address and ends in a two-character country code.
If rejection-text-ip-in-cc-rdns is given multiple times, spamdyke will use the last value it finds.
If rejection-text-ip-in-cc-rdns is not given, spamdyke will use the text
Refused. Your reverse DNS entry contains your IP address and a country code.
See SMTP Error Codes for details. |
|
rejection-text-ip-in-rdns-keyword-blacklist |
TEXT |
Send TEXT to the client as an error message if
the remote server's rDNS name contains the remote server's IP address and a banned keyword.
If rejection-text-ip-in-rdns-keyword-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-ip-in-rdns-keyword-blacklist is not given, spamdyke will use the text
Refused. Your reverse DNS entry contains your IP address and a banned keyword.
See SMTP Error Codes for details. |
|
rejection-text-local-recipient |
TEXT |
Send TEXT to the client as an error message if
the specified recipient does not include a domain name.
If rejection-text-local-recipient is given multiple times, spamdyke will use the last value it finds.
If rejection-text-local-recipient is not given, spamdyke will use the text
Improper recipient address. Try supplying a domain name.
See SMTP Error Codes for details. |
|
rejection-text-max-recipients |
TEXT |
Send TEXT to the client as an error message if
the remote server gives too many recipient addresses.
If rejection-text-max-recipients is given multiple times, spamdyke will use the last value it finds.
If rejection-text-max-recipients is not given, spamdyke will use the text
Too many recipients. Try the remaining addresses again later.
See SMTP Error Codes for details. |
|
rejection-text-missing-sender-mx |
TEXT |
Send TEXT to the client as an error message if
the sender's domain name does not have a DNS entry for a mail exchanger (MX).
If rejection-text-missing-sender-mx is given multiple times, spamdyke will use the last value it finds.
If rejection-text-missing-sender-mx is not given, spamdyke will use the text
Refused. The domain of your sender address has no mail exchanger (MX).
See SMTP Error Codes for details. |
|
rejection-text-rdns-blacklist |
TEXT |
Send TEXT to the client as an error message if
the remote server's rDNS name is found in a blacklist file or matches a blacklist entry.
If rejection-text-rdns-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-rdns-blacklist is not given, spamdyke will use the text
Refused. Your domain name is blacklisted.
See SMTP Error Codes for details. |
|
rejection-text-recipient-blacklist |
TEXT |
Send TEXT to the client as an error message if
the recipient address is blacklisted.
If rejection-text-recipient-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-recipient-blacklist is not given, spamdyke will use the text
Refused. Mail is not being accepted at this address.
See SMTP Error Codes for details. |
|
rejection-text-reject-all |
TEXT |
Send TEXT to the client as an error message if
all mail is being rejected.
If rejection-text-reject-all is given multiple times, spamdyke will use the last value it finds.
If rejection-text-reject-all is not given, spamdyke will use the text
Refused. Mail is not being accepted.
See SMTP Error Codes for details. |
|
rejection-text-relaying-denied |
TEXT |
Send TEXT to the client as an error message if
the recipient is not local and the remote server is not allowed relay.
If rejection-text-relaying-denied is given multiple times, spamdyke will use the last value it finds.
If rejection-text-relaying-denied is not given, spamdyke will use the text
Refused. Sending to remote addresses (relaying) is not allowed.
See SMTP Error Codes for details. |
|
rejection-text-rhs-blacklist |
TEXT |
Send TEXT to the client as an error message if
the remote server's rDNS name or the sender's domain name are found on a right-hand side blacklist (RHSBL).
The name of the matching RHSBL will be appended to TEXT .
Note: this flag has no effect if the RHSBL returns a text message; that text will be used instead.
If rejection-text-rhs-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-rhs-blacklist is not given, spamdyke will use the text
Refused. Your domain name is listed in the RHSBL at
See SMTP Error Codes for details. |
|
rejection-text-sender-blacklist |
TEXT |
Send TEXT to the client as an error message if
the sender's email address is blacklisted.
If rejection-text-sender-blacklist is given multiple times, spamdyke will use the last value it finds.
If rejection-text-sender-blacklist is not given, spamdyke will use the text
Refused. Your sender address has been blacklisted.
See SMTP Error Codes for details. |
|
rejection-text-smtp-auth-required |
TEXT |
Send TEXT to the client as an error message if
authentication is required to send email and the remote server has not authenticated.
If rejection-text-smtp-auth-required is given multiple times, spamdyke will use the last value it finds.
If rejection-text-smtp-auth-required is not given, spamdyke will use the text
Refused. Authentication is required to send mail.
See SMTP Error Codes for details. |
|
rejection-text-timeout |
TEXT |
Send TEXT to the client as an error message if
the connection times out.
If rejection-text-text-timeout is given multiple times, spamdyke will use the last value it finds.
If rejection-text-text-timeout is not given, spamdyke will use the text
Timeout. Talk faster next time.
rejection-text-timeout is not valid within configuration directories.
See SMTP Error Codes for details. |
|
rejection-text-tls-failure |
TEXT |
Send TEXT to the client as an error message if
a SSL/TLS session cannot be started with the remote server.
If rejection-text-text-tls-failure is given multiple times, spamdyke will use the last value it finds.
If rejection-text-text-tls-failure is not given, spamdyke will use the text
Failed to negotiate TLS connection.
rejection-text-tls-failure is not valid within configuration directories.
See SMTP Error Codes for details. |
|
rejection-text-unresolvable-rdns |
TEXT |
Send TEXT to the client as an error message if
the remote server's rDNS name does not resolve.
If rejection-text-unresolvable-rdns is given multiple times, spamdyke will use the last value it finds.
If rejection-text-unresolvable-rdns is not given, spamdyke will use the text
Refused. Your reverse DNS entry does not resolve.
See SMTP Error Codes for details. |
|
rejection-text-zero-recipients |
TEXT |
Send TEXT to the client as an error message if
none of the recipients given by the remote server are accepted.
If rejection-text-zero-recipients is given multiple times, spamdyke will use the last value it finds.
If rejection-text-zero-recipients is not given, spamdyke will use the text
Refused. You must specify at least one valid recipient.
rejection-text-zero-recipients is not valid within configuration directories.
See SMTP Error Codes for details. |
|
relay-level |
block-all ,
no-check ,
normal or
allow-all
|
block-all : Block all relaying attempts, even if the sender has authenticated or the access file or an environment variable should allow relaying.
Messages to local recipients will still be accepted.
Requires local-domains-entry or local-domains-file and access-file .
no-check : Do not prevent relaying; allow qmail (or another filter) to prevent relaying as appropriate.
normal : Prevent relaying unless the sender authenticates, the access file allows relaying or an environment variable allows relaying.
Requires local-domains-entry or local-domains-file and access-file .
allow-all : Allow relaying from all senders. Note: This creates an open relay and is not recommended.
If relay-level is given multiple times, spamdyke will use the last value it finds.
If relay-level is not given, spamdyke will use a value of normal .
relay-level is not valid within configuration directories.
See Relaying for details. |
|
rhs-blacklist-entry |
X |
RHSBL |
Check the remote server's rDNS name and the sender email address' domain name
against the right hand-side blackhole list RHSBL . If it is found, the connection
is rejected.
NOTE: Using more than a few RHS blacklists can cause serious performance problems.
If rhs-blacklist-entry is given multiple times, spamdyke will check each given RHSBL for the remote server's rDNS name and the sender's email address domain name.
If rhs-blacklist-entry and rhs-blacklist-file are not given, spamdyke will not check any blackhole lists
for the remote server's rDNS name and the sender's email address domain name.
See DNS RHSBLs for details. |
rhs-blacklist-file |
FILE |
Check the remote server's domain name and the sender email address' domain name
against each of the right hand-side blackhole lists listed in FILE .
If it is found on any of the lists, the connection is rejected.
NOTE: Using more than a few RHS blacklists can cause serious performance problems.
If rhs-blacklist-file is given multiple times, spamdyke will check each blackhole list listed in each given FILE for the remote server's
rDNS name and the sender's email address domain name.
If rhs-blacklist-file and rhs-blacklist-file are not given, spamdyke will not check any blackhole lists
for the remote server's rDNS name and the sender's email address domain name.
See DNS RHSBLs for details. |
|
rhs-whitelist-entry |
RHSWHITELIST |
Check the remote server's domain name and the sender email address' domain name
against the right hand-side whitelist RHSWHITELIST (essentially an RHSBL that
contains whitelisted domains). If it is found, all filters are bypassed.
NOTE: Using more than a few RHS whitelists can cause serious performance problems.
If rhs-whitelist-entry is given multiple times, spamdyke will check each given RHSWHITELIST for the remote server's rDNS name and the sender's email address domain name.
If rhs-whitelist-entry and rhs-whitelist-file are not given, spamdyke will not check any whitelists
for the remote server's rDNS name and the sender's email address domain name.
See DNS Whitelists for details. |
|
rhs-whitelist-file |
FILE |
Check the remote server's domain name and the sender email address' domain name
against each of the right hand-side whitelists (essentially an RHSBL that
contains whitelisted domains) listed in FILE . If it is found on any of the lists, all filters are bypassed.
NOTE: Using more than a few RHS whitelists can cause serious performance problems.
If rhs-whitelist-file is given multiple times, spamdyke will check each whitelist listed in each given FILE for the remote server's
rDNS name and the sender's email address domain name.
If rhs-whitelist-file and rhs-whitelist-file are not given, spamdyke will not check any whitelist
for the remote server's rDNS name and the sender's email address domain name.
See DNS Whitelists for details. |
|
run-as-user |
USER[:GROUP] |
As soon as possible, change the running user identity to the user with the username or ID USER .
If GROUP is provided, also change the group identity to the system
group with the name GROUP or ID GROUP .
This feature requires spamdyke to be started as a user with the ability to switch identities (typically the superuser).
If run-as-user is given multiple times, spamdyke will use the last value it finds.
If run-as-user is not given, spamdyke will not attempt to switch user identities.
run-as-user is not valid within configuration directories.
See Permissions for details. |
|
sender-blacklist-entry |
ADDRESS |
Reject the connection if the sender's email address matches ADDRESS .
If sender-blacklist-entry is given multiple times, spamdyke will reject the connection if the sender's email address matches any of the given ADDRESS values.
If sender-blacklist-entry and sender-blacklist-file are not given, spamdyke will not blacklist any sender email addresses.
See Rejecting Senders and Recipients for details. |
|
sender-blacklist-file |
s |
FILE |
Reject the connection if the sender's email address matches an entry in FILE .
This option provides better performance than sender-blacklist-entry for more than a few entries.
If sender-blacklist-file is given multiple times, spamdyke will reject the connection if the sender's email address matches any of the entries in each given FILE .
If sender-blacklist-entry and sender-blacklist-file are not given, spamdyke will not blacklist any sender email addresses.
See Rejecting Senders and Recipients for details. |
sender-whitelist-entry |
ADDRESS |
If the sender's email address matches ADDRESS , bypass all filters.
If sender-whitelist-entry is given multiple times, spamdyke will compare the sender's email address to each given ADDRESS .
If sender-whitelist-entry and sender-whitelist-file are not given, spamdyke will not whitelist any sender email addresses.
See Whitelisting Senders and Recipients for details. |
|
sender-whitelist-file |
FILE |
If the sender's email address matches an entry in FILE , bypass all filters.
This option provides better performance than sender-whitelist-entry for more than a few entries.
If sender-whitelist-file is given multiple times, spamdyke will compare the sender's email address to each entry in each given FILE .
If sender-whitelist-entry and sender-whitelist-file are not given, spamdyke will not whitelist any sender email addresses.
See Whitelisting Senders and Recipients for details. |
|
smtp-auth-command |
COMMAND |
Perform SMTP AUTH verification using COMMAND .
If the authentication is valid, all filters will be
bypassed. This option may have no effect, depending on the value of smtp-auth-level .
If smtp-auth-command is given multiple times, spamdyke will authenticate using each given COMMAND until one of them indicates success.
If smtp-auth-command is not given, spamdyke will not process authentication. Depending on the value of smtp-auth-level , authentication may still be possible.
smtp-auth-command is not valid within configuration directories.
See SMTP AUTH for details. |
|
smtp-auth-level |
none ,
observe ,
ondemand ,
ondemand-encrypted ,
always or
always-encrypted
|
none : Do not offer or allow authentication, even if qmail has been patched to provide it.
observe : Observe authentication only (and trust qmail's responses), do not offer it. This value has no effect if qmail has not been patched to offer authentication.
ondemand : If qmail offers authentication, observe any authentication attempts and trust qmail's responses. If qmail does not offer authentication, spamdyke will
offer cleartext authentication, then process it using the value of smtp-auth-command .
ondemand-encrypted : If qmail offers authentication, observe any authentication attempts and trust qmail's responses. If qmail does not offer authentication, spamdyke will
offer cleartext and encrypted authentication, then process it using the value of smtp-auth-command .
always : Always offer cleartext authentication, then process it using the value of smtp-auth-command . If qmail attempts to offer authentication, spamdyke will
hide qmail's offer and prevent the authentication data from reaching qmail.
always-encrypted : Always offer cleartext and encrypted authentication, then process it using the value of smtp-auth-command .
If qmail attempts to offer authentication, spamdyke will hide qmail's offer and prevent the authentication data from reaching qmail.
If smtp-auth-level is given multiple times, spamdyke will use the last value it finds.
If smtp-auth-level is not given, spamdyke will use a value of observe .
smtp-auth-level is not valid within configuration directories.
See SMTP AUTH for details. |
|
tls-certificate-file |
FILE |
Decrypt SSL/TLS traffic using the SSL certificate in FILE . The certificate must be in PEM format.
If FILE does not also contain the private key, tls-privatekey-file must be used.
This option has no effect unless tls-level is also given.
If tls-certificate-file is given multiple times, spamdyke will use the last value it finds.
If tls-certificate-file is not given, spamdyke will not decrypt SSL/TLS traffic. The encrypted traffic will be passed through to qmail.
tls-certificate-file is not valid within configuration directories.
See TLS for details. |
|
tls-level |
none ,
smtp or
smtps
|
none : Do not offer or allow SSL/TLS, even if qmail supports it.
smtp : If tls-certificate-file is given, offer TLS during the SMTP conversation and decrypt the traffic. If tls-certificate-file is not given,
allow qmail to offer TLS (if it has been patched to provide TLS) and pass the encrypted traffic to qmail.
smtps : Initiate a SSL session at the beginning of the connection, before SMTP begins.
If tls-level is given multiple times, spamdyke will use the last value it finds.
If tls-level is not given, spamdyke will use a value of smtp .
tls-level is not valid within configuration directories.
See TLS for details. |
|
tls-privatekey-file |
FILE |
Read the private key for the SSL certificate (given with tls-certificate-file ) from
FILE . FILE must be in PEM format. Requires tls-certificate-file .
If tls-privatekey-file is given multiple times, spamdyke will use the last value it finds.
If tls-privatekey-file is not given, spamdyke will look for the private key in the certificate file.
tls-privatekey-file is not valid within configuration directories.
See TLS for details. |
|
tls-privatekey-password |
PASSWORD |
Use PASSWORD to decrypt the SSL private key (given with tls-certificate-file or
tls-privatekey-file ), if necessary. NOTE: this option reveals the password in
the process list! Requires tls-certificate-file and/or tls-privatekey-file .
If tls-privatekey-password is given multiple times, spamdyke will use the last value it finds.
If tls-privatekey-password and tls-privatekey-password-file are not given, spamdyke will attempt to load the private key without a password.
tls-privatekey-password is not valid within configuration directories.
See TLS for details. |
|
tls-privatekey-password-file |
FILE |
Read the password to decrypt the private key for the SSL certificate (from
tls-certificate-file ) from the first line of FILE , if necessary. Requires
tls-certificate-file and/or tls-password-file .
If tls-privatekey-password-file is given multiple times, spamdyke will use the last value it finds.
If tls-privatekey-password and tls-privatekey-password-file are not given, spamdyke will attempt to load the private key without a password.
tls-privatekey-password-file is not valid within configuration directories.
See TLS for details. |
Configuration Files
config-file
The configuration file format is very simple. Each line should use the following format:
OPTION=VALUE
OPTION
is the long version of a spamdyke option. See Usage for details.
VALUE
is the parameter for the option. Note: While multi-word
values must be quoted on the command line, quotes are not allowed in configuration files.
spamdyke reads the entire VALUE
after the equals sign,
even if it contains spaces, so no quoting is needed.
Blank lines and lines beginning with #
are ignored.
For example:
smtp-auth-command=/home/vpopmail/bin/vchkpw /bin/true
rdns-blacklist-dir=/home/vpopmail/blacklist_rdns.d
graylist-dir=/home/vpopmail/graylist.d
check-dnsrbl=dul.dnsbl.sorbs.net
check-dnsrbl=zombie.dnsbl.sorbs.net
max-recipients=5
VALUE
to activate them.
yes
, true
and 1
are also acceptable.
The options can also be
explicitly deactivated with no
, false
or 0
(or the option can be simply
removed). For example, the following lines all have the same effect:
reject-empty-rdns
reject-empty-rdns=yes
reject-empty-rdns=true
reject-empty-rdns=1
config-file
to
spamdyke:
spamdyke --config-file /etc/spamdyke.conf ...
config-file
option can also be used within configuration files to include
other configuration files if desired. When configuration files are in use, options may
still be provided on the command line as well, in any combination. If contradictory
options are found, the option in the configuration file will be used. For example, if the
following command line were used:
spamdyke --reject-empty-rdns --config-file /etc/spamdyke.conf ...
/etc/spamdyke.conf
contained the following line:
reject-empty-rdns=false
reject-empty-rdns
filter because the
configuration file is read after the command line has been scanned. This can be confusing,
so the best practice is to avoid specifying the same option in multiple places without
good reason.
Some options can be given multiple times and spamdyke will use all of the values it finds. For example, if the following lines are given, spamdyke will search each of the files for a match to the sender's email address:
sender-blacklist-file=/home/vpopmail/sender_blacklist.txt
sender-blacklist-file=/home/vpopmail/more_sender_blacklist.txt
sender-blacklist-file=/home/vpopmail/additional_sender_blacklist.txt
OPTION=!VALUE
sender-blacklist-file=!/home/vpopmail/sender_blacklist.txt
To clear all values from a list, three exclamation points should be given instead of a value:
OPTION=!!!
sender-blacklist-file
option
will be cleared and spamdyke will behave as though sender-blacklist-file
had never
appeared:
sender-blacklist-file=!!!
Note: spamdyke processes configuration directives in the order they are read. If an option is cleared and later set again, the option will retain the last value. For example, if the following five lines appear in this order:
sender-blacklist-file=/home/vpopmail/sender_blacklist.txt
sender-blacklist-file=/home/vpopmail/more_sender_blacklist.txt
sender-blacklist-file=/home/vpopmail/additional_sender_blacklist.txt
sender-blacklist-file=!!!
sender-blacklist-file=/home/vpopmail/last_blacklist.txt
/home/vpopmail/last_blacklist.txt
.
NOTE: It may seem that scanning a configuration file instead of the command line would impose a performance penalty each time spamdyke is started. However, the reverse seems to be true. Some rudimentary testing has indicated the configuration files are actually faster. This is likely due to inefficiencies in GNU's getopt_long() function.
Configuration Directories
config-dir
config-dir-search
Configuration directories allow spamdyke's behavior to be altered based on the remote server's IP address, the remote server's rDNS name, the sender's email address, the recipient's email address or any combination of those things. This can be very useful when, for example, graylisting should be deactivated for a specific sender. IP addresses can be whitelisted for specific recipients without whitelisting them for everyone. The possibilities are nearly endless.
NOTE: Configuration directories are confusing and complicated. Unless you really need the advanced configuration scenarios they offer, don't use them.
Configuration directories are given with the config-dir
option. The option's value should be the path
to the directory that contains the subdirectories explained below. If config-dir
is given multiple
times, spamdyke will search each given directory structure and load all of the matching files before it continues
processing the SMTP connection.
In essence, a configuration directory is a special directory structure that contains configuration files. spamdyke determines which files to load based on the names of the directories and the details of the SMTP connection. Not all options are valid within configuration directories, but in all other respects the files follow the same rules as global configuration files. See Usage for details of which options are valid within configuration directories. See Configuration Files for details of the configuration file format.
When spamdyke loads a file from a configuration directory, it will do so because the names of the directories and the name of the file match all or part of the information from the SMTP connection. The last piece of information should always be used as the name of the file, not the name of a directory.
To create a file using the IP address of the remote server, first create a directory structure that
begins with _ip_
and uses the first three octets of the address as directory names. For example,
if the IP address is 11.22.33.44
, the directory structure should look like this:
.../_ip_/11/22/33
.../_ip_/11/22/33/44
To create a file using the rDNS name of the remote server, first create a directory structure that begins with
_rdns_
and contains directories named using the rDNS name with its words reversed. For example,
if the rDNS name is mail.internal.headquarters.example.com
, the directory structure should look like this:
.../_rdns_/com/example/headquarters/internal
.../_rdns_/com/example/headquarters/internal/mail
To create a file using the sender's email address, first create a directory structure that begins with
_sender_
and contains directories using the domain portion of the sender's email address with its words reversed
and ending in _at_
. For example, if the sender's email address is mom@home.example.com
,
the directory structure should look like this:
.../_sender_/com/example/home/_at_
.../_sender_/com/example/home/_at_/mom
To create a file using the recipient's email address, first create a directory structure that begins with
_recipient_
and contains directories using the domain portion of the recipient's email address with its words reversed
and ending in _at_
. For example, if the recipient's email address is kid@school.example.com
,
the directory structure should look like this:
.../_recipient_/com/example/school/_at_
.../_recipient_/com/example/school/_at_/kid
_at_
.
If the sender's or recipient's username are omitted, the _at_
directory must be omitted as well. For example,
if the IP address is 11.22.33.44
, the rDNS name is mail.internal.headquarters.example.com
,
the sender's email address is mom@home.example.com
and the recipient's email address is kid@school.example.com
,
spamdyke will look for configuration files with the following paths:
.../_ip_/11/22/33/44
.../_ip_/11/22/33
.../_ip_/11/22
.../_ip_/11
.../_rdns_/com/example/headquarters/internal/mail
.../_rdns_/com/example/headquarters/internal
.../_rdns_/com/example/headquarters
.../_rdns_/com/example
.../_rdns_/com
.../_recipient_/com/example/school/_at_/kid
.../_recipient_/com/example/school
.../_recipient_/com/example
.../_recipient_/com
.../_sender_/com/example/home/_at_/mom
.../_sender_/com/example/home
.../_sender_/com/example
.../_sender_/com
Configuration directories can be nested to create more specific targets. For example, if the IP address of the remote
server is 11.22.33.44
and the sender's email address is mom@home.example.com
, spamdyke will
read a configuration file if its path is either of the following:
.../_ip_/11/22/33/44/_sender_/com/example/home/_at_/mom
.../_sender_/com/example/home/_at_/mom/_ip_/11/22/33/44
.../_ip_/11/22/33/44/_sender_/com/example/home
.../_ip_/11/22/33/44/_sender_/com/example
.../_ip_/11/22/33/44/_sender_/com
.../_ip_/11/22/33/_sender_/com/example/home/_at_/mom
.../_ip_/11/22/_sender_/com/example/home/_at_/mom
.../_ip_/11/_sender_/com/example/home/_at_/mom
.../_sender_/com/example/home/_ip_/11/22/33
.../_sender_/com/example/_ip_/11/22
.../_sender_/com/_ip_/11
If all of that isn't confusing enough, spamdyke will only read one file from a
_ip_
, _rdns_
, _sender_
or _recipient_
directory, even if more
matches are possible. For example, if the remote IP address is 11.22.33.44
, the sender's email address is
mom@home.example.com
and the recipient's email address is kid@school.example.com
and two
files exist with the following paths:
.../_ip_/11/22/33/44/_sender_/com/example/home/_at_/mom
.../_ip_/11/22/33/44/_recipient_/com/example/school/_at_/kid
_ip_
directory cannot be matched more than once.
This behavior can be changed with the config-dir-search
option.
config-dir-search
can be given multiple times; the values will be added together to create a composite value.
The possible values are:
first
: Match each_ip_
,_rdns_
,_sender_
or_recipient
directory only once. NOTE: Thefirst
value erases the composite value created from the other possible values, essentially "resetting" theconfig-dir-search
option.all-ip
: Match each_ip_
directory as many times as possible.all-rdns
: Match each_rdns_
directory as many times as possible.all-sender
: Match each_sender_
directory as many times as possible.all-recipient
: Match each_recipient_
directory as many times as possible.
To aid with troubleshooting, spamdyke will log the paths it searches if the log-level
option is debug
or higher.
Configuration Tests
config-test
config-test-smtpauth-username
config-test-smtpauth-password
spamdyke has the ability to scan its configuration and look for common configuration mistakes. It checks file paths, permissions, graylist folders, directory structures, SMTP AUTH commands, TLS certificates and more. This feature was inspired by Apache's ability to check its configuration file for syntax errors.
To use the testing feature:
- Find and copy the entire spamdyke command line from your "supervise" script or xinetd configuration file, including the qmail command(s).
- At a command prompt, login as root and paste the spamdyke command without running it.
- Add the option
--config-test
among the spamdyke options (before the qmail command). If appropriate, add the options--config-test-smtpauth-username
and--config-test-smtpauth-password
. - Run the command and carefully read the results. More output can be obtained by increasing the logging level (no test output goes to syslog).
run-as-user
option is not given in your spamdyke configuration, it should be
used on the command line to give spamdyke the name (or user ID) of the account used to run the mail
server. The group name (or ID) can also be given. Before spamdyke
runs its configuration tests, it will change process ownership to run as the given user. That way,
the filesystem permissions tests will be accurate.
If spamdyke is configured to provide SMTP AUTH (using the smtp-auth-level
and smtp-auth-command
options), the --config-test-smtpauth-username
and --config-test-smtpauth-password
options should be used to provide a valid
username and password for authentication. spamdyke will run the SMTP AUTH command to test
its capabilities and make recommendations.
IMPORTANT! DANGER! WARNING! DO NOT EVER PUT THE --config-test
OPTION IN
THE SPAMDYKE COMMAND LINE THAT IS RUN FOR INCOMING CONNECTIONS! YOUR MAIL SERVER WILL
IMMEDIATELY STOP RECEIVING MAIL AND REMOTE USERS WILL SEE ONLY THE DIAGNOSTIC OUTPUT!
If you make this mistake and ask for help, expect to be publicly mocked.
You have been warned.
Log Messages
log-level
log-target
The log-target
option controls where spamdyke logs its
messages. By default, log-target
is set to syslog
,
which sends log messages to the system syslog facility.
When log-target
is set to stderr
, messages are sent to standard error (stderr) instead.
For most qmail installations, this will cause spamdyke's messages to be logged
by the "multilog" program, along with qmail-smtpd's output.
If log-target
is given multiple times with different values,
spamdyke will sends its output to each given target.
When spamdyke logs to syslog, it uses the LOG_MAIL
facility, which typically puts the messages in /var/log/maillog
.
(Note: Plesk reconfigures syslog to put the messages in /usr/local/psa/var/log/maillog
.)
Regardless of how the messages are logged, errors are always
be preceded by the text ERROR:
and are fairly self-explanatory. Whenever
possible, spamdyke will recover from an error and continue processing mail.
Philosophically, it's better to continue receiving spam than to block all mail.
The log-level
option controls how much logging takes place. The following
values are supported:
none
: No logging at all, even if errors occur. This is not recommended.error
: Critical errors only, including authentication failures. This is the default whenlog-level
is not given.info
: Everything fromerror
plus logging of messages (sender, recipient, IP address, rDNS name and authenticated username). This is the value used whenlog-level
is given with no value.verbose
: Everything frominfo
plus non-critical errors such as network errors caused by the remote host, protocol errors,config-test
status messages and child process error messages. At this level, spamdyke will also print messages to show which filter blocked the connection (if applicable) and some details about the filter's settings. These messages will be prefixed withFILTER:
.debug
: Everything fromverbose
plus high-level debugging messages, intended to show the processing path within spamdyke. This level is handy for troubleshooting but it can be rather noisy. Extra messages generated by this level will be prefixed withDEBUG():
and will show the file and line number within the spamdyke source code where the message was produced. NOTE: If theconfigure
script is run with the--without-debug-output
option, spamdyke will accept thedebug
value but it will not print any more output than ifverbose
were used.excessive
: Everything fromdebug
plus lots of internal status messages. This value should only be used for development. Extra messages generated by this level will be prefixed withEXCESSIVE():
and will show the file and line number within the spamdyke source code where the message was produced. NOTE: Unless theconfigure
script is run with the--with-excessive-output
option, spamdyke will not produce any more output forexcessive
than ifdebug
were used.
log-level
must be used with care on the command line. Specifically,
when --log-level
is used, the value must be separated by an equals sign and no
spaces. When -l
is used, the value must not be separated by spaces or anything else.
For example, the following two command lines will work:
/usr/local/bin/spamdyke --log-level=verbose ...
/usr/local/bin/spamdyke -lverbose ...
log-level
option may also be given with no value at all, which is the same as specifiying info
.
The following two command lines are also valid:
/usr/local/bin/spamdyke --log-level ...
/usr/local/bin/spamdyke -l ...
Each message log entry (produced when the value of log-level
is info
or higher) takes the following form
(error messages and debugging statements are text preceeded by ERROR:
, FILTER:
, DEBUG:
or EXCESSIVE:
):
CODE from: SENDER to: RECIPIENT origin_ip: IPADDRESS origin_rdns: RDNSNAME auth: USERNAME [ reason: REALCODE ]
The possible values of CODE
are listed below:
CODE |
Description | Related Option(s) |
ALLOWED |
The message passed all filters. qmail may still bounce the message for other reasons, however. | |
ALLOWED_AUTHENTICATED |
The remote client successfully authenticated using SMTP AUTH with spamdyke. If qmail is patched to provide SMTP AUTH, this code will never be used. | |
ALLOWED_TLS |
The remote client successfully started a TLS session with spamdyke. | |
DENIED_ACCESS_DENIED |
The connection was blocked because the remote server's
IP address or rDNS name was found in the access file with a deny command. |
access-file
|
DENIED_AUTH_REQUIRED |
The message was blocked because the remote server has not authenticated, which is required. |
filter-level
|
DENIED_BLACKLIST_IP |
The connection was blocked because the remote server's IP address is blacklisted. |
ip-blacklist-entry ip-blacklist-file
|
DENIED_BLACKLIST_NAME |
The connection was blocked because the remote server's rDNS name is blacklisted. |
rdns-blacklist-entry rdns-blacklist-file rdns-blacklist-dir
|
DENIED_EARLYTALKER |
The connection was blocked because the remote server began sending data before the SMTP greeting was issued. |
greeting-delay-secs
|
DENIED_GRAYLISTED |
The recipient was blocked because the sender/recipient combination was graylisted. The SMTP connection continues after this error occurs. |
graylist-level
|
DENIED_IP_IN_CC_RDNS |
The connection was blocked because the remote server's IP address was found in the remote server's rDNS name and the remote server's rDNS name ends in a country code. |
reject-ip-in-cc-rdns
|
DENIED_IP_IN_RDNS |
The connection was blocked because the remote server's IP address was found in the remote server's rDNS name and a prohibited keyword was found in the remote server's rDNS name. |
ip-in-rdns-keyword-blacklist-entry ip-in-rdns-keyword-blacklist-file
|
DENIED_OTHER |
The connection was rejected by qmail (or another downstream filter), not spamdyke. | |
DENIED_RBL_MATCH |
The connection was blocked because the remote server's IP address was found on a DNS RBL. |
dns-blacklist-entry dns-blacklist-file |
DENIED_RDNS_MISSING |
The connection was blocked because the remote server has no rDNS name at all. |
reject-empty-rdns
|
DENIED_RDNS_RESOLVE |
The connection was blocked because the remote server's rDNS name does not resolve. |
reject-unresolvable-rdns
|
DENIED_RHSBL_MATCH |
The connection was blocked because the remote server's reverse DNS name was found on a right hand-side DNS blacklist (RHSBL) OR because the sender's domain name was found on a right hand-side DNS blacklist (RHSBL). |
rhs-blacklist-entry rhs-blacklist-file |
DENIED_RECIPIENT_BLACKLISTED |
The recipient was blocked because the recipient email address is blacklisted. |
recipient-blacklist-entry recipient-blacklist-file
|
DENIED_REJECT_ALL |
The message was blocked because all mail is being rejected. |
filter-level
|
DENIED_RELAYING |
The recipient was blocked because the recipient's domain is not locally hosted and the remote server is not allowed to relay. |
relay-level
|
DENIED_SENDER_BLACKLISTED |
The connection was blocked because the sender's email address is blacklisted. |
sender-blacklist-entry sender-blacklist-file
|
DENIED_SENDER_NO_MX |
The connection was blocked because the sender's domain has no mail exchanger, making the sender address invalid. |
reject-missing-sender-mx
|
DENIED_TOO_MANY_RECIPIENTS |
The recipient was blocked because the limit was reached for this connection. The SMTP connection continues after this error occurs. |
max-recipients
|
DENIED_UNQUALIFIED_RECIPIENT |
The recipient was blocked because the address had no domain name. The SMTP connection continues after this error occurs. | |
DENIED_ZERO_RECIPIENTS |
The message was blocked because no valid recipients have been specified. | |
FAILED_AUTH |
The remote server attempted to authenticate but the given username and/or password were incorrect. |
smtp-auth-level
|
FAILED_TLS |
The remote client attempted to start a TLS session but SSL negotiation failed. | |
TIMEOUT |
The connection timed out, either in total time or idle time.
If the connection was already being blocked for another reason, the code for that
error is given as REALCODE . |
connection-timeout-secs idle-timeout-secs
|
TLS_ENCRYPTED |
The remote server has started a TLS session with qmail. spamdyke does not have access to the server's certificate file, so it cannot decrypt the traffic to log any information about senders or recipients. |
tls-level
|
UNKNOWN_AUTH |
The remote server requested an authentication method spamdyke doesn't support. This shouldn't happen. |
SENDER
is the sender email address, if known, or (unknown)
otherwise.
NOTE: According to RFC 821, it is legal to deliver messages with no sender
address. Most bounce messages are delivered this way.
RECIPIENT
is the recipient email address, if known, or (unknown)
otherwise.
If CODE
is ALLOWED
, the recipient email address will be known.
IPADDRESS
is the IP address of the remote server. This value is always known.
RDNSNAME
is the rDNS name of the remote server, if known, or (unknown)
otherwise.
USERNAME
is the username given during authentication, if authentication was
successful, or (unknown)
otherwise.
REALCODE
is only present if CODE
is TIMEOUT
and the connection was going to be
blocked anyway. For example, if a remote server has no rDNS entry and the
connection is going to be blocked but the connection times out instead, CODE
will be TIMEOUT
and REALCODE
will be DENIED_RDNS_MISSING
.
SMTP Error Codes
policy-url
rejection-text-access-denied
rejection-text-auth-failure
rejection-text-auth-unknown
rejection-text-dns-blacklist
rejection-text-earlytalker
rejection-text-empty-rdns
rejection-text-graylist
rejection-text-ip-blacklist
rejection-text-ip-in-cc-rdns
rejection-text-ip-in-rdns-keyword-blacklist
rejection-text-local-recipient
rejection-text-max-recipients
rejection-text-missing-sender-mx
rejection-text-rdns-blacklist
rejection-text-recipient-blacklist
rejection-text-reject-all
rejection-text-relaying-denied
rejection-text-rhs-blacklist
rejection-text-sender-blacklist
rejection-text-smtp-auth-required
rejection-text-timeout
rejection-text-tls-failure
rejection-text-unresolvable-rdns
rejection-text-zero-recipients
When spamdyke blocks a connection and returns an error code to a remote server, the text it sends is different from what appears in the logs (above). It is more user-friendly, just in case a human ever reads it (some, but not all, mail servers display the rejection message in bounce messages).
The messages can be changed using the options that are listed in the third column of the table below.
The messages that correspond to the syslog codes are:
syslog code | SMTP message | Option to change message |
DENIED_ACCESS_DENIED |
Refused. Access is denied.
|
rejection-text-access-denied |
DENIED_AUTH_REQUIRED |
Refused. Authentication is required to send mail.
|
rejection-text-smtp-auth-required |
DENIED_BLACKLIST_IP |
Refused. Your IP address is blacklisted.
|
rejection-text-ip-blacklist |
DENIED_BLACKLIST_NAME |
Refused. Your domain name is blacklisted.
|
rejection-text-rdns-blacklist |
DENIED_EARLYTALKER |
Refused. You are not following the SMTP protocol.
|
rejection-text-earlytalker |
DENIED_GRAYLISTED |
Your address has been graylisted. Try again later.
|
rejection-text-graylist |
DENIED_IP_IN_CC_RDNS |
Refused. Your reverse DNS entry contains your IP address and a country code.
|
rejection-text-ip-in-cc-rdns |
DENIED_IP_IN_RDNS |
Refused. Your reverse DNS entry contains your IP address and a banned keyword.
|
rejection-text-ip-in-rdns-keyword-blacklist |
DENIED_OTHER |
The text returned by qmail (or the downstream filter that generated the rejection). | |
DENIED_RBL_MATCH |
The text returned by the DNS RBL (if any) orRefused. Your IP address is listed in the RBL at name.
|
rejection-text-dns-blacklist |
DENIED_RDNS_MISSING |
Refused. You have no reverse DNS entry.
|
rejection-text-empty-rdns |
DENIED_RDNS_RESOLVE |
Refused. Your reverse DNS entry does not resolve.
|
rejection-text-unresolvable-rdns |
DENIED_RHSBL_MATCH |
The text returned by the RHSBL (if any) orRefused. Your domain name is listed in the RHSBL at name.
|
rejection-text-rhs-blacklist |
DENIED_RECIPIENT_BLACKLISTED |
Refused. Mail is not being accepted at this address.
|
rejection-text-recipient-blacklist |
DENIED_REJECT_ALL |
Refused. Mail is not being accepted.
|
rejection-text-reject-all |
DENIED_RELAYING |
Refused. Sending to remote addresses (relaying) is not allowed.
|
rejection-text-relaying-denied |
DENIED_SENDER_BLACKLISTED |
Refused. Your sender address has been blacklisted.
|
rejection-text-sender-blacklist |
DENIED_SENDER_NO_MX |
Refused. The domain of your sender address has no mail exchanger (MX).
|
rejection-text-missing-sender-mx |
DENIED_TOO_MANY_RECIPIENTS |
Too many recipients. Try the remaining addresses again later.
|
rejection-text-max-recipients |
DENIED_UNQUALIFIED_RECIPIENT |
Improper recipient address. Try supplying a domain name.
|
rejection-text-local-recipient |
DENIED_ZERO_RECIPIENTS |
Refused. You must specify at least one valid recipient.
|
rejection-text-zero-recipients |
FAILURE_AUTH |
Refused. Authentication failed.
|
rejection-text-auth-failure |
FAILURE_TLS |
Failed to negotiate TLS connection.
|
rejection-text-tls-failure |
TIMEOUT |
Timeout. Talk faster next time.
|
rejection-text-timeout |
UNKNOWN_AUTH |
Refused. Unknown authentication method.
|
rejection-text-auth-unknown |
If a policy location URL is given with the policy-url
option, it
will be appended to the end of the message, just in case a human ever reads it.
This option should always be used. When a legitimate remote user is incorrectly
blocked, the URL should provide your contact information so the error can be
corrected.
spamdyke will always append the syslog code to the policy URL so a web browser
will jump to an anchor within the HTML document. Most of the time, the code is
prefixed with a #
character. For example, if the policy URL is:
http://www.example.com/policy.html
http://www.example.com/policy.html#DENIED_RDNS_MISSING
=
), spamdyke
will assume the URL is for a dynamic page and will not add the #
character. For example, if the policy URL is:
http://www.example.com/policy?code=
http://www.example.com/policy?code=DENIED_RDNS_MISSING
Logging All Data
full-log-dir
spamdyke has the ability to log all SMTP data to files. This is very helpful when debugging but (depending on the mail server traffic levels) it can generate a huge number of files.
This feature is activated with the full-log-dir
option. Each
connection will be logged to a different file in the folder given, with a
naming convention that incorporates the current date and time, the process ID of
the spamdyke process and a random number:
YYYYMMDD_HHMMSS_PID_RANDOMNUM
The data from the remote server and qmail are both logged to the file. Each transmission is preceded with a line showing its origin and destination as well as the time and date.
If the remote client establishes a TLS session with qmail and spamdyke passes the encrypted data, the logs will contain the data as hexadecimal bytes.
The logs will contain all debugging output spamdyke can produce, the same output
that would be produced if log-level
were set to its highest level.
spamdyke will also print its current configuration into the log file every time it
processes a configuration file, to show what options are active and what their
values are.
Log files are created with a 0600
mode to protect them from being read by
unauthorized users. Please take other precautions to protect them and don't
leave them lying around.
NOTE: This feature is intended to be used for debugging delivery problems, not for monitoring email content. Among other issues, the format of the log files does not make it easy to reconstruct a whole message. If you must monitor your users' email data, please use a packet sniffer on a separate machine or SMTP proxy software designed for the task.
Permissions
run-as-user
On most Unix-based systems, only the superuser can start a daemon that listens on port 25 (the SMTP port). However, since running daemons as the superuser should be avoided whenever possible, most qmail installations use utilities to switch the daemon's owner to a normal user before qmail actually runs.
Some older qmail installations lack this ability, notably ones that use the inetd
"superserver" to start qmail. To help provide security in these situations, spamdyke
provides the run-as-user
option to force spamdyke to switch to a different
user account as soon as it starts. All of spamdyke's child processes (including qmail)
will run under the new user account.
The value of run-as-user
takes the following form:
USER[:GROUP]
USER
should be the name or user ID of a valid system user. If GROUP
is not provided, spamdyke will join USER
's default group. If GROUP
is provided, it can be the name or group ID of a valid system group.
On systems where qmail does not run as the superuser, run-as-user
can be used
to force spamdyke to change accounts when the config-test
option is used, so that
its tests of filesystem permissions will be meaningful.
DNS Queries
dns-level
dns-max-retries-primary
dns-max-retries-total
dns-server-ip
dns-server-ip-primary
dns-timeout-secs
Because so many of spamdyke's filters rely so heavily on DNS queries, spamdyke provides
a number of options to tune its DNS activities.
Take care when using any of these options, as setting them incorrectly can prevent spamdyke
from functioning correctly. Most of the time, there is no need to use them -- spamdyke will
read its DNS information from /etc/resolv.conf
and the environment, as documented
in the system resolver(5)
manual page.
spamdyke ranks nameservers into two categories: "primary" and "secondary". Primary nameservers are queried first; secondary nameservers are only queried if no response is received from a primary nameserver.
Normally, spamdyke reads its list of nameservers from /etc/resolv.conf
, just like
any other program. It considers the first nameserver it finds in that file to be a primary
nameserver. All others are considered to be secondary nameservers. This list can be overridden,
however, using the dns-server-ip
and dns-server-ip-primary
options.
spamdyke also honors the port
, timeout
and options
directives (if any) in the /etc/resolv.conf
file. If the environment variable
RES_OPTIONS
is present, spamdyke will parse it for a timeout value.
If either dns-server-ip
or dns-server-ip-primary
are used, the file
/etc/resolv.conf
is not loaded. Both options take values in the same format:
IPADDRESS[:PORT]
11.22.33.44
). The port
number, if it is provided, must be an integer between 1
and 65535
,
inclusive. If the port number is not given, the value 53
is used.
dns-server-ip
and dns-server-ip-primary
can each be given multiple
times to specify multiple servers in each category.
If dns-server-ip
and dns-server-ip-primary
are not given and no
nameservers can be found by reading /etc/resolv.conf
, the IP address 127.0.0.1
(the localhost address) is used.
By default, spamdyke will attempt to query its primary nameserver once, then all of its nameservers
twice more, taking no more than 30 seconds total.
The option dns-max-retries-total
controls the total number of attempts spamdyke makes to
contact its nameservers (the number of query packets actually sent may be much greater than this value;
see below). The option dns-max-retries-primary
controls how long spamdyke sends queries
only to its primary nameservers. This value must be less than or equal to dns-max-retries-total
.
The option dns-timeout-secs
controls the total time spamdyke will spend waiting for the
results of a single query. All of its retries will be carried out within this time limit. NOTE: The timeout
value must be large enough for nameservers to complete their work and respond. If it is too low, spamdyke
will never successfully complete a query.
The dns-level
option controls how aggressively spamdyke queries its nameservers. It takes
the following values:
aggressive
: Query all primary nameservers simultaneously untildns-max-retries-primary
is reached, then query all nameservers simultaneously untildns-max-retries-total
is reached. This is the default. For example, if there are 2 primary nameservers, 3 secondary nameservers,dns-max-retries-primary
is 4 anddns-max-retries-total
is 6, spamdyke will: send a simultaneous query to each of the 2 primary nameservers 4 times, for a total of 8 queries. It will then send a simultaneous query to all 5 nameservers 2 more times, for a grand total of 18 queries.normal
: Imitate the standard system resolver's behavior by sending queries to one nameserver at a time. spamdyke will send queries to each of the primary nameservers in sequence untildns-max-retries-primary
is reached, then it will add the secondary nameservers to the sequence and continue sending queries untildns-max-retries-total
is reached. Depending on the number of nameservers and the values ofdns-max-retries-primary
anddns-max-retries-total
, some nameservers may never be queried.none
: Do not query any nameservers at all. All DNS-based features will behave as though their queries returned no results.
NOTE: Depending on the type of query spamdyke is performing, multiple packets are typically sent to each nameserver.
For example, when querying a DNS RBL, a "query" consists of 3 packets -- one requesting A records, one requesting TXT
records and one requesting CNAME records. In the aggressive
example above, the 18 queries would result in
52 data packets.
Filter Levels
filter-level
spamdyke's overall filter behavior can be controlled with the filter-level
option.
NOTE: filter-level
takes precedence over all other filters and features, including authentication and whitelisting.
The possible values are:
allow-all
: Allow all connections, effectively whitelisting everything.normal
: Allow only the connections that pass the enabled filters. This is the default.require-auth
: Allow only authenticated connections, even the ones that match a whitelist entry.reject-all
: Reject all connections, even if they are whitelisted or authenticated.
The values allow-all
and reject-all
are most useful within configuration
directories, where they can be set e.g. for specific recipients.
TLS
tls-certificate-file
tls-level
tls-privatekey-file
tls-privatekey-password
tls-privatekey-password-file
TLS is another name for SSL, the same encryption protocol used by secure websites. TLS can be used during SMTP to provide secure communications between the remote client and the server.
spamdyke supports TLS in several ways. First, with no TLS options given, spamdyke will identify a TLS conversation and simply pass the data back and forth between qmail and the remote client. In this mode, spamdyke cannot read the SMTP data (obviously -- it's encrypted). This prevents some of its filters from functioning, including graylisting, sender and recipient blacklisting, limiting the number of recipients, checking the sender's domain name for an MX record and relaying.
Second, spamdyke can provide TLS itself. To do this, it must be compiled with
TLS support, which requires OpenSSL libraries on the server (see
the Installation instructions for details).
The value of the tls-level
option controls how TLS is provided:
none
: Do not provide or allow TLS, even if qmail supports it. qmail's attempt to advertise its TLS support will be hidden and the remote server's request for TLS will be denied.smtp
: Provide TLS during the SMTP session, so that it can be started if the remote server requests it. spamdyke will decrypt all of the data and pass the plaintext to qmail. qmail will not be aware that TLS is happening. In this mode, qmail does not need to be patched to provide TLS.smtps
: Start an SSL session as soon as the connection is opened. This mode is called "SMTP over SSL" or "SMTPS". The remote client must support this method. Typically, SMTPS is offered on port 465, not port 25.
If tls-level
is smtp
or smtps
,
the server certificate must also be provided with
the tls-certificate-file
parameter.
The server certificate file must be in PEM format. If the private key is not in
the certificate file, it must be provided in PEM format with the
tls-privatekey-file
parameter. If the private key is encrypted with a
password, the password must be provided with the tls-privatekey-password
parameter. Because providing the private key password on the command line is
very insecure, the password can also be contained in a file and loaded using
the tls-privatekey-password-file
parameter.
Generating self-signed certificates is very easy with OpenSSL. Countless tutorials are available on the web.
If there are any problems reading the certificate, the private key or decrypting the private key, spamdyke will log the errors to syslog and fall back to passing the TLS data through to qmail, if qmail has been patched to provide TLS (or spamdyke will send the remote client an error message if qmail doesn't provide TLS). spamdyke will also log the error messages produced by OpenSSL, even though they're rarely helpful.
NOTE: spamdyke does not disable any of its filters simply because a remote client uses TLS or SSL. In SMTP, TLS/SSL is simply a method of securing the communication channel. It is not an authentication method. While it's true spammers aren't using TLS and therefore any client that does use it is unlikely to be a spammer, there's no reason to assume that will be true forever. spamdyke will only disable its filters for clients it finds on its whitelists or ones that use SMTP AUTH.
If in doubt about enabling TLS, do it. Encrypting email data is always a good thing.
SMTP AUTH
hostname
hostname-command
hostname-file
smtp-auth-command
smtp-auth-level
SMTP AUTH is a mechanism for remote users to authenticate before sending email
(defined in RFC 2554). This is very handy when users are likely to connect from
remote locations (e.g. coffee shops, hotels) and want to bypass relaying
restrictions and other filters. spamdyke will disable all of its filters for
authenticated connections unless the filter-level
option overrides
this behavior. See Filter Levels for details.
spamdyke supports SMTP AUTH according to the value of the smtp-auth-level
option:
none
: Do not offer or allow SMTP AUTH. If qmail has been patched to provide SMTP AUTH, spamdyke will block its advertisement of SMTP AUTH and will prevent the remote server from authenticating.observe
: If qmail has been patched to provide SMTP AUTH, simply observe the authentication and trust qmail's response. If qmail has not been patched to provide SMTP AUTH, do not provide SMTP AUTH. This is the default.ondemand
: If qmail has been patched to provide SMTP AUTH, simply observe the authentication and trust qmail's response. If qmail has not been patched to provide SMTP AUTH, offer it and process the authentication without letting qmail know it took place.ondemand-encrypted
: Offer SMTP AUTH as needed, just likeondemand
, but also offer the encrypted protocol CRAM-MD5. See below for a full description.always
: Always offer and process SMTP AUTH, even if qmail has been patched to provide SMTP AUTH. This value should only be used if qmail's authentication is malfunctioning for some reason.always-encrypted
: Always offer and process SMTP AUTH, just likealways
, but also offer the encrypted protocol CRAM-MD5. See below for a full description.
When the value of smtp-auth-level
is ondemand
, ondemand-encrypted
,
always
or always-encrypted
, the option smtp-auth-command
must also be given to provide spamdyke with the command for processing authentication.
If multiple commands are available, smtp-auth-command
may be given multiple
times. spamdyke will run each command in order until one of them is successful.
For bare qmail installations where the users are stored in /etc/passwd
the value of smtp-auth-command
is usually:
/bin/checkpassword /bin/true
smtp-auth-command
is usually:
/home/vpopmail/bin/vchkpw /bin/true
For Plesk users, the values of smtp-auth-command
are usually:
/var/qmail/bin/smtp_auth /var/qmail/bin/true
/var/qmail/bin/cmd5checkpw /var/qmail/bin/true
Some background on encrypted authentication: SMTP AUTH can be done using one of several protocols, defined by RFC 2554. Two of them are very simple: LOGIN and PLAIN. Although they work slightly differently, LOGIN and PLAIN both send the username and password to the server, which authenticates them. With these protocols, the server does not have to store the user's password in an unencrypted format. If the passwords are encrypted on the server, the authentication process can simply encrypt the password it receives and compare the two encrypted versions. If they match, the password must have been correct.
Unfortunately, this means that the password must be sent to the server in an unencrypted format so the authentication process can encrypt it for comparison. Unless an external encryption protocol is used (e.g. TLS or SMTPS), the passwords are theoretically vulnerable to eavesdropping.
For this reason, another protocol was created called CRAM-MD5. CRAM-MD5 is a "challenge/response" protocol, which allows authentication to take place without sending the password to the server in an unencrypted form. In essence, the protocol starts when the server generates some random text and sends it to the remote client (the "challenge"). The remote client encrypts the text with the user's password and sends it back to the server (the "response"). The server also encrypts the text with the user's password and compares the result to the response from the client. If they match, the remote client must have the correct password.
The challenge text is generated from several sources, including the name of the local server.
The hostname
, hostname-command
or hostname-file
option can be used to provide the local server's name for this reason. When hostname
is used, the value should be the server's name. When hostname-command
is used,
the value should be a command that will print the server's name as its first line of output.
When hostname-filename
is used, the value should be the path to a file that contains
the server's name as its first line. NOTE: If the local server's name is not provided,
CRAM-MD5 will still work and it will still generate random challenge text. Using the local server's name
only makes it slightly more secure. It's not worth a large effort to provide it.
Unfortunately, this means that the password must be stored on the server in an unencrypted format so the authentication process can use it to encrypt the challenge text. Theoretically, this leaves the passwords vulnerable to theft by an intruder who breaks into the server.
When smtp-auth-level
is ondemand-encryption
or always-encryption
,
spamdyke will offer the CRAM-MD5 protocol to the remote client. However, if the passwords
are not stored on the server in an unencrypted format or if the authentication command
does not understand CRAM-MD5, CRAM-MD5 will always fail.
If you're not sure which value to use, run spamdyke with the config-test
option.
It will test the authentication commands and recommend a value.
See Configuration Tests
for details.
If in doubt about enabling SMTP AUTH, do it. Authenticating your users is always a good thing.
Relaying
access-file
relay-level
By default, spamdyke does nothing to prevent relaying (a remote user using the server to send
email to another remote user). However, when qmail has not been patched to provide
SMTP AUTH (or when spamdyke's smtp-auth-level
option is used to prevent qmail from
seeing authentication attempts), spamdyke must control relaying so that authenticated users
will be allowed to relay.
Whether a recipient
is local is determined by searching the local domains list (given by local-domains-entry
or local-domains-file
;
see Rejecting Senders and Recipients for details).
NOTE: spamdyke does not consider the sender address when deciding to block a recipient for relaying. Sender addresses can be (and usually are) forged by spammers.
spamdyke's relay-level
option controls how spamdyke controls relaying. The available
options are:
block-all
: Block all attempts at relaying, even if the remote server has authenticated.no-check
: Do not check for or prevent relaying and do not interfere with qmail's relay filter.normal
: Prevent relaying according to the contents of the access file and the list of local domains. Authenticated and whitelisted connections will be allowed to relay. This is the default.allow-all
: Allow all connections to relay messages (create an open relay). This is not recommended.
An access file may be given
with the access-file
option. spamdyke will search the file for the incoming
server's IP address and/or rDNS name.
Each line in the access file should use one of the following formats:
REMOTE_INFO@REMOTE_IP:ACCESS
REMOTE_INFO@=REMOTE_NAME:ACCESS
REMOTE_IP:ACCESS
REMOTE_NAME:ACCESS
:ACCESS
REMOTE_INFO
is the value returned from an "info" query of the remote server.
spamdyke doesn't perform "info" queries but tcpserver does (by default). It sets the
TCPREMOTEINFO
environment variable if it finds anything. spamdyke uses
TCPREMOTEINFO
if it's set. (Does anyone actually use "info" any more?)
REMOTE_IP
is the IP address of the remote server. It can also be a partial IP
address, a dotted quad with ranges, a dotted quad with a number of bits or a
dotted quad with a netmask. See IP Address Files for a full explanation
of the acceptable formats.
REMOTE_NAME
is the rDNS name of the remote server. It can also be a partial
name. See rDNS Files for a full explanation of the acceptable formats.
ACCESS
is the permission setting -- either allow
or deny
. Connections are
allowed by default (if no match is found). If access is denied, no mail is
accepted at all, whether relayed or not.
Blank lines and lines starting with #
are ignored.
The end of each line may optionally specify a series of environment variables to be set before qmail is started. They should use the following format and be separated by commas:
NAME="VALUE"
NAME=.VALUE.
For example, if the remote server's IP address is 11.22.33.44
and its rDNS name is
mail.example.com
, each of the following lines will match, allow connections and
set several environment variables:
11.22.33.44:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
11.20-100.33.44:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
11.22.:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
11.22.33.0/24:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
11.22.0.0/255.255.0.0:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
=mail.example.com:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
=.example.com:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
=.com:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
:allow,FOOVAR="foovalue",BARVAR=.barvalue.,BAZVAR=-bazvalue-
Conveniently, this is exactly the format tcpserver uses for its /etc/tcp.smtp
file. NOTE: spamdyke can't read CDB files, only the plain text file, so be
careful which file you list on the command line.
Remote servers are allowed to relay if the environment variable RELAYCLIENT
is
set to any value. Most qmail guides recommend an entry like this one:
11.22.33.44:allow,RELAYCLIENT=""
Reverse DNS
ip-in-rdns-keyword-blacklist-entry
ip-in-rdns-keyword-blacklist-file
ip-in-rdns-keyword-whitelist-entry
ip-in-rdns-keyword-whitelist-file
reject-empty-rdns
reject-ip-in-cc-rdns
reject-unresolvable-rdns
Reverse DNS is the part of the DNS system that maps IP addresses back to names. If you don't understand reverse DNS, please please please read one of the (thousands of) online tutorials on the subject. Every mail server administrator should know about reverse DNS. It's not complicated. Please take the time to learn it.
spamdyke does a lot of work with rDNS names. The first and most basic test is
to make sure the remote server has an rDNS name, any name. This filter is
activated with the reject-empty-rdns
option. AOL and most other
major ISPs use this test. By default, this filter is not run.
The next test is to make sure the remote server's rDNS name resolves. This
test only attempts to get at least one IP address from the name. It does not
require the rDNS name's IP address to match the remote server's IP address.
For example, if the remote
server's IP address is 11.22.33.44
and its rDNS name is mail.example.com
,
this test will query mail.example.com
. Even if it resolves to
66.77.88.99
, the test will pass.
Note: The name localhost
is handled specially. If the rDNS name is localhost
and
the IP address is not 127.0.0.1
, the test fails.
This filter is activated with the
reject-unresolvable-rdns
option. By default, this filter is not run.
NOTE: reject-unresolvable-rdns
does not imply reject-empty-rdns
.
In other words, using just the reject-unresolvable-rdns
option will
block connections from servers with unresolvable rDNS names but it will not
block connections from servers with no rDNS names at all. Most users will want
to use reject-empty-rdns
if they use reject-unresolvable-rdns
.
spamdyke also has several filters that look for an IP address in the rDNS name, since that typically
indicates a server sending email that shouldn't be (e.g. a virus-infected Windows
machine on a cable modem). If the rDNS name contains the IP address and a keyword given with the
ip-in-rdns-keyword-blacklist-entry
option, spamdyke will block the connection.
Simple keywords can be provided. For example, dynamic
will match an rDNS name like
11.22.33.44.dynamic.example.com
. NOTE: The keyword will not be matched in
the domain name (i.e. the keyword example
would not be found).
Domain names can be provided if they are preceded by a dot. For example, .example.com
(or just .com
) will match 11.22.33.44.dynamic.example.com
.
Complex patterns can also be provided to match multiple keywords in sequence. When the
keywords are separated by spaces, spamdyke will only find a match if all of the keywords
are found. For example, cable dynamic .example.com
will match
11.22.33.44.cable.modem.dynamic.customer.example.com
but it will not match
11.22.33.44.cable.modem.static.customer.example.com
.
All keyword searches are case-insensitive.
If more than a few keywords are provided, the ip-in-rdns-keyword-blacklist-file
option is much more efficient. The keywords (or patterns) should be listed one per line.
Blank lines and lines beginning with #
will be ignored.
spamdyke also accepts the ip-in-keyword-whitelist-entry
and
ip-in-keyword-whitelist-file
options that match keywords exactly the same
way as the blacklist options. The whitelist options bypass all filters when a connection
matches, however, instead of blocking the connection.
spamdyke offers one other option that searches for an IP address in the rDNS name:
reject-ip-in-cc-rdns
. In essence, this option is the same as using
ip-in-rdns-keyword-blacklist-entry
for every two-letter country code (e.g. .us
).
This option is not very useful for large servers or servers outside the United States.
As ICANN begins allowing arbitrary top-level domains, two-letter domains will no longer
be a reliable way of detecting non-US servers.
When matching an IP address in an rDNS name, spamdyke looks for the IP address in many forms;
for example, if the IP address is 11.22.33.44
, spamdyke will look for the
following patterns in the rDNS name (the dots in the examples below can
be any single character):
11.22.33.44
011.022.033.044
11.022.033.044
11.22.033.044
11.22.33.044
44.33.22.11
44.11.22.33
33.22.11.44
44.33.1122
3344.11.22
11.22.8492
(last two octets combined and converted to an integer)11223344
11.22.3344
11.223344
011022033044
11022033044
1122033044
112233044
44332211
044033022011
3930621781
(entire address converted to an integer)5080d7e3
(each octet converted to hexadecimal)
Blacklists
ip-blacklist-entry
ip-blacklist-file
rdns-blacklist-dir
rdns-blacklist-entry
rdns-blacklist-file
First, let's all agree that blacklists are evil, arbitrary, unforgiving, unfair, etc, etc, blah blah blah. OK. If you feel that way, don't use one.
But, if you decide to use one, it can block over half the spam you would otherwise receive. Blacklists are very effective against professional spammers who buy thousands of domain names and run their own mail servers (constantly moving them around, of course). It's your decision.
NOTE: Constructing and maintaining a blacklist is left as an exercise for the reader. spamdyke will use a blacklist but it won't help you build one.
spamdyke will search for the remote server's rDNS name in a file
and block the connection if it is found. This is activated with the
rdns-blacklist-file
option. See rDNS Files for details on the
format of this file. If the rdns-blacklist-file
option is given multiple times, each
file will be checked before the connection is allowed.
If only a few rDNS names should be blacklisted, the option rdns-blacklist-entry
can be used instead. The entries should follow the same format as the lines in an rDNS file.
spamdyke will also search for the remote server's rDNS name in a directory structure
and block the connection if it is found. For large lists of rDNS names (more than
100), the directory structure is much faster than a file. This is activated with the
rdns-blacklist-dir
option. See rDNS Directories for details on the
structure of this directory. If the rdns-blacklist-dir
option is given multiple times, each
directory will be checked before the connection is allowed.
spamdyke will also search for the remote server's IP address in a file and
block the connection if it is found. This is activated with the
ip-blacklist-file
option. See IP Address Files for details on the
format of this file. If the ip-blacklist-file
option is given multiple times, each
blacklist file will be checked before the connection is allowed.
If only a few IP addresses should be blacklisted, the option ip-blacklist-entry
can be used instead. The entries should follow the same format as the lines in an IP address file.
DNS RBLs
dns-blacklist-entry
dns-blacklist-file
DNS Realtime Blackhole Lists are services maintained by third parties that list IP addresses (presumably the IP addresses of spammers). The criteria for getting listed on a DNS RBL vary by organization and it's often very hard to get delisted. Sometimes, listings are politically motivated; some DNS RBL operators try to force large ISPs to cancel spammers' accounts by listing all of the ISP's IP addresses, innocent or guilty. If you choose to use a DNS RBL, please do some preliminary research to understand its policies and history of complaints.
spamdyke will reject connections from an IP address listed in a given DNS RBL.
This feature is activated with the dns-blacklist-entry
option. By default,
spamdyke does not use a DNS RBL. If the dns-blacklist-entry
option is given multiple times, each
DNS RBL will be checked before the connection is allowed.
If more than a few DNS RBLs are needed, the dns-blacklist-file
option is
more efficient than dns-blacklist-entry
. Each line in the file should contain
the name of one DNS RBL.
NOTE: Checking DNS RBLs can impose a serious performance penalty. Using more than three DNS RBLs is not recommended.
DNS RHSBLs
rhs-blacklist-entry
rhs-blacklist-file
DNS Righthand-side Blacklists are services maintained by third parties that list domain names (presumably the domain names of spammers). The criteria for getting listed on a DNS RHSBL vary by organization and it's often very hard to get delisted. Sometimes, listing are politically motivated; some DNS RHSBL operators try to force large ISPs to cancel spammers' accounts by listing all of the ISP's domain names, innocent or guilty. If you choose to use a DNS RHSBL, please do some preliminary research to understand their policies and history of complaints.
spamdyke will reject connections from servers whose reverse DNS names are listed in a given DNS RHSBL.
spamdyke will also reject connections from senders whose email domain names are listed in a given DNS RHSBL.
These features are activated with the rhs-blacklist-entry
option. By default, spamdyke does
not use a DNS RHSBL. If the rhs-blacklist-entry
option is given multiple times, each
DNS RHSBL will be checked before the connection is allowed.
If more than a few DNS RHSBLs are needed, the rhs-blacklist-file
option is
more efficient than rhs-blacklist-entry
. Each line in the file should contain
the name of one DNS RHSBL.
NOTE: Checking DNS RHSBLs can impose a serious performance penalty. Using more than three DNS RHSBLs is not recommended.
Whitelists
ip-whitelist-entry
ip-whitelist-file
rdns-whitelist-dir
rdns-whitelist-entry
rdns-whitelist-file
spamdyke will match the remote server's rDNS name against a list given with
the rdns-whitelist-entry
option and skip all filters if it is found.
If more than a few entries are given, the rdns-whitelist-file
option
is much more efficient; it can be used to put the entries in a file, one per line.
See rDNS Files for details on the
format of this file. If rdns-whitelist-file
option is given multiple times, each whitelist
file will be checked before the connection is blocked.
spamdyke will also search for the remote server's rDNS name
in a directory structure and skip all filters if it is found. This is activated with the
rdns-whitelist-dir
option. See rDNS Directories for details on the
format of this directory structure. If rdns-whitelist-dir
option is given multiple times, each
directory will be checked before the connection is blocked.
spamdyke will also search for the remote server's IP address in a list of entries
skip all filters if it is found. This is activated with the
ip-whitelist-entry
option. If more than a few entries are given,
the ip-whitelist-file
option is more efficient; it can be used to
put the entries in a file. See IP Address Files for details on the
format of this file. If the ip-whitelist-file
option is given multiple times, each whitelist
file will be checked before the connection is blocked.
Rejecting Senders and Recipients
local-domains-entry
local-domains-file
recipient-blacklist-entry
recipient-blacklist-file
reject-missing-sender-mx
sender-blacklist-entry
sender-blacklist-file
It's rare, but sometimes spammers will choose to target a specific address and pound it with millions of messages. Most often, this happens when a spammer chooses to use one of your email addresses as the sender address on a spam run. When that happens, you'll receive bounce messages for all of their spams. (This is commonly referred to as a "joe job".)
spamdyke will block all incoming messages to a specific address with the
recipient-blacklist-entry
option. If more than a few addresses
are given, the recipient-blacklist-file
option is much more efficient.
The given file must contain one
email address per line. Blank lines and lines beginning with #
are ignored.
If the recipient-blacklist-file
option is given multiple times, each blacklist file will be
checked before the connection is blocked.
One form of wildcard address is supported. All usernames within a domain
(and its subdomains) may be blocked by a line starting with @
.
For example, if the file contained the following entry:
@example.com
fred@example.com
, fred@mail.example.com
,
barney@mail.internal.example.com
, etc.
Similarly, spammers will rarely (but occasionally) use the same sender address
for a while. spamdyke will block all incoming messages from a specific address
with the sender-blacklist-entry
option. If more than a few addresses
are given, the sender-blacklist-file
option is more efficient.
The file format is identical
to the recipient blacklist file, described above.
spamdyke will also look at the sender's domain name to check if it has a mail
exchanger or an IP address listed in DNS. If a mail exchanger is found, the
mail exchanger must have an IP address. Without a valid mail exchanger or an IP
address, no mail could possibly go to the sender address. This test tends to
block a lot of mail from compromised web servers that aren't supposed to be sending email.
It is activated with the reject-missing-sender-mx
option. By default, this
test is not run.
To use the reject-missing-sender-mx
option, a list of local domain names
must be given. This is necessary because if your server is willing to
receive mail for a given domain, it must be a mail exchanger for that domain, no
matter what DNS says.
The local domain list should be provided with the local-domains-file
option. The file should contain one domain name per line. For example, if the
file contained example.com
, a message from fred@example.com
would not be
be blocked by reject-missing-sender-mx
(although the message may still be blocked by other filters).
If the local-domains-file
option is given
multiple times, each file will be checked before any action is taken.
The list of local domains for spamdyke should be the same as the one used by qmail.
For this reason, the local-domains-file
option should almost always be used.
However, in some situations, it may be necessary to give additional local domains
to spamdyke that aren't listed in a file. In that case, the local-domains-entry
option can be used.
The local domain list also supports wildcards. If a domain name in the file starts
with a dot, any sender address within a subdomain will also pass the reject-missing-sender-mx
filter.
For example, if the provided file contained .example.com
,
then fred@foo.example.com
, barney@bar.example.com
and wilma@example.com
would all pass the reject-missing-sender-mx
filter, no matter what
DNS records exist for their domain.
Conveniently, this wildcard system matches the system used in qmail's
controls/rcpthosts
file.
DNS Whitelists
dns-whitelist-entry
dns-whitelist-file
rhs-whitelist-entry
rhs-whitelist-file
spamdyke has the ability to consult DNS whitelists and allow connections from hosts or senders who match entries on them. DNS whitelists are essentially DNS RBLs and DNS RHSBLs that list allowed IP addresses and domain names instead of blocked ones. All of the same cautionary statements apply to DNS whitelists as to DNS blacklists. See DNS RBLs and DNS RHSBLs for details.
To use a DNS Realtime Whitelist (the opposite of a DNS RBL), the option dns-whitelist-entry
should be given. To use a DNS Righthand-side Whitelist, the option rhs-whitelist-entry
should be given. By default, spamdyke does not use a DNS whitelist.
If either option is given multiple times, each list will be
consulted before the connection is blocked.
If more than a few lists are given, the dns-whitelist-file
or rhs-whitelist-file
options may be used to provide the lists in files.
NOTE: Checking DNS whitelists can impose a serious performance penalty. Using more than three DNS whitelists is not recommended.
Whitelisting Senders and Recipients
recipient-whitelist-entry
recipient-whitelist-file
sender-whitelist-entry
sender-whitelist-file
Sometimes, adding IP addresses and reverse DNS names to whitelist files is not enough to satisfy some users. Either they continue to receive mail from unexpected places or they just think spamdyke is blocking their email. In those cases, a last resort can be to whitelist the sender or recipient address.
NOTE: Using these features is a bad idea! Sender addresses are very easy to forge; this is why spam is so hard to block. Recipient addresses are obviously already known to the spammers; this is why spam is delivered. Whitelisting any addresses this way will allow spam to get through.
To whitelist a sender or recipient address, the sender-whitelist-entry
or recipient-whitelist-entry
option should be used, respectively.
The entries can use the same formats as those for sender-blacklist-entry
and recipient-blacklist-entry
; see Rejecting Senders and Recipients
for details.
Whitelist entries can be placed in files and referenced
with sender-whitelist-file
or recipient-whitelist-file
.
This is more efficient for more than a few entries.
Graylisting / Greylisting
graylist-dir
graylist-exception-ip-entry
graylist-exception-ip-file
graylist-exception-rdns-dir
graylist-exception-rdns-entry
graylist-exception-rdns-file
graylist-level
graylist-max-secs
graylist-min-secs
Graylisting is the technique of denying mail delivery the first time a sender tries to deliver to a recipient. The next time the remote server attempts to deliver the message, it is accepted. All future messages from the sender to the recipient are also allowed.
Graylisting works because spammers don't use real mail servers, so when the initial delivery fails, they don't retry it. Even if they do, they change to a different random sender address, which is also graylisted.
spamdyke's graylisting is activated first with the graylist-level
option, which will accept the following values:
none
: Do not graylist any connections. This is the default.always
: Always graylist connections if a domain folder exists for the recipient and the remote server's IP address or rDNS name are not found on one of the exception lists.always-create-dir
: Always graylist connections unless the remote server's IP address or rDNS name are found on one of the exception lists. If a domain folder does not exist for the recipient, create it.only
: Do not graylist any connections unless a domain folder exists for the recipient and the remote server's IP address or rDNS name are found on one of the exception lists.only-create-dir
: Do not graylist any connections unless the remote server's IP address or rDNS name are found on one of the exception lists. If a domain folder does not exist for the recipient, create it.
The option graylist-dir
is required if graylist-level
is
not none
. The value of graylist-dir
must be the path to
a directory where spamdyke has permission to create folders and write files.
A list of local domains must also be provided with local-domains-entry
or local-domains-file
. Without a list of local domains, spamdyke cannot
know which domains should be graylisted. See Rejecting Senders and Recipients for details.
The "domain directories" required by graylist-level
's always
and only
values are just folders named using the recipient's domain name. For example, if
the value of graylist-dir
is:
/var/tmp/graylist.d
example.com
, the domain directory would be:
/var/tmp/graylist.d/example.com
always-create-dir
or only-create-dir
instead.
NOTE: Domain directories must be named in lowercase. Unfortunately, spamdyke cannot perform a case insensitive search for directory paths.
If graylist-dir
is given multiple times, spamdyke will search each given
directory for the recipient's domain folder. If the domain folder is not found and the value
of graylist-level
is always-create-dir
or only-create-dir
,
spamdyke will create a domain folder in the last directory given.
As spamdyke creates graylist entries, it breaks apart the sender's and recipient's addresses
to create folders. For example, a graylist entry for messages from sender@remote.com
to
recipient@local.com
will be a file with the following path:
.../local.com/recipient/remote.com/sender@remote.com
If the options graylist-exception-ip-entry
or graylist-exception-rdns-entry
are given, spamdyke will reverse its graylist policy for remote servers whose
IP addresses or rDNS names, respectively, match the given entries.
If more than a few IP address or rDNS entries are given, the options graylist-exception-ip-file
and graylist-exception-rdns-file
are more efficient.
See IP Address Files and rDNS Files
for details on the formats of these files.
If more than 100 entries are given in an rDNS file, the option graylist-exception-rdns-dir
is more efficient than graylist-exception-rdns-file
. See
rDNS Directories for details.
spamdyke accepts two options to control the lifetimes of its graylist entries.
The option graylist-min-secs
controls the minimum amount of time an
entry must exist before it is valid. For example, if the value 300
is given, a graylist entry is not valid until it has existed for at least 5 minutes.
This prevents a spammer from attempting delivery twice in rapid succession.
The option graylist-max-secs
controls the maximum amount of time an
entry will remain valid after it is created. For example, if the value 604800
is given, a graylist entry will become invalid after 7 days. If the sender attempts
to deliver a message after the entry has expired, they will be graylisted again.
NOTE: A graylist entry's expiration date is reset each time a message passes the
filter. If the maximum age is 2 weeks and the sender sends a message every day,
their entry will never expire because it is continually reset.
As of 2008, not many ISPs are using graylisting yet, so it's still very effective. However, it won't be difficult for spammers to circumvent it (once enough ISPs have implemented it), so its effectiveness won't last forever.
Earlytalkers
greeting-delay-secs
Several years back, someone noticed that some spam software didn't follow the SMTP protocol. Specifically, spammers were opening connections to remote mail servers and pushing out all of the mail commands as quickly as they could, without waiting for (or checking) responses. By delaying the sending of the greeting banner, it's possible to catch these spammers and block them.
spamdyke will delay sending the opening greeting in order to wait for the sender
to send data. If that happens, spamdyke will block the connection. This is
activated with the greeting-delay-secs
option.
Unfortunately, as of 2007, spammers have mostly updated their software so this trick doesn't work any more. It still catches a few of them occasionally though.
Even if it doesn't catch the spammers any more, this is still a good test to run because it slows down the rate at which spammers can send email. Making it more expensive for them is not a bad thing.
Limiting Numbers of Recipients
max-recipients
RFC 821 says an SMTP server must allow the remote server to specify as many recipients as the SMTP server has memory to hold. This allows spammers to send a single message to (potentially) thousands of users in one connection.
spamdyke offers a way to violate the RFC by limiting the number of recipients per message. Once that number has been reached, the remaining recipients will be rejected. Legitimate mail servers use the multi-recipient feature as well, but they will retry their deliveries. Spammers generally don't.
This feature is activated by the max-recipients
option. By default,
spamdyke allows unlimited recipients per connection.
If you enable this feature, make sure all of your users are using SMTP AUTH or are allowed to relay or are whitelisted. Otherwise, their MUAs will show them error messages when they try to send to large address book mailing lists and they will complain. Loudly.
Timeouts
connection-timeout-secs
idle-timeout-secs
Most spam software is pretty stupid and doesn't handle error codes from SMTP servers. Instead, they send their commands and wait for specific responses. When those responses don't come, the software just sits forever and waits.
spamdyke will time out these connections in one of two ways. First, an absolute
time limit can be imposed on a connection. This is activated with the
connection-timeout-secs
option. If this feature is enabled, it should be
set to a very high value. Large (legitimate) messages can take a very long time
to deliver, especially if the link is slow. A value of 0
disables this feature.
By default, this feature is not activated.
Second, an idle time limit can be imposed on a connection. This is activated
with the idle-timeout-secs
option. If no data is received within
the given number of seconds, the connection is closed. A value of 0
disables this
feature. By default, this feature is not activated.
Extra Utilities
There are some additional programs included with spamdyke in the utils
folder.
They are:
- domain2path
- A utility for constructing rDNS folder paths from domain names. Useful in scripts. See rDNS Directories for details on domain2path.
- domainsplit
- A utility for finding the base domain name of a fully qualified
domain name. For example, given
foo.bar.baz.example.com
, domainsplit will return example.com. Also useful in scripts. - dnsa
- An example program that demonstrates finding DNS A records (IP addresses) for fully qualified domain names.
- dnsany
- An example program that demonstrates finding DNS records of "any" type (which doesn't actually return all types) for fully qualified domain names.
- dnsany_libc
- An example program that demonstrates finding DNS records of "any" type (which doesn't actually return all types) for fully qualified domain names. This version uses the system resolver library instead of sending UDP packets itself.
- dnscname
- An example program that demonstrates finding DNS CNAME records (alias names) for fully qualified domain names.
- dnsmx
- An example program that demonstrates finding DNS MX records (mail exchangers) for domain names.
- dnsns
- An example program that demonstrates finding DNS NS records (nameservers) for domain names.
- dnsptr
- An example program that demonstrates finding DNS PTR records (reverse DNS names) for fully qualified domain names or IP addresses.
- dnssoa
- An example program that demonstrates finding DNS SOA records (start-of-authority) for domain names.
- dnstxt
- An example program that demonstrates finding DNS TXT records (text information) for fully qualified domain names.
None of these utilities depend on being installed in any specific folder. None of them depend on the presence of the others or spamdyke. spamdyke does not require them or use them.