On 18-Jan-2010, at 14:20, Stan Hoeppner wrote:
> /usr/bin/whtlst_gen.sh
> #! /bin/sh
> 
> # [1] grab all sent to addresses from the current mail log
> sed -n -e '/postfix\/smtp\[.*status=sent/s/^.*to=<\([^>]*\).*$/\1/p'
> /var/log/mail.log | sort -u > /tmp/sender_addrs.tmp
> 
> # merge the new addresses with the current list, eliminate dups
> cat /tmp/sender_addrs.tmp /etc/postfix/auto-whtlst.raw
> | sort | uniq > /tmp/wrkng-whtlst.tmp
> 
> # keep a copy without "OK" action for next processing iteration
> cp /tmp/wrkng-whtlst.tmp /etc/postfix/auto-whtlst.raw
> 
> # add "OK" action to each entry, generating new list file
> sed 's/$/  OK/g' /etc/auto-whtlst.raw > /etc/postfix/auto-whtlst
> 
> # regenerate hash
> /usr/sbin/postmap /etc/postfix/auto-whtlst


That's not that different from what pop-before-smtp does, and that works quite 
well, though it keeps a daemon running that watches the maillog file, which I 
suspect is much more efficient.

Certainly toward the end of the day that seed can take some time to run, I'd 
think.

Still, looks like a good starting point.

-- 
Man is born free, but is everywhere in chains.

Reply via email to