Roundcube Community Forum

 

Sieverules (managesieve) plugin

Started by zoc, May 09, 2009, 05:35:25 AM

Previous topic - Next topic

get.the.MaX

Rules from sieverules stored in
/home/vmail/domain.com/username/sieve

dovecot.conf
 
  sieve = ~/dovecot.sieve
  sieve_dir = ~/sieve


Now dovecot looks for dovecot.sieve in the users homefolder, but the sieverules is stored in homefolder/sieve.

Managesieve will automaticly set a sysmlink in homefolder
dovecot.sieve to sieve/roundcube.sieve. Sieverules dont do that, and that is my problem. Any suggestions?

JohnDoh

Could you tell me a little bit more about your setup please to help trace the problem?

If you have sieverules setup to use a single ruleset then that ruleset will be actiated when you press save, if you are using multiple rulesets then you need to press the activate button in the top right.

Could you tell me if you are using an existing ruleset which is not being activated or a new one? Also what version of dovecot sieve are you running?

thanks
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

get.the.MaX

Dovecot Version 1.2.7
Sieve Version Dovecot 1.2 Sieve 0.1.9

For testing i had only a single ruleset. This rule is saved to myhomefolder/sieve.
Now the only problem is, that sieverules dont set a link from the homefolder to sieve/roundcube.sieve.

In my dovecot.conf i have to set:

  ### Sieve per User ###
  sieve = ~/dovecot.sieve #The location of the user's active script:

   # directory.
  sieve_dir = ~/sieve #The include extension fetches the :personal scripts from this
   # directory.



protocol lda {
..
  mail_plugins = sieve
}

JohnDoh

#138
sorry to ask you to repeat yourself again but when you said "Managesieve will automaticly set a sysmlink in homefolder" where you talking about dovecot managesieve or the rc plugin called manage sieve.

In the sections you posted from your config above the frist one is in plugin { } section correct?

if you were not talking about the other rc plugin earlier then please do one other quick test, try hard codiging this path  sieve = ~/dovecot.sieve #The location of the user's active script just to make sure there isnt some problem with diecting the home dir.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

get.the.MaX

Yes the roundcubeplugin sets the link, not dovecots managesieve.


sieve = ~/sieve/roundcube.sieve


When you click on filters in roundcube, there is a loop. Here is the error from mail.log


sieve-storage: Active sieve script symlink /home/vmail/example.com/max/sieve/roundcube.sieve is no symlink.

pela020

I'm running dovecot IMAP with virtual domains and users.

I got sieverules working on a domain level but I just can't figure out how to make it work per user. When I log in as one user I can make filters and they will work just fine.

The problem is when I log in as another user on the same virtual domain i see the same set of rules and can change them. Does anyone ever had a similar problem?

Roundcube 0.3.1-20091031
Dovecot 1.1.11
Sieverules 1.5

Here is my output from dovecot -n if anybody can se a problem there.

# 1.1.11: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.31-17-generic-pae i686 Ubuntu 9.10 ext4
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot
info_log_path: /var/log/dovecot-info.log
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: imap pop3 imaps pop3s managesieve
ssl_cert_file: /etc/ssl/smtpd.crt
ssl_key_file: /etc/ssl/smtpd.key
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
valid_chroot_dirs: /var/spool/vmail
mail_location: maildir:/home/vmail/%d/%n
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
sieve_storage(default):
sieve_storage(imap):
sieve_storage(pop3):
sieve_storage(managesieve): ~/sieve
sieve(default):
sieve(imap):
sieve(pop3):
sieve(managesieve): ~/.dovecot.sieve
auth default:
  mechanisms: plain login
  verbose: yes
  passdb:
    driver: passwd-file
    args: /etc/dovecot/passwd
  userdb:
    driver: passwd-file
    args: /etc/dovecot/users
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
      group: vmail
plugin:
  sieve: ~/.dovecot.sieve
  sieve_dir: ~/sieve

pela020

I'm running dovecot IMAP with virtual domains and users.

I got sieverules working on a domain level but I just can't figure out how to make it work per user. When I log in as one user I can make filters and they will work just fine.

The problem is when I log in as another user on the same virtual domain i see the same set of rules and can change them. Does anyone ever had a similar problem?

Roundcube 0.3.1-20091031
Dovecot 1.1.11
Sieverules 1.5

Here is my output from dovecot -n if anybody can se a problem there.

# 1.1.11: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.31-17-generic-pae i686 Ubuntu 9.10 ext4
base_dir: /var/run/dovecot/
log_path: /var/log/dovecot
info_log_path: /var/log/dovecot-info.log
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: imap pop3 imaps pop3s managesieve
ssl_cert_file: /etc/ssl/smtpd.crt
ssl_key_file: /etc/ssl/smtpd.key
disable_plaintext_auth: no
login_dir: /var/run/dovecot/login
login_executable(default): /usr/lib/dovecot/imap-login
login_executable(imap): /usr/lib/dovecot/imap-login
login_executable(pop3): /usr/lib/dovecot/pop3-login
login_executable(managesieve): /usr/lib/dovecot/managesieve-login
valid_chroot_dirs: /var/spool/vmail
mail_location: maildir:/home/vmail/%d/%n
mail_executable(default): /usr/lib/dovecot/imap
mail_executable(imap): /usr/lib/dovecot/imap
mail_executable(pop3): /usr/lib/dovecot/pop3
mail_executable(managesieve): /usr/lib/dovecot/managesieve
mail_plugin_dir(default): /usr/lib/dovecot/modules/imap
mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3
mail_plugin_dir(managesieve): /usr/lib/dovecot/modules/managesieve
sieve_storage(default):
sieve_storage(imap):
sieve_storage(pop3):
sieve_storage(managesieve): ~/sieve
sieve(default):
sieve(imap):
sieve(pop3):
sieve(managesieve): ~/.dovecot.sieve
auth default:
  mechanisms: plain login
  verbose: yes
  passdb:
    driver: passwd-file
    args: /etc/dovecot/passwd
  userdb:
    driver: passwd-file
    args: /etc/dovecot/users
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
      group: vmail
