This is an updated set of instructions as of Dec 2021. My goals:
- Don’t break Spamassassin/Procmail
- Enable the use of (very efficient, powerful, and standards-based) Sieve filtering in Virtualmin
- Enable some form of GUI filter editing if at all possible
- And do it without draining the limited resources of the Virtualmin team
STEPS
- Install new software in Virtualmin
- Configuration files
- Verify all is well
- Add Sieve GUI editor to Thunderbird or other client software
1. Install
apt install dovecot-managesieved
(This will auto-install dovecot-sieve)
2. Configuration files
1. /etc/dovecot/conf.d/15-lda.conf
Add sieve as a plugin. You may have others already. By default, the line to edit will now look like this
mail_plugins = $mail_plugins sieve
- NOTE: try grep mail_plugins conf.d/ – If any other files have uncommented $mail_plugins lines, add sieve to those as well
2. /etc/dovecot/conf.d/20-managesieve.conf
This file is installed in step 1, but nothing is enabled. My changes involved:
- Uncommenting the protocols line to add sieve protocol
# Uncomment to enable managesieve protocol: protocols = $protocols sieve
- Uncommenting the managesieve-login service (Important: there are FIVE required lines, incl one at the end of the block! The sample has a lot more; I made no other changes.)
service managesieve-login { inet_listener sieve { port = 4190 } }
- Uncommenting the protocol sieve block (just the start and end-- I didn’t change anything else)
protocol sieve { }
- Add two lines to the end of /etc/procmailrc (you can do this in the webmin GUI if you like)
:0 w /usr/lib/dovecot/deliver
- NOTE: Depending on your linux distro, that path to the deliver app may be different
3. Verify
service dovecot restart
lsof -i:4190
The lsof should show listener(s) on sieve (4190) port
If you have firewalls, ensure port 4190 is enabled, just like other mail ports (25, 110, 465, 587, 993, 995)
4. Add Sieve GUI editor
- Several mail clients support the Sieve Management protocol!
- For my use case, I installed the Thunderbird client solely for sieve script viewing and editing. I don’t use Thunderbird for anything else.
So, for example:
- Download and install the Thunderbird client
- Set up imap email connection to a user on your server. Save PW in the PW manager (Sieve needs it to connect)
- Menu (top-right), go to Addons & Themes, and install the Sieve addon
- Menu->Tools->Sieve Message Filters (a separate menu choice from Tools->Message Filters)
- NOTE: One (primary) script is “Active”, while many others can be Included from the Primary script. Sieve can edit any/all, either raw or with a smart editor
Sources
https://archive.virtualmin.com/node/66409 (2019 example, especially the final comment)
https://www.experimental-engineering.co.uk/2017/07/20/virtualmin-mail-enabling-sieve-support/ (2017 example)
https://archive.virtualmin.com/node/38214 (2015 example)
Virtualmin: Enable Sieve for Dovecot and Procmail | blog.lorenzbausch.de (2013 example)
SYSTEM INFORMATION | |
---|---|
Operating system Debian Linux 10 | |
Webmin version 1.981 | |
Usermin version 1.823 | |
Virtualmin version 6.17-3 | |
Authentic theme version 19.83-2 |