ISPConfig 3 move junk + Roundcubemail managesieve plugin = filters ignored

Discussion in 'Installation/Configuration' started by ircf, Nov 13, 2014.

  1. ircf

    ircf Member

    Hello,

    Yesterday we enabled the ISP Config "move to junk" function on our mailboxes. This created a .sieve file on each mailbox that is used by dovecot/sieve to do the job.

    Our customers also use the Roundcubemail managesieve plugin, which allows them to create very precise rules (more precise than the ispconfig roundcube plugins). Rules created by this plugin are stored in the user's sieve directory (sieve_dir)

    It seems that since the user's .sieve file is enabled, then rules in the user's sieve dir are ignored.

    Does anyone know how we can have both working please ? Should I remove the "keep;" at the end of the ISP Config .sieve template ?

    EDIT1 : I tried to remove the "keep;" instruction without success, I also tried to move the .sieve file into the sieve_dir, but it didn't work either... For now the only fix is to paste rules directly into the .sieve file,

    EDIT2 : I found out that when managesieve is used, it creates a symlink from the .sieve file to sieve/filter-group.sieve, so the ISP Config .sieve file won't work anymore. On the other hand, when "move junk" is changed, ISP Config overwrites the .sieve file, so it disables managesieve filters. So either I should modify ISP Config or managesieve. What do ou think is the best ?

    Thank you.

    Dovecot configuration /etc/dovecot/dovecot.conf :

    Code:
    listen = *,[::]
    protocols = imap pop3 sieve
    auth_mechanisms = plain login
    disable_plaintext_auth = no
    log_timestamp = "%Y-%m-%d %H:%M:%S "
    mail_privileged_group = vmail
    ssl_cert = </opt/ssl/ircf.crt
    ssl_key = </opt/ssl/ircf.key
    passdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    userdb {
      args = /etc/dovecot/dovecot-sql.conf
      driver = sql
    }
    plugin {
      quota = dict:user::file:/var/vmail/%d/%n/.quotausage
      sieve=/var/vmail/%d/%n/.sieve
      sieve_dir = /var/vmail/%d/%n/sieve/
      sieve_global_dir = /etc/dovecot/sieve 
      sieve_before = /etc/dovecot/sieve/before.d
      sieve_after = /etc/dovecot/sieve/after.d
    }
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
      }
      unix_listener auth-userdb {
        group = vmail
        mode = 0600
        user = vmail
      }
      user = root
    }
    service imap-login {
      client_limit = 1000
      process_limit = 500
    }
    protocol imap {
      mail_plugins = quota imap_quota
    }
    protocol pop3 {
      #pop3_uidl_format = %08Xu%08Xv
      pop3_uidl_format = UID%u-%v
      mail_plugins = quota
      pop3_reuse_xuidl = yes
      pop3_save_uidl = yes
    }
    protocol lda {
      mail_plugins = sieve quota
    }
    
    User's .sieve file when "move to junk" is enabled (sample) :

    Code:
    require ["fileinto", "regex", "date", "relational", "vacation"];
    
    
    # Move spam to spam folder
    if header :contains "X-Spam-Flag" "YES" {
      fileinto "Junk";
      # Stop here so that we do not reply on spams
      stop;
    }
    
    keep;
    
    
    Rules in user's sieve dir (sample) : sieve/roundcube.sieve

    Code:
    require ["body","fileinto"];
    # rule:[Newsletters]
    if anyof (exists "List-Unsubscribe", body :text :contains "unsubscribe", body :text :contains "désabonn", body :text :contains "desabonn", body :text :contains "plus recevoir", body :text :contains "désabonner")
    {
    	fileinto "Newsletters";
    }
     
    Last edited: Nov 13, 2014
  2. ircf

    ircf Member

    Quick (and dirty) fix

    For now, the simplest fix I found is in two parts :

    1. Set sieve_before in /etc/dovecot/dovecot.conf to the user's sieve_dir, so every sieve script (managesieve) will be executed before the .sieve (isp config) script :
    Code:
    sieve_before = /var/vmail/%d/%n/sieve
    2. Comment the enable/disable feature for filter groups in roundcubemail/plugins/managesieve/skins/larry/managesieve.html, so that managesieve won't overwrite the .sieve file :

    HTML:
    <!-- <li role="menuitem"><roundcube:button command="plugin.managesieve-setact" label="managesieve.enable" classAct="active" /></li>-->
     

Share This Page