Mark Goodge:
> What would be the simplest method in Postfix of implementing an
> equivalent to the exim ACL mentioned in this blog post:
>
> http://blog.hinterlands.org/2013/10/unwanted-email-from-communicado-ltd/
>
> That is, what's the simplest way of rejecting email from a list of
> domains contained within a simple text file that can be updated
> regularly without needing to restart Postfix.
No need to restart Postfix. Use an indexed file and let smtpd(8)
auto-detect that the file has changed.
Run this from cron:
#!/bin/sh
# Configure smtpd(8) to query $TYPE:real-file
TYPE=cdb # or hash or lmdb
SUFF=cdb # or db or lmdb
URL=http://example.com/file.txt
test -f old-file || touch old-file
wget -O new-file $URL && test -s new-file && {
cmp -s old-file new-file || {
postmap $TYPE:new-file && mv new-file.$SUFF real-file.$SUFF
mv new-file old-file
}
}
In particular, LMDB as of postfix-2.11-20131122 no longer restarts
a daemon and picks up changes immediately. With cdb and hash, the
changes are detected at the start of a new SMTP session and then
smtpd(8) restarts.
Wietse