Author Topic: managesieve default rules missing  (Read 6194 times)

Offline pncx

  • Newbie
  • *
  • Posts: 4
managesieve default rules missing
« on: July 03, 2017, 09:28:58 AM »
I enabled the managesieve plugin in the RC installation I manage (ver.  0.7.2). Users see the filters tab and can create their own rules. Yet, I didn't manage to have a default vacatation rule shown for users without personal rules already set. In

/etc/roundcube/plugins/managesieve/config.inc.php

I defined

$rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/default.sieve';

and verified that /etc/dovecot/sieve/default.sieve is readable by the user under which the web server runs. Unfortunately, the default ruleset is completely empty. Just the default name is shown , as defined in

/usr/share/roundcube/plugins/managesieve/managesieve.php
[...]
                   if (empty($script_name))
                        $script_name = 'roundcube';
[...]

I've seen posts reporting the same problem, but couldn't find a solution.   
Should it help, I'm pasting the relevant output of dovecot -n below

Looking forward to hints and suggestions!

---

# 2.1.7: /etc/dovecot/dovecot.conf
# OS: Linux 3.2.0-4-amd64 x86_64 Debian 7.8 ext4
auth_mechanisms = plain login
mail_location = xxxxxxxxxx
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
namespace inbox {
  [...]
plugin {
  sieve = ~/.dovecot.sieve
  sieve_default = /etc/dovecot/sieve/default.sieve
  sieve_dir = ~/sieve
}
protocols = " imap sieve pop3"
[...]
}
[...]
protocol lda {
  mail_plugins = " sieve"
  postmaster_address = xxxxxxxxxx
}




Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: managesieve default rules missing
« Reply #1 on: July 04, 2017, 02:06:32 AM »
How was /etc/dovecot/sieve/default.sieve created? Rule files need to be written in a specifc format to be recognised by the managesieve plugin. I suggest that you use the plugin to create a ruleset that is the same as your default one and compare the 2 files.

Please consider updating your roundcube installation. 0.7.2 is over 5 years old now and hasn't had any security updates for a long time.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline pncx

  • Newbie
  • *
  • Posts: 4
Re: managesieve default rules missing
« Reply #2 on: July 04, 2017, 03:38:48 AM »
Hi JohnDoh, thanks a lot for your prompt reply. Indeed, I created the default rule using the plugin. I'm pasting it below

require ["vacation"];
# rule:[vacation]
if false #true
{
        vacation :days 7 :subject "Out of office" text:
Hi,
I'll be out of office for a while
.
;
}


I have the upgrade of Roundcube  in my ToDo list, thanks for your suggestion.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: managesieve default rules missing
« Reply #3 on: July 04, 2017, 05:05:11 AM »
does the user have any sieve script files at all, even if they are empty?. the default file is only used when the user does not have any script files at all.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline pncx

  • Newbie
  • *
  • Posts: 4
Re: managesieve default rules missing
« Reply #4 on: July 04, 2017, 10:13:58 AM »
When a user with no sieve scripts (namely, whose mailbox does not contains a sieve directory nor .dovecot.sieve symlink)  logins on the roundcube interface, a directory named sieve is created under his/her mailbox with a file named roundcube.sieve, which contains an empty script (and yes, also .dovecot.sieve and .dovecot.svbin are created). Correspondingly, under the filters tab in the web interface a ruleset named roundcube is visible, with no rules within.

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: managesieve default rules missing
« Reply #5 on: July 04, 2017, 11:32:56 AM »
I guess you could try debugging in managesieve.php around line 248 but it could be that what is wrong has already been fixed and if you update to a supported version the problem goes away.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline pncx

  • Newbie
  • *
  • Posts: 4
Re: managesieve default rules missing
« Reply #6 on: July 06, 2017, 08:29:16 AM »
Well, nobody knows a code better than its creator! Your original code assigned to $script_file the value set in <RC root>/plugins/managesieve/config.inc.php ; I forced 

$script_file = '/etc/dovecot/sieve/default.sieve';

and indeed, now, when a user with no sieve scripts defined logins to roundcube, he/she sees the default ruleset!

Therefore, either the call $this->rc->config->get('managesieve_default')  in  managesieve.php  doesn't collect any value from managesieve_default, or the assignment $rcmail_config['managesieve_default'] = '/etc/dovecot/sieve/default.sieve'; in managesieve/config.inc.php doesn't assign any value to managesieve_default .

Anyway, for the time being I'm happy with this hack, I'll report whether the problem persists or not  as soon as I upgrade Roundcube.

Thanks a lot indeed for your help!!!