Roundcube Community Forum

 

Sieverules (managesieve) plugin

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

Previous topic - Next topic

sziki

Sorry,  I didn't know there are 2 sieve plugins. Yes, I talked about plugin which came with 0.3s called managesieve plugin.

I checked sieverules plugin. Looks better then managesieve, and the default_file works. I tried example_file and it also works but it has some character encoding problem. I created an example file with vacation autoresponse. The subject field contains characters with accents. If I load this example to use, the characters with accents change. I think the encoded version of the characters appears. (or?) This problem is not in the body. The characters are OK in there.

Nyro

You'll find attached the French translation created using your web interface.

After installing it, all accentuated character looks wrong in roundcube 0.3.
Hope you'll figure out how to fix it ;)

JohnDoh

QuoteThe subject field contains characters with accents. If I load this example to use, the characters with accents change. I think the encoded version of the characters appears. (or?) This problem is not in the body. The characters are OK in there.

This is a known problem with dovecot sieve, nothing I can do about it unfortuantly.

Nyro: Thanks, I will update the file in the plugin. The french chars display ok for me, check the file on your server is saved as UTF8 (without the BOM)
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

Nyro

JohnDoh : I tried again and this time it works!
I don't know exactly what I did wrong last time, maybe I was just too tired.

Any idea when this plugin will be included directly in Roundcube?

mbsouth

Hi!
1st: Thx for this great plugin!

2nd: Vacation (Abwesenheitsnachricht) question:
Some miss configured mailserver doesn't accept from=<> , from= as sender or Return-Path: (no fqname) in mail header. Is it possible to use the logged-in username (email) for this?


Thx mbsouth

scp

New to this forum and Roundcube.  Have Roundcube 0.3 stable with managesieve and sieverules plugins enabled (for comparison) and Dovecot 1.2.5.  Both managesieve and sieverules write the sieve rule ok in the user's directory.  However, the incoming messages are not being filtered to the chosen folder.  They just remain in the In folder.  I possible missed something in the Dovecot or Rouncube configuration.  Any suggestions?

JohnDoh

Check you dvecot deliver log and the dovecot config, make sure dovecot is looking in the right place for the sieve files etc, a guide to setting it up is here LDA/Sieve/Dovecot - Dovecot Wiki
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

scp

#82
Thanks for your advice.  I checked everything and edited the configs again - to no avail.  Dovecot makes a link in the root of the users home directory to the rules made by the Roundcube managesieve plugin and placed in the users Sieve folder.  As far as I can tell - this is correct.  However, Incoming mail is not filtered to the chosen folder.  It remains in the INBOX.  Messages can be manually moved (within Roundcube) from the Inbox to a chosen folder.

One thing I have noticed - While I have /var/log/dovecot.log and /var/log/dovecot-info.log - I do not have a /var/log/dovecot-local-deliver.log which I thought woulld be automatically generated.

Obviously, I have missed something in the configuration files or server permissions.  Below are the configs for dovecot and Roundcube Managesieve.  Grateful for any clues.

Roundcube managesieve Config

Quote
// managesieve server port
$rcmail_config['managesieve_port'] = 2000;

// managesieve server address
$rcmail_config['managesieve_host'] = 'localhost';

// use or not TLS for managesieve server connection
// it's because I've problems with TLS and dovecot's managesieve plugin
// and it's not needed on localhost
$rcmail_config['managesieve_usetls'] = false;

// default contents of filters script (eg. default spam filter)
$rcmail_config['managesieve_default'] = '/etc/dovecot/global.sieve';

// I need this because my dovecot (with listescape plugin) uses
// ':' delimiter, but creates folders with dot delimiter
$rcmail_config['managesieve_replace_delimiter'] = '';

// disabled sieve extensions (body, copy, date, editheader, encoded-character,
// envelope, environment, ereject, fileinto, ihave, imap4flags, index,
// mailbox, mboxmetadata, regex, reject, relational, servermetadata,
// spamtest, spamtestplus, subaddress, vacation, variables, virustest, etc.
// Note: not all extensions are implemented
$rcmail_config['managesieve_disabled_extensions'] = array();

?>

Dovecot Config

Quoteprotocols = imap managesieve

login_dir = /var/run/dovecot/login
login_chroot = yes
login_user = dovecot

#Mail settings
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_privileged_group = mail

# It's nice to have separate log files for Dovecot. You could do this
# by changing syslog configuration also, but this is easier.
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot-info.log

# Disable SSL for now.
ssl = no
disable_plaintext_auth = no

protocol imap {
login_executable = /usr/local/libexec/dovecot/imap-login
mail_executable = /usr//local/libexec/dovecot/imap
# login_greeting_capability = yes
}

## protocol pop3 {
## login_executable = /usr/local/libexec/dovecot/pop3-login
## mail_executable = /usr/local/libexec/dovecot/pop3
## pop3_enable_last = no
## }

# LDA specific settings
protocol lda {
        postmaster_address = [email protected]
        hostname = somewhereelse.net
   sieve_global_path = /etc/dovecot/global.sieve

## Sieve plugin for local delivery agent
        mail_plugins = sieve
        log_path = /var/log/dovecot-local-deliver.log
        auth_socket_path = /usr/local/var/run/dovecot/
   }

# ManageSieve
protocol managesieve {
   listen = localhost:2000
   mail_debug=yes
   mail_executable = /usr/local/libexec/dovecot/managesieve
   login_executable = /usr/local/libexec/dovecot/managesieve-login
   managesieve_max_line_length = 65536
   managesieve_logout_format = bytes=%i/%o
   }

