Re: [Exim] Thank you / POP-before-SMTP

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Sheldon Hearn
Ημερομηνία:  
Προς: Aaron B. Russell
Υ/ο: exim-users
Αντικείμενο: Re: [Exim] Thank you / POP-before-SMTP
On (2003/01/14 22:42), Aaron B. Russell wrote:

> Secondly, how would I go about setting up pop-before-smtp with Exim? Is
> this even possible? The official project website makes it look as if
> it's geared for being used with postfix...


The list archives contain an enormous amount of information on this
subject. In particular, my last post on this Subject is

    Message-ID: <20021024202817.GK47624@???>


That message gave complete instructions for setting up a pop-before-smtp
solution using a PostgreSQL database.

However, I recently tried something a little unusual. With the new
flexibility of Exim 4, I found it trivial to set up a pop-before-smtp
solution with absolutely no database at all!

It uses a directory tree, /var/db/popb4smtp, in which the existence of a
file represents a valid "popped recently token" for the IP address used
as the filename.

Basically, I use a script to grab authenticated IP addresses from the
log files of my POP3 and IMAP4 daemons. These are put in the popb4smtp
directory tree.

I use another script to periodically remove stale files from the tree.
I consider files stale after two hours. There's a small race condition
here; it's possible for a file to be deleted _just_ after it has been
updated by the script that watches the logs. For low-volume servers,
the odds of hitting this window are low.

Then, I create a POPB4SMTP_CLIENT macro in the Exim configure file to
provide a reusable "has this sender popped recently" query:

POPB4SMTP_SUBDIR = /var/db/popb4smtp/${substr_-1_1:$sender_host_address}
POPB4SMTP_CLIENT = ${if exists {POPB4SMTP_SUBDIR/$sender_host_address} \
    {$sender_host_address} {0} \
  }


Now you can use it just about anywhere, including in your ACLs. Simple
examples include:

hostlist relay_hosts = 127.0.0.1/32 : ... : POPB4SMTP_CLIENT
host_lookup = !127.0.0.1/32 : ... : !POPB4SMTP_CLIENT
rfc1413_hosts = !127.0.0.1/32 : ... : !POPB4SMTP_CLIENT

The two scripts (and a FreeBSD startup script for them) are available
for download at:

    http://people.FreeBSD.org/~sheldonh/popb4smtp-nodb.tar.gz


Ciao,
Sheldon.