plugin:
  sieve: ~/.dovecot.sieve
  sieve_dir: ~/sieve

internalkernel

#142
I just got all this installed and configured... and having a slight problem getting the rules to "stick".

They seem to work fine, according to testing I did to make sure the headers information was working - i.e filter according to sender, recipient, copy, etc.

However, when I make the filters... sometimes it works and sometimes it doesn't. I have a large amount of filter criteria for a certain folder, maybe 20 criteria (for mailing lists). I'll got through and enter each criteria, select the destination folder and hit save... it reports filter saved. Then on a refresh, the filter is either gone or empty.

Looking in the %u/sieve/roundcube.sieve file, I see part of the filter has been saved. It seems to only record about 12 to 13 of the entries, and misses the fileinto directive.

This is dovecot 1.1.11, ubuntu 9.10, rcube 0.3.1 - latest download of sieverules

I was also looking at trying to enable the ingo filter importer, but I didn't see the option for it. I have a working Ingo installation side by side with this (trying to migrate to Rcube as I think it will be easier on my users). If you want any help testing that, I'd be happy to work with it. My php kung-fu is not exactly street worthy though...

Thanks for the work!

After working with this some more... 12 is the magic number... once more than 12 entries are made, the filter rule is created but it cuts off the fileinto directive. As an aside, I can directly edit the file and add the extra rule criteria after which it will show up in rcube properly.

adlerweb_

OK, i think i found the bug...

Before roundcube r731 (think release 0.1-r1) it used ASCII as default character encoding for its session-table. It was changed (bug #1484456) but they only updated the initial SQL, the update.sql does not contain any conversion. As long as you don't disable caching the plugin will save rules inside the session - if there any UTF8-Chars the SQL-query breaks and rc killes the session.

Quick and dirty fix:
ALTER TABLE `session`  ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
ALTER TABLE `session` CHANGE `sess_id` `sess_id` VARCHAR( 40 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `ip` `ip` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
CHANGE `vars` `vars` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL


If you have a database that was created with a early rc-version you should recreate all tables - there are more changes that are not inside the update.sql (e.g. MyISAM -> InnoDB)

JohnDoh

pela020: if you are using the repo version go into rcube_sieve.php and set $cache to false on line 37 and then try again, may be the cache doesnt work right. if that doesnt work then check your dovecot config and where the sieve files are acually being written on the server, make sure they are not all in the same place.

internalkernel: i have setup a rule with 20 tests and then a fileinto and it saves just fine. could you post an example of one which doesnt work for you please?
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

pela020

Quote from: JohnDoh;24801pela020: if you are using the repo version go into rcube_sieve.php and set $cache to false on line 37 and then try again, may be the cache doesnt work right. if that doesnt work then check your dovecot config and where the sieve files are acually being written on the server, make sure they are not all in the same place.

There's a symlink in /home/vmail/domain

.dovecot.sieve -> sieve/roundcube.sieve
I've changed the cache value to false but it doesn't do anything different what i can see. It still writes the filters in the same file for all users

JohnDoh

looks like your dovecot config is wrong then the symlink should be in the user's directry along with a dir containing the sieve files.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

internalkernel

#147
Quote from: JohnDoh;24801internalkernel: i have setup a rule with 20 tests and then a fileinto and it saves just fine. could you post an example of one which doesnt work for you please?

As you request... I have attached a screenshot of the rule set I attempted to make, and the result after hitting save... as well as the code produced in roundcube.sieve.

I've made no changes in the sieverules folder (aside from copying config.inc.php.dist to config.inc.php).

~~
I ended up resolving my issue with it, in part by figuring out the "List-ID" header and splitting the rules into different entries.
~~
I just came across this entry in my logcheck files, seems to coordinate with the time I tried to save the filters:

line has bad date <[Sat Jan 23 11:24:42 2010] [error] [client xxx.xxx.xxx.xxx] ALERT - configured POST variable limit exceeded - dropped variable '_advoperator[]' (attacker 'xxx.xxx.xxx.xxx', file '/var/www/roundcube/index.php'), referer: https://my.domain.com/?_task=settings&_action=plugin.sieverules.add&_framed=1>

pela020

Quote from: JohnDoh;24803looks like your dovecot config is wrong then the symlink should be in the user's directry along with a dir containing the sieve files.

Yes, that did the trick.
I changed from sieve=~/.dovecot.sieve to
sieve=/home/vmail/%d/%n/.dovecot.sieve
in the dovecot config :D
Thank you for pointing me in the right direction.

user20100124

In SieveRules regular expressions do not seem to be 100% working ... like "\" should be "\\" in the dovecot.sieve file. Is anybody facing similar problems?


version information:

Dovecot: 1.2.9
RoundCube: 0.3.1
SieveRules: 1.5