This howto describes howto install a sieve manager in squirrelwebmail to do server based filtering. It will work only with the dovecot e-mail daemon. (See http://www.isp-control.net/documentation/howto/mail/replace_courier_with_dovecot for install instructions) ====== 1. Install needed utilities ====== > apt-get install cogito curl python subversion ====== 2. Install pysieved ====== > cd /usr/local/lib > cg-clone http://woozle.org/~neale/repos/pysieved > mkdir /usr/local/etc > mv /usr/local/lib/pysieved/pysieved.ini /usr/local/etc > mkdir /var/run/pysieved/ > chown vmail:mail /var/run/pysieved ====== 3. Create a start script ====== Create a startup skript /etc/init.d/pysieved: #!/bin/sh case $1 in start) /usr/bin/python /usr/local/lib/pysieved/pysieved.py echo "Starting sieve daemon: pysieved." ;; stop) kill $(cat /var/run/pysieved/pysieved.pid) echo "Stopping sieve daemon: pysieved." ;; *) echo "Usage: /etc/init.d/pysieved {start|stop}" ;; esac Set execute permission to the file: > chmod +x /etc/init.d/pysieved ====== 4. Configure pysieved ====== Create the file /usr/local/etc/pysieved.ini with following content:[[BR]] (There are uids and gids 'hardcoded'. The uid must be changed to the uid of the vmail user and the gid to the gid of the mail group. Debian IspCP defaults are: uid 1001, gid 8) [main] auth = Dovecot userdb = Dovecot storage = Dovecot port = 2000 pidfile = /var/run/pysieved/pysieved.pid [Virtual] base = /var/mail/virtual/ uid = 1001 gid = 8 hostdirs = True [Dovecot] mux = /var/run/pysieved/auth master = /var/run/pysieved/auth-master sievec = /usr/lib/dovecot/sievec scripts = .pysieved uid = 1001 gid = 8 ====== 5. Configure dovecot ====== Open your /etc/dovecot/dovecot.conf and add this line mail_plugins = cmusieve to the "protocol lda" like this: protocol lda { postmaster_address = postmaster@yourdomain.tld auth_socket_path = /var/run/dovecot/auth-master mail_plugins = cmusieve } After that add the following lines to end of the file: auth pysieved { mechanisms = plain passdb sql { args = /etc/dovecot/dovecot-sql-domain.conf } userdb sql { args = /etc/dovecot/dovecot-sql-domain.conf } passdb sql { args = /etc/dovecot/dovecot-sql-subdomain.conf } userdb sql { args = /etc/dovecot/dovecot-sql-subdomain.conf } socket listen { client { path = /var/run/pysieved/auth mode = 0660 user = vmail group = mail } master { path = /var/run/pysieved/auth-master mode = 0660 user = vmail group = mail } } user = vmail } ====== 6. Configure postfix ====== Change the following line in /etc/postfix/master.cf accordingly: dovecot unix - n n - - pipe flags=DRhu user=vmail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} Be careful with the line above. There is a space where ====== 7. Install avelsieve plugin in squirrelmail ====== > cd /var/www/ispcp/gui/tools/webmail/plugins/ > svn export https://email.uoa.gr/repos/squirrelmail/avelsieve/main_plugin/trunk/ avelsieve add following line to /var/www/ispcp/gui/tools/webmail/config/config.php below the already defined $plugins. (26 is the correct index for new ispCP installation. If you have added some plugins you have to change the number accordingly) $plugins[26] = 'avelsieve'; set the correct permissions: > chown -R vu2000:www-data /var/www/ispcp/gui/tools/webmail/plugins/avelsieve/ create config file: > cd /var/www/ispcp/gui/tools/webmail/plugins/avelsieve/config > cp config_sample.php config.php the following configuration item has to be changed in the config.php: $avelsieve_striproot = 'INBOX.'; 8. Fix a problem with imap namespace[[BR]] (This is only nescessary if you use dovecot 1.0. In version 1.1 of dovecot, deliver supports the namespace prefix INBOX.) Add the following lines to the file[[BR]] /var/www/ispcp/gui/tools/webmail/plugins/avelsieve/include/sieve_buildrule.inc.php after case '5': (around line 560) if (substr($rule['folder'],0,6) == 'INBOX.') { $rule['folder'] = substr($rule['folder'],6); } ====== 9. Restart the daemons ====== > /etc/init.d/pysieved start > /etc/init.d/dovecot restart > /etc/init.d/postfix restart ====== 10. Create a startup link for pysieved ====== > update-rc.d pysieved defaults 92 08 ====== 11. Test it ====== You should now find a register ''Message Filtering'' in the 'Options' menu from squirrel mail where you can add your server based filtering rules. ====== 12. Enable another language ====== If your squirrelmail is installed in another language as en_US you translate avelsieve too: > apt-get install gettext > cd /var/www/ispcp/gui/tools/webmail/plugins/avelsieve/po > ./compileallpo > ./xgetpo > /etc/init.d/apache2 restart But the translations are not very complete. Updated german language-file is available in the board: http://www.isp-control.net/forum/new-german-languagefile-for-avelsieve-t-2130.html ====== 13. Thats it ======