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

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Aaron B. Russell
Datum:  
To: Sheldon Hearn
CC: exim-users
Betreff: Re: [Exim] Thank you / POP-before-SMTP
Wow, thanks, that helped _amazingly_. I created a startup script for
Redhat, which I would attach, but I figure some other people on the
mailing list might want it, so I'll put it in the message body below.

Aaron B. Russell
Senior Solutions Developer
Rocket Dog Creative

==[START]==
#!/bin/bash
#
# popb4smtp    Script to start/stop popb4smtp daemons.
#
# Author:       Aaron B. Russell <arussell@???>
#
# chkconfig: 2345 20 80
# description: Script to start/stop popb4smtp daemons.


# Source function library.
. /etc/init.d/functions

# See how we were called.
case "$1" in
     start)
         echo -n $"Starting popb4smtp-watch daemon:"
         su -s /bin/bash - -c /usr/local/sbin/popb4smtp-watch &
         echo_success
         echo
         echo -n $"Starting popb4smtp-clean daemon:"
         su -s /bin/bash - -c /usr/local/sbin/popb4smtp-clean &
         echo_success
         echo
     ;;
     stop)
        echo -n $"Shutting down popb4smtp-watch daemon: "
         killproc popb4smtp-watch
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && rm -f /var/run/popb4smtp-watch.pid
         echo -n $"Shutting down popb4smtp-clean daemon: "
         killproc popb4smtp-clean
         RETVAL=$?
         echo
         [ $RETVAL = 0 ] && rm -f /var/run/popb4smtp-clean.pid
    ;;
*)
    echo "Usage: `basename $0` {start|stop}" >&2
    exit 64
    ;;
esac


exit 0
==[END]==

On Wednesday, January 15, 2003, at 10:35 am, Sheldon Hearn wrote:
> 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.