plugin {
  # Settings for the Sieve plugin
   sieve = ~/.dovecot.sieve
   sieve_dir = ~/sieve
   }
     
auth_executable = /usr/local/libexec/dovecot/dovecot-auth
auth_process_size = 256
auth_cache_ttl = 3600

auth default {
  mechanisms = plain
  user = root
  ssl_require_client_cert = no
  passdb pam {
  }
  userdb passwd {
  }
}

scp

I realized this forum is for Sieverules managesieve plugin and not the managesieve plugin.  So I enabled the Sieverules plugin but have exactly the same problem.  Although the sieve rule is written and dovecot makes an alias to the roundcube sieve rule - no action is taken on incoming mail to filter it to folders.  I should add that I have been using filters in other programs for a long time.  My standard desktop email program is Evolution using bogofilter and SA filters - which work very well. I also use SA on the servers.

As far as I can tell from the dovecot.log and dovecot-info.log - dovecot 1.2 is working without errors.   Also I built dovecot with the the sieve plugin.  So I cannot figure out why Roundcube Sieverule is not acting on the rule.  Is it relying on Roundcube to move the mail to the appropriate folder or is it relying on the Dovecot sieve plugin?  Feeling stupidly baffled.  Would appreciate pointers.

speed47

On my configuration, the sieverules plugin can't authenticate on the dovecot 1.1 managesieve server.
After some debugging and Wiresharking, I noticed that after the plugin sends and AUTHENTICATE "CRAM-MD5" command, the server sends back a challenge, and then sits waiting for an answer. Sieverules never sends any answer back because it's still waiting for others command to arrive, due to the way the _doCmd() function of Net_Sieve.php is written. It's in fact waiting for an "OK", a "NO" or a "BYE", indicating the end of a possibly multiline answer.
The code seems to support challenges, but only if the challenge length is announced with a string-length indicator, as in :

< AUTHENTICATE "CRAM-MD5"
> {30}
> abcdefghijklmnopqrstuvwxyz1234

But the ietf draft (see draft-ietf-sieve-managesieve-09 - A Protocol for Remotely Managing Sieve Scripts) also states that the server can send the challenge between quotes and without a length-indicator, if it's short enough, as in :

< AUTHENTICATE "CRAM-MD5"
> "abcdefghijklmnopqrstuvwxyz1234"

For some reason, my managesieve dovecot server uses the latter form. I wrote a patch to add support for this form to sieverules, and it now works. This is done adding another state to the class : NET_SIEVE_STATE_CONNECTED, which is set right after the TCP connection is established, and until we set either state AUTHORISATION or TRANSACTION, after establishing the TLS layer (if configured) and after querying the capabilities. I added more code than I intended to at first sight, but, well...

It has been tested with auth methods PLAIN, LOGIN, CRAM-MD5 and DIGEST-MD5, with and without TLS.
The "bypass auth" case is however untested.
Managesieve dovecot version : 1.13 (from debian lenny backports)
Roundcube revision : 2987

Patch attached : http://www.roundcubeforum.net/attachment.php?attachmentid=1064&stc=1&d=1253996253

JohnDoh

Hi,

If it is a bug with Net_Sieve then you should open a bug report here Net_Sieve but some very quick research suggests it might just be a bug in Dovecot 1.1, certainly there are no authentication problems with Dovecot 1.2. Thanks for the patch.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more...

speed47

I just tested with Dovecot 1.2.4, and I have the same problem.
It's strange nobody else seems to encounter this issue.
Anyway, I filed a bug at PEAR https://pear.php.net/bugs/bug.php?id=16647

$ wget -q 'http://svn.php.net/viewvc/pear/packages/Net_Sieve/trunk/Sieve.php?view=co' -O Sieve.php  ; cat bug.php ; php bug.php
include('Sieve.php');
new Net_Sieve('user', 'pass', 'localhost' , 2000, '', '', true, false, false, null);

S:"IMPLEMENTATION" "dovecot"
S:"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include body variables enotify environment mailbox date"
S:"SASL" "CRAM-MD5"
S:"STARTTLS"
S:"NOTIFY" "mailto"
S:"VERSION" "1.0"
S:OK "Dovecot ready."
C:CAPABILITY
S:"IMPLEMENTATION" "dovecot"
S:"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include body variables enotify environment mailbox date"
S:"SASL" "CRAM-MD5"
S:"STARTTLS"
S:"NOTIFY" "mailto"
S:"VERSION" "1.0"
S:OK "Capability completed."
C:AUTHENTICATE "CRAM-MD5"
S:"PDAzNDI5MTA4MjI2MTEwNDEuMTI1NDA1MDY0NEBtZXJjdXJlPg=="

scp

I am using Dovecot 1.2 from source with the Sieve plugin built with it as well as the dovecot managesieve plugin also. You guys are definitely more advanced on this than I am.  It does indeed seem to be a problem with authentication - but I am wondering in my case if the problem lies with Dovecot's "Deliver"  I initially missed the bit about reconfiguring Sendmail to allow for Dovecot as a mailer.  Fixed that - but it still has not resolved the problem.

SvenK

@speed47

Many thanks for your patch. It was my first problem, too :):)

Quote from: scp;21774no action is taken on incoming mail to filter it to folders.

This was my second problem. I changed this in the plugins/sieverules/config.inc.php file:

$sieverules_config['folder_delimiter'] = '.';

The delimiter for me is the '.' and not the '/' ;)

Sven

spracrevi

Thanks so much 4 sharing with us,bros :-)