Problem with sieve filters

Daggerka

Verified User
Joined
Feb 4, 2012
Messages
27
Hi,

My Sieve filters doesn't work :(

My config:

DirectAdmin 1.50.0
Custombuild 2.0.0 (rev: 1528)
dovecot 2.2.22 (fe789d2) with Pidgeonhole SpamAssasin, SpamBlocker and DKIM
Exim 4.86.2
Debian 7.9

# cat /var/www/html/roundcube/plugins/managesieve/config.inc.php
Code:
<?php

// managesieve server port. When empty the port will be determined automatically
// using getservbyname() function, with 4190 as a fallback.
// $config['managesieve_port'] = null;
$config['managesieve_port'] = 4190;


// managesieve server address, default is localhost.
// Replacement variables supported in host name:
// %h - user's IMAP hostname
// %n - http hostname ($_SERVER['SERVER_NAME'])
// %d - domain (http hostname without the first part)
// For example %n = mail.domain.tld, %d = domain.tld
$config['managesieve_host'] = 'localhost';

// authentication method. Can be CRAM-MD5, DIGEST-MD5, PLAIN, LOGIN, EXTERNAL
// or none. Optional, defaults to best method supported by server.
$config['managesieve_auth_type'] = null;

// Optional managesieve authentication identifier to be used as authorization proxy.
// Authenticate as a different user but act on behalf of the logged in user.
// Works with PLAIN and DIGEST-MD5 auth.
$config['managesieve_auth_cid'] = null;

// Optional managesieve authentication password to be used for imap_auth_cid
$config['managesieve_auth_pw'] = null;

// use or not TLS for managesieve server connection
// Note: tls:// prefix in managesieve_host is also supported
$config['managesieve_usetls'] = false;

// Connection scket context options
// See http://php.net/manual/en/context.ssl.php
// The example below enables server certificate validation
//$config['managesieve_conn_options'] = array(
//  'ssl'         => array(
//     'verify_peer'  => true,
//     'verify_depth' => 3,
//     'cafile'       => '/etc/openssl/certs/ca.crt',
//   ),
// );
$config['managesieve_conn_options'] = null;

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

// The name of the script which will be used when there's no user script
$config['managesieve_script_name'] = 'managesieve';

// Sieve RFC says that we should use UTF-8 endcoding for mailbox names,
// but some implementations does not covert UTF-8 to modified UTF-7.
// Defaults to UTF7-IMAP
$config['managesieve_mbox_encoding'] = 'UTF-8';

// I need this because my dovecot (with listescape plugin) uses
// ':' delimiter, but creates folders with dot delimiter
$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
$config['managesieve_disabled_extensions'] = array();

// Enables debugging of conversation with sieve server. Logs it into <log_dir>/sieve
$config['managesieve_debug'] = false;

// Enables features described in http://wiki.kolab.org/KEP:14
$config['managesieve_kolab_master'] = false;

// Script name extension used for scripts including. Dovecot uses '.sieve',
// Cyrus uses '.siv'. Doesn't matter if you have managesieve_kolab_master disabled.
$config['managesieve_filename_extension'] = '.sieve';

// List of reserved script names (without extension).
// Scripts listed here will be not presented to the user.
$config['managesieve_filename_exceptions'] = array();

// List of domains limiting destination emails in redirect action
// If not empty, user will need to select domain from a list
$config['managesieve_domains'] = array();

// Enables separate management interface for vacation responses (out-of-office)
// 0 - no separate section (default),
// 1 - add Vacation section,
// 2 - add Vacation section, but hide Filters section
$config['managesieve_vacation'] = 0;

// Default vacation interval (in days).
// Note: If server supports vacation-seconds extension it is possible
// to define interval in seconds here (as a string), e.g. "3600s".
$config['managesieve_vacation_interval'] = 0;

// Some servers require vacation :addresses to be filled with all
// user addresses (aliases). This option enables automatic filling
// of these on initial vacation form creation.
$config['managesieve_vacation_addresses_init'] = false;

// Supported methods of notify extension. Default: 'mailto'
$config['managesieve_notify_methods'] = array('mailto');

# cat /etc/dovecot/dovecot.conf
Code:
#0.1
## Dovecot 2.0 configuration file

!include conf/ip.conf

auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@&
auth_verbose = yes
disable_plaintext_auth = no
login_greeting = Dovecot DA ready.
mail_access_groups = mail
default_login_user = dovecot
mail_location = maildir:~/Maildir

!include conf/limits.conf

passdb {
  driver = shadow
}

passdb {
  args = username_format=%n /etc/virtual/%d/passwd
  driver = passwd-file
}

