here are some notes about how to get some sieve filtering action while using the Workaround ISP style email system. basically i use the workaround tutorial (with one slight modification), add pysieved and use the best webmail ever (squirrelmail of course) with the avelsieve plugin.
* goto http://woozle.org/~neale/src/pysieved/ and get pysieved-HEAD.tar.gz (this tutorial was done with version 1.0)
* unpack the archive in /usr/local/ and copy the conf file to /usr/local/etc/
cd /usr/local cp /wherever/you/downloaded/pysieved-HEAD.tar.gz . tar xvf pysieved-HEAD.tar.gz cp /usr/local/pysieved/pysieved.ini /usr/local/etc/
* edit /usr/local/etc/pysieved.ini
A lot of things need to be changed: so here is basically the entire file with only the necessary stuff (plus the bindaddr which can be useful)./usr/local/etc/pysieved.ini:
[main] # Authentication back-end to use auth = Dovecot # User DB back-end to use userdb = Dovecot # Storage back-end to use storage = Dovecot # Bind to what address? (Ignored with --stdin) #bindaddr = 127.0.0.1 # Listen on what port? (Ignored with --stdin) port = 2000 # Write a pidfile here pidfile = /var/run/pysieved.pid # What UID and GID should own all files? -1 to not bother uid = -1 gid = -1 # Switch email@example.com to host.name/user? hostdirs = False [Dovecot] # Path to Dovecot's auth socket (do not set unless you're using Dovecot auth) mux = /var/spool/postfix/private/auth # Path to Dovecot's master socket (if using Dovecot userdb lookup) master = /var/run/dovecot/auth-master # Path to sievec sievec = /usr/lib/dovecot/sievec # Where in user directory to store scripts scripts = pysieved # Filename used for the active SIEVE filter (see README.Dovecot) active = .dovecot.sieve # What user/group owns the mail storage (-1 to never setuid/setgid) uid = -1 gid = -1
* edit and reload inted
echo "sieve stream tcp nowait root /usr/bin/python python /usr/local/pysieved/pysieved.py --inetd" >> /etc/inetd.conf /etc/init.d/openbsd-inetd restart
for some reason i thought there was a lot to do here, actually it's a bit "too" easy.. : ]
* on a working squirrelmail configuration, we need to:
- download the avelsieve plugin to the appropriate folder from author's siteor squirrelmail plugin page.
- expand the archive
- copy the config_sample to config.php
cd /path/to/squirrelmail/plugins/ cp /wherever/you/downloaded/avelsieve-1.9.7.tar.gz . tar zxvf avelsieve-1.9.7.tar.gz cp avelsieve/config/config_sample.php avelsieve/config/config.php
execute conf.pl (in /path/to/squirrelmail/config) to activate the plugin
(optional): i changed one line in the dovecot.conf file, just to have more "space"
mail_location = maildir:/home/vmail/%d/%n
mail_location = maildir:/home/vmail/%d/%n/maildir
NOTE: if your mail server has already received emails before this you might have to "mv" some stuff from the /home/vmail/domain.tld/user/ to /home/vmail/domain.tld/user/maildir/ after /home/vmail/domain.tld/user/ should look like:
lrwxrwxrwx 1 vmail vmail 18 2008-05-16 12:41 .dovecot.sieve -> pysieved/phpscript drwx------ 9 vmail vmail 4,0K 2008-05-15 20:34 maildir drwxr-xr-x 2 vmail vmail 4,0K 2008-05-16 12:41 pysieved
and /home/vmail/domain.tld/user/maildir/ shoud look like:
drwx------ 2 vmail vmail 4,0K 2008-05-15 20:30 cur -rw------- 1 vmail vmail 168 2008-05-15 20:30 dovecot.index -rw------- 1 vmail vmail 17K 2008-05-15 20:32 dovecot.index.cache -rw------- 1 vmail vmail 756 2008-05-15 20:32 dovecot.index.log -rw------- 1 vmail vmail 89 2008-05-15 20:30 dovecot-uidlist drwx------ 5 vmail vmail 4,0K 2008-05-15 20:34 .INBOX.Drafts drwx------ 5 vmail vmail 4,0K 2008-05-15 20:34 .INBOX.Sent drwx------ 5 vmail vmail 4,0K 2008-05-15 21:46 .INBOX.spam drwx------ 5 vmail vmail 4,0K 2008-05-15 20:25 .INBOX.Trash drwx------ 2 vmail vmail 4,0K 2008-05-15 20:30 new -rw------- 1 vmail vmail 47 2008-05-15 20:34 subscriptions drwx------ 2 vmail vmail 4,0K 2008-05-15 20:30 tmp
Minor glitches (and some fixes)
there are a couple of things you should know:
- * once a user adds his own sieve filter it deactivates the globalsieve filter, meaning spam will no longer be filtered. the first rule to be added should be a spam rule.
- * deleting rules works fine EXCEPT that there must always remain at least one rule and that last rule can be disabled. HOWEVER, there is a FIX, thanks Mike Lewinski, the file table.php needs to be patched, hereis how:
cd /path/to/squirrelmail/plugins/avelsieve/ cp table.php table.bak wget http://www.rockynet.com/patches/table.patch patch table.php table.patch
and voilà, you can now erase all rules.
that should be all, you can now enjoy sieve filters. .. yay. o/