[Dovecot] Sieve doesn't find user scripts
Hi,
I want to use Sieve filtering with my Dovecot 1.2 installation on Debian squeeze. I have a virtual domain setup using Portgresql.
ManageSieve works fine so far, I can edit and activate/deactive scripts (using Thunderbird + Plugin) and they show up in the filesystem where I expect them to be, see below.
The problem is that LDA doesn't find the script. From /var/log/dovecot-deliver.log:
| 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Loading modules from directory: /usr/lib/dovecot/modules/lda | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Quota root: name=storage=512000 backend=maildir args= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir: data=/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir++: root=/srv/mail/well-adjusted.de/jrspieker, index=, control=, inbox= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: user has no valid personal script | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: no scripts to execute: reverting to default delivery.
AFAICS, the sieve module is loaded and the home directory is correct. The content of this directory looks like this:
| $ ls -ltRa /srv/mail/home/well-adjusted.de/jrspieker/ | /srv/mail/home/well-adjusted.de/jrspieker/: | total 12 | drwx------ 3 vmail vmail 4096 Apr 29 12:22 . | lrwxrwxrwx 1 vmail vmail 16 Apr 29 12:22 .dovecot.sieve -> sieve/test.sieve | drwx------ 3 vmail vmail 4096 Apr 28 22:31 sieve | drwx------ 3 vmail vmail 4096 Apr 27 20:55 .. | | /srv/mail/home/well-adjusted.de/jrspieker/sieve: | total 16 | drwx------ 3 vmail vmail 4096 Apr 29 12:22 .. | drwx------ 3 vmail vmail 4096 Apr 28 22:31 . | drwx------ 2 vmail vmail 4096 Apr 28 22:31 tmp | -rw------- 1 vmail vmail 338 Apr 28 22:31 test.sieve | …
dovecot -n shows this for the plugin section:
| plugin: | quota: maildir:storage=512000 | sieve_dir: ~/sieve/ | sieve: ~/.dovecot.sieve
And finally, the content of the script:
| require["fileinto"]; | | if header :is "subject" "test" { | fileinto "Test"; | } else { | keep; | }
What am I missing here?
Thanks, Jochen.
Fashion is more important to me than war, famine, disease or art. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
On 29/04/2012 12:04, Jochen Spieker wrote:
Hi,
I want to use Sieve filtering with my Dovecot 1.2 installation on Debian squeeze. I have a virtual domain setup using Portgresql.
ManageSieve works fine so far, I can edit and activate/deactive scripts (using Thunderbird + Plugin) and they show up in the filesystem where I expect them to be, see below.
The problem is that LDA doesn't find the script. From /var/log/dovecot-deliver.log:
| 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Loading modules from directory: /usr/lib/dovecot/modules/lda | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Quota root: name=storage=512000 backend=maildir args= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir: data=/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir++: root=/srv/mail/well-adjusted.de/jrspieker, index=, control=, inbox= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: user has no valid personal script | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: no scripts to execute: reverting to default delivery.
AFAICS, the sieve module is loaded and the home directory is correct. The content of this directory looks like this:
| $ ls -ltRa /srv/mail/home/well-adjusted.de/jrspieker/ | /srv/mail/home/well-adjusted.de/jrspieker/: | total 12 | drwx------ 3 vmail vmail 4096 Apr 29 12:22 . | lrwxrwxrwx 1 vmail vmail 16 Apr 29 12:22 .dovecot.sieve -> sieve/test.sieve | drwx------ 3 vmail vmail 4096 Apr 28 22:31 sieve | drwx------ 3 vmail vmail 4096 Apr 27 20:55 .. | | /srv/mail/home/well-adjusted.de/jrspieker/sieve: | total 16 | drwx------ 3 vmail vmail 4096 Apr 29 12:22 .. | drwx------ 3 vmail vmail 4096 Apr 28 22:31 . | drwx------ 2 vmail vmail 4096 Apr 28 22:31 tmp | -rw------- 1 vmail vmail 338 Apr 28 22:31 test.sieve | …
What user is deliver running as?
-- Best Regards, Giles Coochey, CCNA Security, CCNA NetSecSpec Ltd giles.coochey@netsecspec.co.uk Tel: +44 (0) 7983 877 438 Live Messenger: giles@coochey.net http://www.netsecspec.co.uk http://www.coochey.net
Giles Coochey:
On 29/04/2012 12:04, Jochen Spieker wrote:
| 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Loading modules from directory: /usr/lib/dovecot/modules/lda | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109
These IDs translate to user/group vmail:
| $ grep 105 /etc/passwd | vmail:x:105:109::/home/vmail:/bin/false | | $ grep 109 /etc/group | vmail:x:109:
What user is deliver running as?
Should be vmail:
/etc/postfix/master.cf: | dovecot unix - n n - 20 pipe | flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${user}@${nexthop}
All mailboxes and home directories belong to this user and group.
J.
If nightclub doormen recognised me I would be more fulfilled. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
Jochen Spieker:
The problem is that LDA doesn't find the script.
Ok, using a global script works:
deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109 deliver(jrspieker@well-adjusted.de): Info: Quota root: name=storage=512000 backend=maildir args= deliver(jrspieker@well-adjusted.de): Info: maildir: data=/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: maildir++: root=/srv/mail/well-adjusted.de/jrspieker, index=, control=, inbox=/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: sieve: using sieve path for user's script: /srv/mail/home/global/sieve/global.sieve deliver(jrspieker@well-adjusted.de): Info: sieve: opening script /srv/mail/home/global/sieve/global.sieve deliver(jrspieker@well-adjusted.de): Info: sieve: executing compiled script /srv/mail/home/global/sieve/global.sieve deliver(jrspieker@well-adjusted.de): Info: Namespace : Using permissions from /srv/mail/well-adjusted.de/jrspieker: mode=0755 gid=-1 deliver(jrspieker@well-adjusted.de): Info: sieve: msgid=<20120429132328.D581B1E9@manowar.wasteland.homelinux.net>: stored mail into mailbox 'INBOX'
I suspect LDA doesn't look for the script where I expect it to look. Again, dovecot -n show this (now including the global settings):
plugin: quota: maildir:storage=512000 sieve_dir: ~/sieve/ sieve: ~/.dovecot.sieve sieve_global_path: /srv/mail/home/global/sieve/global.sieve sieve_global_dir: /srv/mail/home/global/sieve/
I would expect ~ to translate to the userdb_home from the log entry above (/srv/mail/home/well-adjusted.de/jrspieker). ManageSieve's behaviour confirms that expectation.
The wiki says "A relative path (or just a filename) will be interpreted to point under the user's home directory."¹ This works for ManageSieve just like the ~-notation, but LDA still doesn't find the script.
J.
¹ http://wiki.dovecot.org/LDA/Sieve/Dovecot#Per-user_Sieve_script_location
When I get home from the supermarket I don't know what to do with all the plastic. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
Someone asked for the complete dovecot -n:
# 1.2.15: /etc/dovecot/dovecot.conf # OS: Linux 2.6.34-xen-r4 i686 Debian 6.0.4 rootfs log_timestamp: %Y-%m-%d %H:%M:%S protocols: pop3s imaps managesieve ssl_cert_file: /etc/ssl/certs/mail.well-adjusted.de.cert ssl_key_file: /etc/ssl/private/mail.well-adjusted.de.key verbose_ssl: yes 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 login_processes_count: 1 login_max_processes_count: 32 first_valid_uid: 1 mail_privileged_group: vmail mail_location: maildir:/srv/mail/%Ld/%Ln fsync_disable: yes mbox_write_locks: fcntl dotlock 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_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota mail_plugins(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 lda: fsync_disable: no postmaster_address: postmaster@wasteland.xen-host.de log_path: /var/log/dovecot-deliver.log info_log_path: /var/log/dovecot-deliver.log mail_plugins: quota sieve auth_socket_path: /var/run/dovecot/auth-master mail_debug: yes auth default: mechanisms: plain login user: postgres username_chars: +*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@ username_format: %Lu passdb: driver: sql args: /etc/dovecot/dovecot-sql.conf userdb: driver: prefetch userdb: driver: sql args: /etc/dovecot/dovecot-sql.conf socket: type: listen client: path: /var/spool/postfix/private/auth mode: 432 user: postfix master: path: /var/run/dovecot/auth-master mode: 432 user: vmail group: vmail plugin: quota: maildir:storage=512000 sieve_dir: sieve/ sieve: .dovecot.sieve sieve_global_path: /srv/mail/home/global/sieve/global.sieve sieve_global_dir: /srv/mail/home/global/sieve/
J.
Tony Blair is a hypnotised self-seeking scarecrow just like all the rest. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
Hi Jochen,
Jochen Spieker wrote:
mail_location: maildir:/srv/mail/%Ld/%Ln plugin: sieve_dir: sieve/ sieve: .dovecot.sieve
Sieve requires a mail_home directory.
The sieve_dir is searched below mail_home, not mail_location where the actual mailboxes are stored.
http://wiki.dovecot.org/VirtualUsers/Home Home vs. mail directory
Regards, Daniel
Daniel Parthey:
Jochen Spieker wrote:
mail_location: maildir:/srv/mail/%Ld/%Ln plugin: sieve_dir: sieve/ sieve: .dovecot.sieve
Sieve requires a mail_home directory.
Is this different from userdb_home? Both mail and home directory are returned from my user/password_queries and LDA reports exactly what I expect:
deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker
ManageSieve puts scripts under the directory reported as userdb_home:
$ ls -ltra /srv/mail/home/well-adjusted.de/jrspieker total 12 drwx------ 3 vmail vmail 4096 Apr 27 20:55 .. drwx------ 3 vmail vmail 4096 Apr 28 22:31 sieve lrwxrwxrwx 1 vmail vmail 16 Apr 29 15:00 .dovecot.sieve -> sieve/test.sieve drwx------ 3 vmail vmail 4096 Apr 29 15:00 .
J.
I feel yawning hollowness whilst talking to people at parties. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
On 4/29/2012 1:04 PM, Jochen Spieker wrote:
Hi,
I want to use Sieve filtering with my Dovecot 1.2 installation on Debian squeeze. I have a virtual domain setup using Portgresql.
ManageSieve works fine so far, I can edit and activate/deactive scripts (using Thunderbird + Plugin) and they show up in the filesystem where I expect them to be, see below.
The problem is that LDA doesn't find the script. From /var/log/dovecot-deliver.log:
| 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Loading modules from directory: /usr/lib/dovecot/modules/lda | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109 | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: Quota root: name=storage=512000 backend=maildir args= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir: data=/srv/mail/well-adjusted.de/jrspieker | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: maildir++: root=/srv/mail/well-adjusted.de/jrspieker, index=, control=, inbox= | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: user has no valid personal script | 2012-04-29 12:17:48 deliver(jrspieker@well-adjusted.de): Info: sieve: no scripts to execute: reverting to default delivery.
AFAICS, the sieve module is loaded and the home directory is correct. The content of this directory looks like this:
Could you enable mail_debug in your configuration? This will provide more detail on why it is not finding a script.
Regards,
Stephan.
Stephan Bosch:
AFAICS, the sieve module is loaded and the home directory is correct. The content of this directory looks like this:
Could you enable mail_debug in your configuration? This will provide more detail on why it is not finding a script.
With globally enabled mail_debug and auth_debug I get this in mail.log:
postfix/qmgr[30005]: E306113C1E1: from=<jrspieker@well-adjusted.de>, size=1987, nrcpt=1 (queue active) dovecot: auth(default): master in: USER 1 jrspieker@well-adjusted.de service=deliver dovecot: auth(default): prefetch(jrspieker@well-adjusted.de): passdb didn't return userdb entries, trying the next userdb dovecot: auth(default): sql(jrspieker@well-adjusted.de): SELECT u.storage || ':' || d.basedir || u.userid as mail, '/srv/mail/home/well-adjusted.de/jrspieker' as userdb_home, 105 as uid, 109 as gid FROM mailuser u, domain d WHERE u.userid = 'jrspieker' AND u.domain = 'well-adjusted.de' AND u.domain = d.name dovecot: auth(default): master out: USER 1 jrspieker@well-adjusted.de mail=maildir:/srv/mail/well-adjusted.de/jrspieker userdb_home=/srv/mail/home/well-adjusted.de/jrspieker uid=105 gid=109 postfix/smtpd[5421]: disconnect from e177130134.adsl.alicedsl.de[85.177.130.134] postfix/pipe[5428]: E306113C1E1: to=<jrspieker@well-adjusted.de>, relay=dovecot, delay=1.1, delays=0.6/0/0/0.5, dsn=2.0.0, status=sent (delivered via dovecot service) postfix/qmgr[30005]: E306113C1E1: removed
and this in dovecot-deliver.log:
deliver(jrspieker@well-adjusted.de): Info: Loading modules from directory: /usr/lib/dovecot/modules/lda deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib10_quota_plugin.so deliver(jrspieker@well-adjusted.de): Info: Module loaded: /usr/lib/dovecot/modules/lda/lib90_sieve_plugin.so deliver(jrspieker@well-adjusted.de): Info: auth input: mail=maildir:/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: auth input: uid=105 deliver(jrspieker@well-adjusted.de): Info: auth input: gid=109 deliver(jrspieker@well-adjusted.de): Info: Quota root: name=storage=512000 backend=maildir args= deliver(jrspieker@well-adjusted.de): Info: maildir: data=/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: maildir++: root=/srv/mail/well-adjusted.de/jrspieker, index=, control=, inbox=/srv/mail/well-adjusted.de/jrspieker deliver(jrspieker@well-adjusted.de): Info: sieve: user has no valid personal script deliver(jrspieker@well-adjusted.de): Info: sieve: no scripts to execute: reverting to default delivery. deliver(jrspieker@well-adjusted.de): Info: Namespace : Using permissions from /srv/mail/well-adjusted.de/jrspieker: mode=0755 gid=-1 deliver(jrspieker@well-adjusted.de): Info: msgid=<20120430142818.354B31FE@manowar.wasteland.homelinux.net>: saved mail to INBOX
Doesn't look different than before, I had already enabled mail_debug in the "protocol lda" section.
J.
I am not scared of death but terrified of people in Tommy Hilfiger sweatshirts. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
Timo Sirainen:
On 30.4.2012, at 17.43, Jochen Spieker wrote:
deliver(jrspieker@well-adjusted.de): Info: auth input: userdb_home=/srv/mail/home/well-adjusted.de/jrspieker
It should say "home" here, not "userdb_home".
Thanks, that's it!
dovecot-deliver.log now reads:
deliver(jrspieker@well-adjusted.de): Info: auth input: home=/srv/mail/home/well-adjusted.de/jrspieker … deliver(jrspieker@well-adjusted.de): Info: sieve: using sieve path for user's script: /srv/mail/home/well-adjusted.de/jrspieker/.dovecot.sieve deliver(jrspieker@well-adjusted.de): Info: sieve: opening script /srv/mail/home/well-adjusted.de/jrspieker/.dovecot.sieve deliver(jrspieker@well-adjusted.de): Info: sieve: executing compiled script /srv/mail/home/well-adjusted.de/jrspieker/.dovecot.sieve
Now I can finally start to migrate my .procmailrc.
J.
Driving behind lorries carrying hazardous chemicals makes me wish for a simpler life. [Agree] [Disagree] <http://www.slowlydownward.com/NODATA/data_enter2.html>
participants (5)
-
Daniel Parthey
-
Giles Coochey
-
Jochen Spieker
-
Stephan Bosch
-
Timo Sirainen