!include conf/protocols.conf
!include conf/mail_plugins.conf

service auth {
  user = root
}
service imap-login {
  process_min_avail = 16
  user = dovecot
}
service pop3-login {
  process_min_avail = 16
  user = dovecot
}

!include conf/ssl.conf

userdb {
  driver = passwd
}

userdb {
  args = username_format=%n /etc/virtual/%d/passwd
  driver = passwd-file
}

verbose_proctitle = yes

protocol imap {
  !include conf/imap_mail_plugins.conf
}

protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
  pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s, bytes=%i/%o
}

!include conf/mail_max_userip_connections.conf

!include_try conf/lmtp.conf

!include conf.d/*.conf

# cat /etc/dovecot/conf.d/90-sieve.conf
Code:
#add sieve to end of line in:
#/etc/dovecot/conf/protocols.conf, eg:
#protocols = imap pop3 lmtp sieve

#Managesieve service (allows rules editing on client-side)
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  service_count = 1
  process_min_avail = 4
  vsz_limit = 64M
}

service managesieve {
}

protocol sieve {
  managesieve_max_line_length = 65536
  managesieve_implementation_string = Dovecot Pigeonhole
  managesieve_max_compile_errors = 5
  managesieve_logout_format = bytes=%i/%o
  log_path = /var/log/dovecot-sieve-errors.log
  info_log_path = /var/log/dovecot-sieve.log
}

plugin {
   #More details: http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
   # The location of the user's main script storage. The active script
   # in this storage is used as the main user script executed during
   # delivery. The include extension fetches the :personal scripts
   # from this location. When ManageSieve is used, this is also where
   # scripts are uploaded. This example uses the file system as
   # storage, with all the user's scripts located in the directory
   # `~/sieve' and the active script (symbolic link) located at
   # `~/.dovecot.sieve'.
   sieve = file:~/sieve;active=~/.dovecot.sieve

   # If the user has no personal active script (i.e. if the location
   # indicated in sieve= does not exist or has no active script), use
   # this one:
   sieve_default = /var/lib/dovecot/sieve/default.sieve

   # The include extension fetches the :global scripts from this
   # location.
   sieve_global = /var/lib/dovecot/sieve/global/

Example filter added by roundcube:
cat /home/USERNAME/imap/DOMAIN/test/.dovecot.sieve
Code:
require ["fileinto"];
# rule:[test]
if true
{
        fileinto "INBOX.spam";
}

# ps aux | grep -v grep | grep managesieve-login
Code:
dovecot  13934  0.0  0.0  27480  2968 ?        S    23:18   0:00 dovecot/managesieve-login
dovecot  17530  0.0  0.0  27480  2964 ?        S    23:29   0:00 dovecot/managesieve-login
dovecot  18618  0.0  0.0  27480  2964 ?        S    23:36   0:00 dovecot/managesieve-login
dovecot  18631  0.0  0.0  27480  2968 ?        S    23:36   0:00 dovecot/managesieve-login

# netstat -an | grep LISTEN | grep :4190
Code:
tcp        0      0 0.0.0.0:4190            0.0.0.0:*               LISTEN

Sieve logs were not generated...
Code:
# less /var/log/dovecot-sieve-errors.log
/var/log/dovecot-sieve-errors.log: No such file or directory
# less /var/log/dovecot-sieve.log
/var/log/dovecot-sieve.log: No such file or directory

# less /var/log/dovecot-lmtp.log
Code:
...
Mar 22 23:17:22 lmtp(10023): Info: Connect from local
Mar 22 23:17:22 lmtp(test@DOMAIN): Info: d96iJ/nC8VYnJwAA13kxwg: msgid=<[email protected]>: saved mail to INBOX
Mar 22 23:17:22 lmtp(10023): Info: Disconnect from local: Successful quit
...

I'm stuck... Any tips?
 
Hello,

When a car is broken we go to a car-repair service and describe the issue in details. We describe how to see or how to hear that part which does not work. If we don't provide as much information as possible they will need to do a full diagnostic, and if a car is old enough and has no a computer on a board it might take several days to complete....

What has it to do with a Linux Server?

OK, you stated you've got the service not working. Well... at this point you have 3 options at least:

1. hire somebody to run an audit on your server and test all related things and fix it.
2. or provide as much details as possible:

- settings you have there, including versions of software
- steps which you perform to see an error or repeat the issue
- full text of an error
- desirable behavior

3. Or try a "fix for all issues":

Code:
./build update
./build all d

of course it might or not help you. So please make your choice.
 
Back
Top