SquidGuard is a URL redirector used to use blacklists with the proxysoftware Squid. There are two big advantages to squidguard: it is fast and it is free.
Qmail-Updater
The problem with mkvalidrcptto is that it needs to be run every time you add or remove an email address from your server. A simple way to do this would be to periodically run mkvalidrcptto
using a cron. While that would work, it's not that practical - a new email address added to your server won't function until that cron job has run. Run it too frequently and you waste processor time updating a file that probably doesn't need to be.
The onchange patch for vpopmail allows an external script to be run whenever it changes something. Configured as we installed vpopmail, that script would be /home/vpopmail/etc/onchange
.
Rather than simply using the onchange patch to run the mkvalidrcptto script, we're going to set up a daemontools service called qmail-updater that will run mkvalidrcptto when it is triggered by onchange. I highly recommend you read John's page on qmail-updater in order to get a better understanding of how it works.
daemontools service setup
Set up the daemontools service directory and the logging:
cd /var/service
mkdir -m 1755 qmail-updater
mkdir -m 755 qmail-updater/log
cd qmail-updater/log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run
Then set up the updater scripts:
cd ..
wget http://qmail.jms1.net/scripts/pipe-watcher
wget http://qmail.jms1.net/scripts/update-qmail
wget http://qmail.jms1.net/scripts/service-qmail-updater-run
mv service-qmail-updater-run run
chmod 755 pipe-watcher update-qmail run
We don't need to make any modifications to the update-qmail script as our program locations match those in the script already. So we can start the daemontools service:
ln -s /var/service/qmail-updater /service/
After about 10 seconds, confirm that the service is running:
svstat /service/qmail-updater/
Want to test that the service is running? In one shell session, as root, watch the qmail-updater log file:
tail -F /service/qmail-updater/log/main/current
In another shell session, as a non-root user, send some date to the named pipe:
echo testing > /tmp/update-qmail
Set up the onchange script
Download the onchange script from John Simpson's website:
cd /home/vpopmail/etc
wget http://qmail.jms1.net/scripts/onchange
chmod ugo+x onchange
For a good test of the whole setup, watch the qmail-updater log::
tail -F /service/qmail-updater/log/main/current
Then, in another shell session, use vpopmail to add an email account:
/home/vpopmail/bin/vadduser validrcptto@somedomain.com
The qmail-updater log should show that there were changes in the validrcptto.cdb file. The email account can be deleted:
/home/vpopmail/bin/vdeluser validrcptto@somedomain.com
Again, the log should show the change triggering qmail-updater.
- Log in to post comments
Credits
Various bits of code, scripts, and procedures were put together with information from John Simpson's qmail.jms1.net website. It's an excellent resource on managing and setting up a Qmail server.