Dovecot and Sieve are working, but Sieve not delivery mail.

I’m working into a VPS installed on Ubuntu 18.04 LTS, with Virtualmin.
Now I’ve installed Sieve and activated plugin in RC, but the filters are not working.

From the command line,
telnet name.my-domain.tld 4190 I see:
Trying MY-IP-ADDRESS…
Connected to name.mydomain.tld.
Escape character is ‘^]’.
“IMPLEMENTATION” “Dovecot (Ubuntu) Pigeonhole”
“SIEVE” “fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext”
“NOTIFY” “mailto”
“SASL” “PLAIN LOGIN”
“STARTTLS”
“VERSION” “1.0”
OK “Dovecot (Ubuntu) ready.”

So, It seems that both Dovecot and Sieve are working but the two do not interact with each other.

Furthermore, in the Managesieve plugin of RC there is the file: managesieve.php with references about “vacation”, but in Sieve I don’t find anything related to the management of the vacation.
Where is this management and the relative filter?

Thanks in advance for the help.

These are the configuration files in Dovecot (without comment).

/etc/dovecot/dovecot.conf
## Dictionary server settings

dict {
#quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
#expire = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}

!include conf.d/*.conf

!include_try local.conf
local_name nameserver.my-domain.tld {
ssl_cert = </home/server1/ssl.cert
ssl_key = </home/server1/ssl.key
}
local_name domain2-tld {
ssl_cert = </home/user1/ssl.cert
ssl_key = </home/user1/ssl.key
}

/etc/dovecot/conf.d/15-lda.conf
postmaster_address = postmaster@my-domain.tld

protocol lda {

Space separated list of plugins to load (default is global mail_plugins).

#mail_plugins = $mail_plugins
mail_plugins = $mail_plugins sieve
}

/etc/dovecot/conf.d/20-lmtp.conf
protocol lmtp {
postmaster_address = postmaster@my-domain.tld
mail_plugins = $mail_plugins sieve
}

/etc/dovecot/conf.d/90-sieve.conf
plugin {
sieve = file:~/sieve;active=~/.dovecot.sieve
sieve_default = /var/lib/dovecot/sieve/default.sieve

sieve_global_dir = /var/lib/dovecot/sieve/
sieve_global_path = /var/lib/dovecot/sieve/default.sieve
}

In ~/sieve there is the file roundcube.sieve with my filters creted in RC.
roundcube.sieve
require [“fileinto”];

rule:[ZZZ-Test]

if header :contains “subject” “ZZZ-Test”
{
fileinto “ZZZ-Test”;
}

rule:[User 1]

if header :is “from” “user1@domain.tld”
{
fileinto “ZZZ-Test”;
}

Howdy,

Note that Virtualmin doesn’t use Sieve for email delivery, it uses procmail. That’s configured in Postfix, using the “mailbox_command” option.

Virtualmin uses procmail filters to handle it’s SpamAssassin and ClamAV features, amongst other things.

You may be able to use Sieve in place of procmail if need be, though note that we haven’t tested that (and we couldn’t officially support it) – and it would mean you’d need to come up with your own way to handle SpamAssassin and ClamAV processing, as Virtualmin’s method for handling that would not longer work.

-Eric

OK, thanks

Howdy,

maybe you’ve already found a solution, or I can offer you mine.

I use Sieve since 2012 under Ubuntu 14.x LTS, Ubuntu 16.x LTS and now under Ubuntu 18.x LTS in a multidomain environment with Virtualmin|Webmin as server frontend.
Also originally these links came to my aid, I would like to thank the authors here for their help:

  1. https://blog.lorenzbausch.de/2013/07/15/virtualmin-enable-sieve-for-dovecot-and-procmail/
  2. https://www.virtualmin.com/node/38214
and it works :-D

Installation:

    apt install dovecot-managesieved dovecot-sieve php-net-sieve

The following files must now be edited:

  • /etc/dovecot/conf.d/15-lda.conf

    # %d for each domain on your server postmaster_address = postmaster@%d

    protocol lda {

    Space separated list of plugins to load (default is global mail_plugins).

    #mail_plugins = $mail_plugins
    mail_plugins = $mail_plugins sieve
    }

  • /etc/dovecot/conf.d/20-managesieve.conf

    service managesieve-login { inet_listener sieve { port = 4190 } }
  • Edit /etc/procmailrc and fill in the DELIVER parts. It’s important to make continued use of procmail because spam filtering is done there.

    # Comment everything out and add the following commands: # cat /etc/procmailrc

    DELIVER=/usr/lib/dovecot/deliver
    LOGFILE=/var/log/procmail.log
    TRAP=/etc/webmin/virtual-server/procmail-logger.pl
    :0wi
    VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl $LOGNAME
    EXITCODE=$?
    :0

    • ?/usr/bin/test “$EXITCODE” = “73”
      /dev/null
      EXITCODE=0
      :0
    • ?/usr/bin/test “$VIRTUALMIN” != “”"
      {
      INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
      }
      DEFAULT=$HOME/Maildir/
      ORGMAIL=$HOME/Maildir/
      DROPPRIVS=yes
      :0 w
      | $DELIVER
      :0
      $DEFAULT
################################################################################## Restart Dovecot-server with the settings changed here. Sieve should now work.

#####################################################################################################
Your other *confs in the post should only be changed according to your server config, for the basic work no changes are expected from Sieve.

  • /etc/dovecot/conf.d/20-lmtp.conf # Only when needed, in principle it is not needed protocol lmtp { postmaster_address = postmaster@my-domain.tld mail_plugins = $mail_plugins sieve }
  • /etc/dovecot/conf.d/90-sieve.conf # Only when needed, in principle it is not needed plugin { sieve = file:~/sieve;active=~/.dovecot.sieve sieve_default = /var/lib/dovecot/sieve/default.sieve
    sieve_global_dir = /var/lib/dovecot/sieve/ 
    sieve_global_path = /var/lib/dovecot/sieve/default.sieve 
    

    }

  • /etc/dovecot/dovecot.conf # Here you don't have to add or change anything extra

…and by the way, look at the free webmailer “Rainloop” as an alternative to ‘Roundcube’.

Translated with www.DeepL.com/Translator