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.
Filters
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.
Filter Writing Guides and Examples
http://www.antagonism.org/mail/folder-creation-maildrop.shtml
http://www.courier-mta.org/maildrop/maildropfilter.html
Environment variables
The following snippet of code is a good opening for your filter script and will set some important variables for your script to use:
SHELL="/bin/sh"
import EXT
import HOST
VPOP="| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`
VDHOME=`dirname "$VHOME"`
logfile "/tmp/log-maildrop"Ensure delivery of messages
To make sure unfiltered messages get delivered, make sure to finish your filter with a line to deliver any unfiltered messages. If you don't, the messages will be quietly discarded! There's 2 options you can use depending on where the filter is being called from:
- Use this option to close out a user's mail filter and deliver the message to their Inbox. If you use this in a global filter, called via
.qmail-default, a user's.qmailfile won't be processed.
to "$VHOME/Maildir" - For a global filter, called from
.qmail-defaultthat will apply to all users, this is the best choice to use. The server will deliver the message using/home/vpopmail/bin/vdelivermailensuring that a user's own.qmailfile will be processed.
to "$VPOP"
Filter Installation
To call a mailfilter, create a /home/vpopmail/domains/<domain>/<user>/.qmail file, containing:
|/var/qmail/bin/preline /usr/local/bin/maildrop /home/vpopmail/domains<domain>/<user>/.mailfilterWorld-read permissions must not be enabled on that file, so we'll adjust it to the vpopmail user:
cd /home/vpopmail/domains/<domain>/<user>
chown vpopmail:vchkpw .qmail
chmod go-r .qmailThe .mailfilter file must also not be world-readable:
chown go-r .mailfilterLogging
Take advantage of our use of Multilog for logging maildrop actions by adding a logfile entry in your filter:
logfile "/tmp/log-maildrop"- Log in to post comments