Below is a strawman document that discussions possibilities and
limitations for the next steps in postscreen, on the way towards
becoming part of the stable release.
Wietse
Postscreen general operation
============================
Postscreen accepts SMTP connections, performs a number of tests to
determine if a client behaves like a spambot, and keeps suspected
spambots away from Postfix. With non-intrusive tests such as pregreet
or DNSBL, an SMTP client can pass the tests and deliver mail in the
same SMTP session; this is possible because postscreen can hand off
the session to a real Postfix SMTP server before the client sends
its first command. With intrusive tests such as greylist compliance
or improper command pipelining, a client cannot pass tests and
deliver mail in the SMTP same session; this is because postscreen
is not an SMTP proxy. Instead, Postscreen will reply with 4XX until
the client hangs up, and if the client passed the tests, it can
deliver mail when it opens a new session.
As clients complete their tests successfully, postscreen caches
their progress in a whitelist file so that clients can skip tests
in the near future. However, different tests have different costs,
and therefore different test results must have different whitelist
retention times. For example, 24-hour retention is OK for tests
that support mail delivery in the same SMTP session, while one week
or more retention is more suitable with tests that don't support
mail delivery in the same SMTP session.
End-user clients should not connect to a postscreen'ed server,
especially with tests that support mail delivery in the same SMTP
session. Instead, end-user clients should connect to the dedicated
submission port (tcp 587) and use authentication to get access to
Postfix.
Support for SASL authentication
===============================
Postscreen will not implement AUTH support, because it is too
problematic to provide 100% compatibility with the real Postfix
SMTP server. Instead, end-user clients should connect to the dedicated
submission port (tcp 587).
Even if Postfix would simply report success regardless of any AUTH
information the client sends, Postfix would still need to know how
to engage in all the challenge-response protocols that the real
Postfix SMTP server supports.
Support for STARTTLS
====================
Support for TLS will be added later in the postscreen life cycle.
TLS will require helper processes that implement the TLS protocol.
The performance is not critical (though TLS support may be resource
intensive). Since many sites implement TLS on the submission port
only, support for TLS is not urgent. Roughly, postscreen passes the
original SMTP socket to a TLS helper processes, and the helper
communicates SMTP plaintext with postscreen. The idea is to have
multiple TLS helper processes, each handling multiple TLS sessions;
this minimizes the memory overhead while keeping performance good.
Multi-line pregreet trap
========================
By default Postscreen greets a new SMTP client with a "220-" teaser
banner line, and waits for a configurable number of seconds. Any
client that responds during this time is considered a spambot.
Parameters: postscreen_greet_wait=time,
postscreen_greet_action=drop|continue
Reportedly, some appliances fall into the pregreet trap. Such clients
need to be excluded from all postscreen's tests. Mail from such
clients would be mis-handled because the client gets one protocol
step ahead of the server.
Parameters: postscreen_whitelist_networks=addresslist
When a client passes the pregreet and DNSBL tests, and there are
no further tests such as greylisting or pipelining, the client can
be handed off to Postfix and send mail in the same SMTP session.
Otherwise, the client can be handed off to a dummy protocol engine
that logs client, helo, sender, recipient information.
Silent pregreet trap
====================
We keep the option to wait for pregreet commands without sending a
"220-" teaser banner. This option exists primarily for Sendmail
emulation, as only few clients pregreet spontaneously.
Parameters: postscreen_greet_banner=text
When a client passes the pregreet and DNSBL tests, and there are
no further tests such as greylisting or pipelining, the client can
be handed off to Postfix and send mail in the same SMTP session.
DNS blocklists
==============
Postscreen can do multiple DNSBL lookups in parallel while waiting
for the pregreet test to complete. Some DNSBLs can return different
results for the same IP address, to indicate different varieties
of badness. To take advantage of all this information, postscreen
should support filters for different DNSBL queries and weights for
their results.
Parameters: postscreen_dnsbl_sites=domainlist (to be determined:
syntax for weights and filters), postscreen_dnsbl_drop_threshold=float
A client fails the DNSBL test when its combined DNSBL score exceeds
a configurable threshold.
When a client passes the pregreet and DNSBL tests, and there are
no further tests such as greylisting or pipelining, the client can
be handed off to Postfix and send mail in the same SMTP session.
Otherwise, the client can be handed off to a dummy protocol engine
that logs client, helo, sender, recipient information.
Greylisting
===========
Postscreen will implement greylisting with a dummy protocol engine
(i.e. without involving a real Postfix SMTP server process).
Postscreen will create a tentative database record for the client
after receiving a first (client-addr, sender, recipient) tuple,
and will reply with 4XX to all RCPT TO commands from that client.
The tentative database record expires when it is not updated within
a configurable amount of time.
Parameters: postscreen_greylist_confirm_time
It be unpractical for the greylist implementation to find out whether
a recipient address is valid. We will not worry about that now, and
assume that spambots will specify the target recipient whether they
talk to postscreen's greylister or to a real Postfix SMTP server.
Regardless of whether an address is valid, the greylister could
punish a client that sends a sender or recipient address that is
listed in a spamtrap table.
Parameters: postscreen_sender_spamtrap, postcreen_recipient_spamtrap
Subsequent repeats of same (client-addr, sender, recipient) tuple
will result in further 4XX RCPT TO replies until a configurable
time threshold is reached. After this threshold time, Postscreen
will update the tentative record for the client, and exclude the
client from the greylist test for a configurable amount of time.
Postscreen will then reply with 4XX to all RCPT TO commands (or to
all DATA or end-of-data commands if deeper protocol tests need to
be done). The SMTP client will eventually hang up, and if it passed
all tests, it can deliver its mail after it opens a new SMTP session.
Parameters: postscreen_greylist_threshold,
postscreen_greylist_retention_time
Note: after a client has confirmed a (client-addr, sender, recipient)
tuple, postscreen will whitelist that client for any (sender,
recipient) combination until the greylist test result expires.
An SMTP client is not allowed to talk to the Postfix SMTP server
until it passes the greylist test. A rejected client can be logged
with client, helo, sender, recipient information.
Deeper protocol checks
======================
With deeper protocol checks, postscreen would actually engage in a
mail transaction, without actually taking responsibility for mail.
Examples of deeper protocol checks are: improper command pipelining,
over-long SMTP commands, over-long header or body lines, MIME errors,
and so on (does it pay off to make this this plug-in extensible?).
To get deeper into the mail transaction without taking responsibility
for mail, postscreen would reply OK to RCPT TO, and would reply
with 4xx to DATA or END-OF-DATA.
Some of these protocol errors may be the result of bugs in legitimate
clients. For this reason the the errors would need to be weighted,
allowing clients to pass the test when their error score stays
below some threshold.