permissions of newly created mailboxes only with dovecot-lda and posix acls

2018-07-01 Thread Alexander 'Leo'; Bergolth
Hi!

I am experiencing troubles concerning the inheritance of the setgid bit if a 
new mailbox is created with dovecot-lda.
If it is created with dovecot/imap, everything works fine.

dovecot-lda is called from postfix like this:
--
mailbox_command = /usr/local/sbin/postfix-lda.sh
--
logger -p mail.info -t postfix-lda "H: $HOME, S: $SENDER, R: $RECIPIENT, U: 
$(umask), id: $(/bin/id); $@"
dovecot-lda -f "$SENDER" -a "$RECIPIENT" 
-onamespace/inbox/location=maildir:~/Maildir:LAYOUT=fs:FULLDIRNAME=__MAILBOX__
--

If a mailbox is created with dovecot-lda (sieve), permissions look like that:

$ ls -ld Maildir Maildir/2018-q3 Maildir/2018-q3/__MAILBOX__
drwxrws---+ 49 leo leo   4096 Jul  1 09:53 Maildir
drwxrwx---+  3 leo leo 24 Jul  1 09:40 Maildir/2018-q3
drwxrwx---+  2 leo staff6 Jul  1 09:40 Maildir/2018-q3/__MAILBOX__

-> The setguid bit of Maildir is not honored and dovecot complains:
Jul  1 09:40:42 strike postfix-lda: H: /home/leo, S: test...@strike.wu.ac.at, 
R: l...@strike.wu.ac.at, umask: 0077, id: uid=500(leo) gid=500(staff) 
groups=500(staff);
Jul  1 09:40:42 strike dovecot: lda(leo): Error: 
fchown(/home/leo/Maildir/2018-q3/__MAILBOX__/cur, group=501(leo)) failed: 
Operation not permitted (egid=500(staff), group based on 
/home/leo/Maildir/2018-q3 - see http://wiki2.dovecot.org/Errors/ChgrpNoPerm)
Jul  1 09:40:42 strike dovecot: lda(leo): Error: 
mkdir(/home/leo/Maildir/2018-q3/__MAILBOX__/cur) failed: Operation not permitted
Jul  1 09:40:42 strike dovecot: lda(leo): Error: sieve: 
msgid=<20180701074042.1b1241cf...@strike.wu.ac.at>: failed to store into 
mailbox '2018-q3': Internal error occurred. Refer to server log for more 
information. [2018-07-01 09:40:42]


If I create a mailbox with imap, everything works as expected:
$ ls -ld Maildir/permtest Maildir/permtest/__MAILBOX__
drwxrws---+ 3 leo leo  24 Jul  1 09:51 Maildir/permtest
drwxrws---+ 5 leo leo 108 Jul  1 09:51 Maildir/permtest/__MAILBOX__

mkdir from a shell also works fine.


The problem seems to be connected to the Posix ACLs that are set on Maildir:

$ getfacl Maildir
# file: Maildir
# owner: leo
# group: leo
# flags: -s-
user::rwx
user:bergolth:rwx
group::rwx
mask::rwx
other::---
default:user::rwx
default:user:bergolth:rwx
default:group::rwx
default:mask::rwx
default:other::--x


If I remove all Posix ACLs using setfacl -b Maildir, creation of new mailboxes 
works fine also with dovecot-lda.

Why is dovecot-lda behaving differently if Posix-ACLs are set on Maildir? Any 
why isn't dovecot imap affected?

Any help would be greatly appreciated, I am actually clueless!

Cheers,
--leo

dovecot-2.2.32-1leo.el7.centos.x86_64
dovecot-pigeonhole-2.2.32-1leo.el7.centos.x86_64
postfix-2.10.1-6.el7.x86_64
# uname -r
4.4.138-1.el7.elrepo.x86_64

-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



use a second userdb that only returns extra fields

2016-10-28 Thread Alexander &#x27;Leo'; Bergolth
Hi!

Is it possible to get all basic userdb information from the passwd
userdb and add a second userdb of type checkpassword that only sets some
additional extra fields like namespaces?

I tried the following setup:
 8< 
userdb {
  driver = passwd
  result_success = continue-ok
}
userdb {
  driver = checkpassword
  args = /usr/local/sbin/dovecot-userdb.py
  skip = never
}
 8< 

... but it seems that as soon as the second userdb is active, dovecot
doesn't take settings like uid and gid from the first userdb anymore.
(Even if I don't set userdb_uid and userdb_gid in checkpassword.)

On the other hand there are no environment variables that pass the
settings from the previous lookup to the checkpassword script.

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: sieve duplicate locking

2016-10-20 Thread Alexander &#x27;Leo'; Bergolth
On 10/19/2016 12:51 PM, Stephan Bosch wrote:
> Op 17-10-2016 om 18:05 schreef Alexander 'Leo' Bergolth:
>> Does the duplicate sieve plugin do any locking to avoid duplicate
>> parallel delivery of the same message?
[...]
>> Is there an easy way to serialize mail delivery using some locking
>> inside sieve?
> 
> We've seen this before I think. It would require some changes to the
> duplicate tracking system. I'd expect the vacation command to be
> affected as well.

Would be great! :-)

>> Or do I have to serialize per-user dovecot-lda delivery? Any experiences
>> with that?
> 
> Very little. I know there is a new lmtp_user_concurrency_limit setting,
> but there is not much documentation apart from the commit message:
> https://github.com/dovecot/core/commit/42abccd9b2a5a4190bd3c14ec2dcc10d51c0f491

I am currently using dovecot-lda as mailbox_command, so this is not an
option right now.

> There are possibilities from within the MTA as well I expect.

As a temporary workaround, I wrapped dovecot-lda with flock to serialize
delivery:

 8< 
#!/bin/sh

exec /usr/bin/flock "$HOME/Maildir/INBOX" \
/usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
 8< 

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


sieve duplicate locking

2016-10-17 Thread Alexander &#x27;Leo'; Bergolth
Hi!

Does the duplicate sieve plugin do any locking to avoid duplicate
parallel delivery of the same message?

I sometimes experience duplicate mail delivery of messages with the same
message-id, despite the use of a sieve duplicate filter. According to
the log files, those messages are delivered in the same second by two
parallel dovecot-lda processes. (Duplicate filtering works fine in all
other cases.)

RFC7352 states that the ID of a message may only be committed to the
duplicate tracking list at the _end_ of a successful script execution,
which may lead to race conditions.
Maybe I am running into this?

Is there an easy way to serialize mail delivery using some locking
inside sieve?

Or do I have to serialize per-user dovecot-lda delivery? Any experiences
with that?

I am using dovecot-2.2.25 and pidgeonhole-0.4.15.
Mail is delivered using postfix-2.10 and dovecot-lda as mailbox_command.
Mailbox format is maildir with LAYOUT=fs.

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: custom mail_location detection for dovecot lda

2016-08-09 Thread Alexander &#x27;Leo'; Bergolth
On 08/08/2016 06:27 PM, Stephan Bosch wrote:
> Op 8-8-2016 om 18:05 schreef Alexander 'Leo' Bergolth:
>> On 08/08/2016 05:34 PM, Stephan Bosch wrote:
>>> Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
>>>> Is it possible to do something like "post-login scripting" to detect
>>>> and
>>>> set a per-user custom mail location for dovecot LDA delivery?
>>>>
>>> You could use /usr/lib/dovecot/dovecot-lda -omail_location=
>> Thanks for the hint.
>> But it seems to be ignored. :-(
>> I tried it with a .forward of:
>>
>> | "/usr/libexec/dovecot/dovecot-lda
>> -omail_location=maildir:~/Maildir:LAYOUT=fs"
>>
>> and postfix logs:
>> ... status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda
>> -omail_location=maildir:~/Maildir:LAYOUT=fs)
>>
>> ... but it still delivers to the default
>> (mail_location = mbox:~/mail:INBOX=/var/mail/%u)
> 
> Right, that is overridden. You could use
> "-onamespace/inbox/location=" instead.

Yesss! :-)
This one works great for me and is very useful for smooth migration from
mbox to maildir:

dovecot-lda.sh:
 8< 
#!/bin/bash

args=()
if [ -d "$HOME/Maildir/INBOX" ]; then
  args+=("-onamespace/inbox/location=maildir:~/Maildir:LAYOUT=fs")
fi
exec /usr/libexec/dovecot/dovecot-lda "${args[@]}" "$@"
 8< 

Thanks for your help!

--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: custom mail_location detection for dovecot lda

2016-08-08 Thread Alexander &#x27;Leo'; Bergolth
On 08/08/2016 05:34 PM, Stephan Bosch wrote:
> Op 8-8-2016 om 17:27 schreef Alexander 'Leo' Bergolth:
>> Is it possible to do something like "post-login scripting" to detect and
>> set a per-user custom mail location for dovecot LDA delivery?
>>
> You could use /usr/lib/dovecot/dovecot-lda -omail_location=

Thanks for the hint.
But it seems to be ignored. :-(
I tried it with a .forward of:

| "/usr/libexec/dovecot/dovecot-lda
-omail_location=maildir:~/Maildir:LAYOUT=fs"

and postfix logs:
... status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda
-omail_location=maildir:~/Maildir:LAYOUT=fs)

... but it still delivers to the default
(mail_location = mbox:~/mail:INBOX=/var/mail/%u)


> There is probably a better way using a userdb though.

Per-user configuration with userdb is static, you have to configure the
mailbox format for each user. However, if you'd like to give the user
the ability to switch between mailbox formats, dynamic detection would
be useful...

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


custom mail_location detection for dovecot lda

2016-08-08 Thread Alexander &#x27;Leo'; Bergolth
Hi!

Is it possible to do something like "post-login scripting" to detect and
set a per-user custom mail location for dovecot LDA delivery?

I tried to use a wrapper-script around dovecot-lda that sets the
environment variables MAIL="..." and USERDB_KEYS="MAIL" just like
overriding userdb fields may be done using imap postlogin scripts, but
unfortunately this doesn't seem to be honored. (Also tried with
dovecot-lda -k.)

Woud be very useful for slow migration from one mailbox format to another.

Is there any other way to supply a custom mail_location to dovecot-lda?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: Sieve: carry global variables from sieve_before to user sieve scripts

2014-10-25 Thread Alexander &#x27;Leo'; Bergolth

On 20.10.2014 11:48, Alexander 'Leo' Bergolth wrote:

Is there a way to initialize global variables with default values in
sieve_before scripts that can be used in the sieve_default script or in
user scripts?


OK. I guess that's currently not possible. I had a quick look in the 
code, the global variable namespace seems to be copied from the parent 
script during execution of the include statement. (In 
ext_include_generate_include() which calls 
ext_include_create_ast_context().)


So maybe it is possible to take another approach:
Instead of executing sieve_before scripts and sieve_default side by 
side, maybe it is feasible to set the "before-script" as sieve_default 
and include the default personal user script from there if it exists? 
That way global variable inheritance should work, shouldn't it?


Did anyone try this approach? Any caveats? Any security implications?

Cheers,
--leo


I've tried the following code but this doesn't work..

before.d/10-set-defaults.sieve:
 8< 
require ["variables", "include"];
require "vnd.dovecot.debug";
set "global.S_TESTVAR leo";
debug_log "LEO SIEVE: in before.d/10-set-defaults, S_TESTVAR:
${global.S_TESTVAR}";
 8< 

default.sieve:
 8< 
require ["variables", "include"];
require "vnd.dovecot.debug";

global "S_TESTVAR";
debug_log "LEO SIEVE: in default.sieve: S_TESTVAR: ${global.S_TESTVAR},
${S_TESTVAR}";
 8< 

Is there any other way to set up defaults in a global sieve script?


--
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Sieve: carry global variables from sieve_before to user sieve scripts

2014-10-20 Thread Alexander &#x27;Leo'; Bergolth
Hi!

Is there a way to initialize global variables with default values in
sieve_before scripts that can be used in the sieve_default script or in
user scripts?

I've tried the following code but this doesn't work..

before.d/10-set-defaults.sieve:
 8< 
require ["variables", "include"];
require "vnd.dovecot.debug";
set "global.S_TESTVAR leo";
debug_log "LEO SIEVE: in before.d/10-set-defaults, S_TESTVAR:
${global.S_TESTVAR}";
 8< 

default.sieve:
 8< 
require ["variables", "include"];
require "vnd.dovecot.debug";

global "S_TESTVAR";
debug_log "LEO SIEVE: in default.sieve: S_TESTVAR: ${global.S_TESTVAR},
${S_TESTVAR}";
 8< 

Is there any other way to set up defaults in a global sieve script?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: v2.2.14 released

2014-10-16 Thread Alexander &#x27;Leo'; Bergolth
On 10/14/2014 06:53 PM, Timo Sirainen wrote:
>   - Fixed several race conditions with dovecot.index.cache handling that
> may have caused unnecessary "cache is corrupted" errors.

Rejoyed too soon! :-(
Unfortunately it doesn't fix my (maybe mbox related) index.cache errors 
reported back in May: http://markmail.org/message/xhxorbutl3encr2d

I know that Timo suggests to switch away from mbox but unfortunately this is 
rather challenging for me. Switching to maildir results in millions of files 
and this overwhelmes my backup system. mdbox also does not qualify since AFAIK 
there is no python or perl library support for manipulating mdbox mailboxes.
:-(

 8< 
Oct 15 15:08:34 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 75144
Oct 15 15:08:34 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argument
Oct 15 15:08:34 samba dovecot: imap(USER1): Error: read(/var/mail/USER1) 
failed: Cached message size smaller than expected (55337 < 55338) (uid=51556, 
box=Trash)
Oct 15 15:20:02 samba dovecot: imap(USER2): Error: Cached message size smaller 
than expected (282553 < 282554)
Oct 15 15:20:02 samba dovecot: imap(USER2): Error: Corrupted index cache file 
/home/USER2/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 12364
Oct 15 15:20:02 samba dovecot: imap(USER2): Error: read(/var/mail/USER2) 
failed: Cached message size smaller than expected (282553 < 282554) (FETCH 
BODY[2] for mailbox INBOX UID 12364)
Oct 15 15:50:30 samba dovecot: imap(USER3): Error: Cached message size smaller 
than expected (58902 < 58903)
Oct 15 15:50:30 samba dovecot: imap(USER3): Error: Corrupted index cache file 
/home/USER3/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 19810
Oct 15 15:50:30 samba dovecot: imap(USER3): Error: read(/var/mail/USER3) 
failed: Cached message size smaller than expected (58902 < 58903) (FETCH BODY[] 
for mailbox INBOX UID 19810)
Oct 15 16:02:56 samba dovecot: imap(USER4): Error: Cached message size smaller 
than expected (181831 < 181832)
Oct 15 16:02:56 samba dovecot: imap(USER4): Error: Corrupted index cache file 
/home/USER4/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 2178
Oct 15 16:02:56 samba dovecot: imap(USER4): Error: read(/var/mail/USER4) 
failed: Cached message size smaller than expected (181831 < 181832) (FETCH 
BODY[] for mailbox INBOX UID 2178)
Oct 15 16:18:24 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (55339 < 55340)
Oct 15 16:18:24 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 75144
Oct 15 16:18:24 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argument
Oct 15 16:18:24 samba dovecot: imap(USER1): Error: read(/var/mail/USER1) 
failed: Cached message size smaller than expected (55339 < 55340) (uid=51559, 
box=Trash)
Oct 15 16:44:15 samba dovecot: imap(USER5): Error: Cached message size smaller 
than expected (6951359 < 6951360)
Oct 15 16:44:15 samba dovecot: imap(USER5): Error: Corrupted index cache file 
/home/USER5/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 5023
Oct 15 16:44:15 samba dovecot: imap(USER5): Error: read(/var/mail/USER5) 
failed: Cached message size smaller than expected (6951359 < 6951360) (FETCH 
BODY[3] for mailbox INBOX UID 5023)
Oct 15 21:27:45 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (45743 < 45744)
Oct 15 21:27:45 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 75059
Oct 15 21:27:45 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argument
Oct 15 21:27:45 samba dovecot: imap(USER1): Error: read(/var/mail/USER1) 
failed: Cached message size smaller than expected (45743 < 45744) (uid=51565, 
box=Trash)
Oct 16 05:10:41 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (98120 < 98121)
Oct 16 05:10:41 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 75158
Oct 16 05:10:41 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argument
Oct 16 05:10:41 samba dovecot: imap(USER1): Error: read(/var/mail/USER1) 
failed: Cached message size smaller than expected (98120 < 98121) (uid=51566, 
box=Trash)
Oct 16 07:11:12 samba dovecot: imap(USER6): Error: Cached message size smaller 
than expected (7991 < 7992)
Oct 16 07:11:12 samba dovecot: imap(USER6): Error: Corrupted index cache file 
/home/USER6/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 925
Oct 16 07:11:12 samba dovecot: imap(USER6): Error: read(/var/mail/USER6) 

permissions when moving mails

2014-10-15 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I am using Unix groups to control access to shared mailboxes.

This works fine as long as files are not moved between mailboxes that
are owned by different groups. The move operation doesn't change group
ownership of the mail.

Is there a way to force dovecot to e.g. inherit the ownership from the
parent folder, not only for new messages bot also for messages moved
from one folder to another?

The wiki says:
http://wiki2.dovecot.org/SharedMailboxes/Permissions
 8< 
When mails are copied between Maildirs, it's usually done by hard
linking. If the source and destination directory permissions are
different, Dovecot create a new file and copies data the slow way so
that it can assign the wanted destination permissions. The source and
destination permission lookups are done only by looking at the mailbox
root directories' permissions, not individual mail files. This may
become a problem if the mail files' permissions aren't as Dovecot expects.
 8< 

Does dovecot only look at the permissions or does it also take
user/group ownership into account? The behavior I experience is that
even though the mailbox directories are owned by different groups,
dovecot doesn't copy the mails. (See my example below.)

Setting maildir_copy_with_hardlinks = no seems to fix the problem but
maybe this behavior should be considered as a bug?

I am using dovecot 2.2.14 and maildir mailboxes.

Cheers,
--leo

P.S.: Here is an example of the current behavior:

before the move from PAS to GSD:
 8< 
GSD/.Eingang/cur/:
total 0
drwxrws--- 2 nobody gsd  6 Oct 13 13:46 .
drwxrws--- 5 nobody gsd 81 Oct 15 09:41 ..

PAS/.Eingang/cur/:
total 4
drwxrws--- 2 nobody pas   89 Oct 15 09:39 .
drwxrws--- 5 nobody pas   79 Oct 15 09:39 ..
-rw-rw-r-- 1 nobody pas 4073 Jul  8 08:14
1404967500.M656935P20690.samba.intern.rk-klosterneuburg.at,S=4073,W=4213:2,S
 8< 

after the move:
 8< 
GSD/.Eingang/cur/:
total 4
drwxrws--- 2 nobody gsd   87 Oct 15 09:42 .
drwxrws--- 5 nobody gsd   81 Oct 15 09:42 ..
-rw-rw-r-- 1 nobody pas 4073 Jul  8 08:14
1413358925.M22574P3008.samba.intern.rk-klosterneuburg.at,S=4073,W=4213:2,S

PAS/.Eingang/cur/:
total 0
drwxrws--- 2 nobody pas  6 Oct 15 09:42 .
drwxrws--- 5 nobody pas 79 Oct 15 09:42 ..
 8< 

Mailbox directories are:
 8< 
drwxrws---  4 nobody pas  143 Nov 25  2013 PAS
drwxrws---  5 nobody pas   79 Oct 15 09:57 PAS/.Eingang
drwxrws--- 10 nobody gsd 4096 Dec 11  2013 GSD
drwxrws---  5 nobody gsd   81 Oct 15 09:42 GSD/.Eingang
 8< 

(In my own litte world, the mail should now be owned by the gsd group.. :-))

-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-24 Thread Alexander &#x27;Leo'; Bergolth

On 23.05.2014 22:03, Timo Sirainen wrote:

On 5/7/2014 4:38 PM, Alexander 'Leo' Bergolth  wrote:

I am getting "Cached message size smaller than expected" errors since
dovecot-2.1.x.



I tried dovecot 2.2.7, 2.2.10 and 2.2.12. All of them produce tha same
errors. ("Cached message size smaller than expected", sometimes followed
by "read... Invalid argument".)


This really drives me to despair! :-(
Timo please help!


I highly recommend switching away from mbox format. This of course
should be fixed, but mbox code is currently pretty low priority on my
list of things to fix.


I'd understand and support that if we were talking about some esoteric 
unusual mailbox format.


However, mbox is still standard for many distributions and is used in a 
huge number of small-scale mailserver installations.


Dovecots documentation doesn't mention that mbox support is broken. 
Quite contrary even the homepage states: "while still supporting the 
standard mbox and Maildir formats". The mbox Wiki page says that mbox is 
standard on usual Unix systems and praises dovecots indexing: "the mbox 
format is typically thought of as a slow format. However with Dovecot's 
indexing this isn't true."


Timo, I really appreciate your work on dovecot. I am successfully using 
dovecot (and mbox) for more then 10 years now and I still believe that 
it is the number one choice.


However, I think this misleading information should really be replaced 
with big fat warnings about broken mbox support. Moreover the linux 
distributions should be warned to not ship mbox mail delivery 
configurations by default.


I'll consider switching to another mailbox format but such a migration 
is not a snap decision, it has to be well considered. I cannot switch 
overnight and thus it's really frustrating having to accept a broken 
mail system for the meantime. Deprecation warnings would have helped here.


Cheers,
--leo
--
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-23 Thread Alexander &#x27;Leo'; Bergolth
On 05/08/2014 11:59 AM, Alexander 'Leo' Bergolth wrote:
> On 05/08/2014 11:44 AM, Charles Marcus wrote:
>> On 5/7/2014 4:38 PM, Alexander 'Leo' Bergolth  wrote:
>>> I am getting "Cached message size smaller than expected" errors since
>>> dovecot-2.1.x.
>>
> I tried dovecot 2.2.7, 2.2.10 and 2.2.12. All of them produce tha same
> errors. ("Cached message size smaller than expected", sometimes followed
> by "read... Invalid argument".)

This really drives me to despair! :-(
Timo please help!

I also tried dovecot-2.2.13 and even downgraded to dovecot-2.1.17 now.
(Did a doveadm -v force-resync -u $user "*" for all users after changing 
versions.)
I can also see somehow similar problems on another box that uses (the rather 
old) dovecot 2.1.1.

I tried to add dotlock to mbox_write_locks since according to the source,
the LDA (maildrop) seems to try dotlock before fcntl.
I also changed fcntl to dotlock for locking index files. (lock_method = dotlock)
The only processes that access a users mailboxes are dovecot (imap and pop) and 
maildrop (LDA).

The only non-standard setup I can identify is that I am using an imap-postlogin 
script that dynamically adds some additional namespaces via environment 
variables for some users that have access to shared mailboxes.
But I doubt wether this can have an influence on the index.cache errors.

I'd greatly appreciate your help!

Thanks,
--leo

maillogs,dovecot config and additional information can be found at:
http://leo.kloburg.at/tmp/dovecot-index/



2.2.13 Errors:
 8< 
May 19 05:51:15 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (75357 < 75358)
May 19 05:51:15 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 70929
May 19 05:51:15 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argument
May 19 05:51:15 samba dovecot: imap(USER1): Error: mail parser: 
read(/var/mail/USER1, box=Trash) failed: Invalid argument
May 19 07:23:59 samba dovecot: imap(USER2): Error: Cached message size smaller 
than expected (75357 < 75358)
May 19 07:23:59 samba dovecot: imap(USER2): Error: Corrupted index cache file 
/home/USER2/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 18322
May 19 07:23:59 samba dovecot: imap(USER2): Error: read(/var/mail/USER2) 
failed: Cached message size smaller than expected (75357 < 75358) (FETCH BODY[] 
for mailbox INBOX UID 18322)
May 19 07:48:11 samba dovecot: imap(USER3): Error: Cached message size smaller 
than expected (13510 < 13511)
May 19 07:48:11 samba dovecot: imap(USER3): Error: Corrupted index cache file 
/home/USER3/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 952
May 19 07:48:11 samba dovecot: imap(USER3): Error: read(/var/mail/USER3) 
failed: Cached message size smaller than expected (13510 < 13511) (FETCH 
BODY[2] for mailbox INBOX UID 952)
May 19 07:58:45 samba dovecot: imap(USER4): Error: Cached message size smaller 
than expected (1892192 < 1892193)
May 19 07:58:45 samba dovecot: imap(USER4): Error: Corrupted index cache file 
/home/USER4/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 20561
May 19 07:58:45 samba dovecot: imap(USER4): Error: copy: i_stream_read() 
failed: Invalid argument
May 19 07:58:45 samba dovecot: imap(USER4): Error: mail parser: 
read(/var/mail/USER4, box=Stab) failed: Invalid argument
May 19 08:58:44 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (185239 < 185240)
May 19 08:58:44 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 70934
May 19 08:58:44 samba dovecot: imap(USER1): Error: read(/var/mail/USER1) 
failed: Cached message size smaller than expected (185239 < 185240) (FETCH 
BODY[] for mailbox INBOX UID 70934)
May 19 09:00:00 samba dovecot: imap(USER2): Error: Cached message size smaller 
than expected (185239 < 185240)
May 19 09:00:00 samba dovecot: imap(USER2): Error: Corrupted index cache file 
/home/USER2/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 18324
May 19 09:00:00 samba dovecot: imap(USER2): Error: copy: i_stream_read() 
failed: Invalid argument
May 19 09:00:00 samba dovecot: imap(USER2): Error: mail parser: 
read(/var/mail/USER2, box=Trash) failed: Invalid argument
May 19 09:56:47 samba dovecot: imap(USER1): Error: Cached message size smaller 
than expected (1829385 < 1829386)
May 19 09:56:47 samba dovecot: imap(USER1): Error: Corrupted index cache file 
/home/USER1/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 70938
May 19 09:56:47 samba dovecot: imap(USER1): Error: copy: i_stream_read() 
failed: Invalid argumen

Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-13 Thread Alexander &#x27;Leo'; Bergolth
On 05/13/2014 12:43 PM, Axel Luttgens wrote:
> Le 8 mai 2014 à 11:59, Alexander 'Leo' Bergolth a écrit :
>> [...]
>> I am using a single server, mbox, local disks (/home and /var is XFS on
>> HP SmartArray).
>>
>> I tried dovecot 2.2.7, 2.2.10 and 2.2.12. All of them produce tha same
>> errors. ("Cached message size smaller than expected", sometimes followed
>> by "read... Invalid argument".)
>>
>> 2.1.1 seems to only produce "Cached message size smaller than expected"
>> without the read errors.
>>
>> Cheers,
>> --leo
>>
>> [...]
>> mbox_write_locks = fcntl
>> [...]
> 
> Hello Alexander,
> 
> Your error messages seem to be related to the user's INBOX.

They appear with different users and are not always related to inboxes. I've 
also encountered those messages with other mailboxes, like 
/home/$USER/mail/Trash.

"doveadm force-resync" doesn't fix them.

> On the other hand, your config doesn't make appear lda nor lmtp (or I missed 
> it, in which case, well... sorry).
> Who puts the incoming messages into the mboxes?

Mail is delivered via maildrop (maildrop-2.5.0-13.el6.x86_64).

I don't think that it is a mailbox lock problem between LDA and dovecot, since

- the errors occur with mailboxes other than INBOX
- there is no mail delivery logged between the last imap logout and the error:

 8< 
May 13 10:16:46 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=6875, secured, session=
May 13 10:18:06 samba dovecot: imap(USERX): Disconnected: Logged out in=507 
out=4607
May 13 10:19:56 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=7686, secured, session=
May 13 10:37:05 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12234, secured, 
session=
May 13 10:38:04 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12483, secured, 
session=
May 13 10:38:05 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12495, secured, 
session=
May 13 10:38:06 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12498, secured, 
session=
May 13 10:38:06 samba dovecot: imap(USERX): Connection closed in=16 out=405
May 13 10:38:07 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12503, secured, 
session=
May 13 10:38:08 samba dovecot: imap(USERX): Error: Cached message size smaller 
than expected (68196 < 68197)
May 13 10:38:08 samba dovecot: imap(USERX): Error: Corrupted index cache file 
/home/USERX/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 1835
May 13 10:38:08 samba dovecot: imap(USERX): Error: read(/var/mail/USERX) 
failed: Invalid argument (uid=1835)
May 13 10:38:08 samba dovecot: imap(USERX): Disconnected: Internal error 
occurred. Refer to server log for more information. [2014-05-13 10:38:07] 
in=794 out=264037
May 13 10:38:08 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12513, secured, 
session=
 8< 

However I do often see multiple imap logins before the errors.
Maybe it's a dovecot internal cache locking issue?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-13 Thread Alexander &#x27;Leo'; Bergolth
On 05/13/2014 01:03 PM, Charles Marcus wrote:
> On 5/13/2014 5:46 AM, Alexander 'Leo' Bergolth  wrote:
>> May 13 10:38:08 samba dovecot: imap(xxx): Disconnected: Internal error
>> occurred. Refer to server log for more information. [2014-05-13
>> 10:38:07] in=794 out=264037
> 
> So... what does server log show?

That's it. (The previous lines are all that gets logged.)

--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-13 Thread Alexander &#x27;Leo'; Bergolth
On 05/07/2014 10:38 PM, Alexander 'Leo' Bergolth wrote:
> I am getting "Cached message size smaller than expected" errors since 
> dovecot-2.1.x.
> Until now, I thought that those errors don't do any harm, I assumed that the 
> cache will just be rebuilt after the error had been detected.
> 
> However, since dovecot 2.2.x (I tried 2.2.7 and 2.2.10), the errors sometimes 
> seem to actually cause mail access to fail.

dovecot 2.2.12 and 2.2.13 also show the same errors:
 8< 
May 13 10:38:07 samba dovecot: imap-login: Login: user=, method=PLAIN, 
rip=172.23.60.1, lip=172.23.60.3, mpid=12503, secured, 
session=
May 13 10:38:08 samba dovecot: imap(xxx): Error: Cached message size smaller 
than expected (68196 < 68197)
May 13 10:38:08 samba dovecot: imap(xxx): Error: Corrupted index cache file 
/home/xxx/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 1835
May 13 10:38:08 samba dovecot: imap(xxx): Error: read(/var/mail/xxx) failed: 
Invalid argument (uid=1835)
May 13 10:38:08 samba dovecot: imap(xxx): Disconnected: Internal error 
occurred. Refer to server log for more information. [2014-05-13 10:38:07] 
in=794 out=264037
 8< 

As before, message size difference is always 1 byte.

Is there any debug mode that could be used to collect more information without 
flooding the server?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-08 Thread Alexander &#x27;Leo'; Bergolth
Am 08.05.2014 13:36, schrieb Charles Marcus:
> On 5/8/2014 5:59 AM, Alexander 'Leo' Bergolth  wrote:
>> I am using a single server, mbox, local disks (/home and /var is XFS on
>> HP SmartArray).
>
> Hmmm... could be an mbox specific issue (I seem to recall issues in the
> past that ended up being mbox related,

I think it might probably be the same issue that had already been
described one year ago for 2.2.0:
http://thread.gmane.org/gmane.mail.imap.dovecot/71636
(Although in my case, the "Cached message size smaller than expected"
difference is always 1 byte.)

> and I think Timo doesn't give
> mbox as much attention as maildir and dbox).

Too bad. Unfortunately it's not easy to switch for me. :-(
Is mbox really such an uncommon scenario with dovecot? AFAIK it's the
default config shipped with most linux distros..

> Also, possibly a kernel issue - you are on a very old one (I know the
> argument, but I disagree with and have never 'gotten' it). 2.6.32 is 6.5
> years old.

Hmm - I think that's very unlikely a kernel issue. It's a Redhat EL 6
kernel so that kernel is actively maintained and very widely used.

> Also, did you change default_vsz_limit for a good reason

Yes. I suppose. ;-)
However, I don't remember that reason now. :-) Maybe I read some
recommendation about that? Maybe about large mailboxes?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] Index cache errors worse with 2.2.x

2014-05-08 Thread Alexander &#x27;Leo'; Bergolth
On 05/08/2014 11:44 AM, Charles Marcus wrote:
> On 5/7/2014 4:38 PM, Alexander 'Leo' Bergolth  wrote:
>> I am getting "Cached message size smaller than expected" errors since
>> dovecot-2.1.x.
> 
> Please provide enough info for someone to actually be able to attempt to
> help you.
> 
> At a bare minimum, you should *always* (not just for dovecot) provide at
> least the OS/ver and dovecot config (doveconf -n output).

See the doveconf output below.

> Also, the further from 'default' settings your setup is, the more
> important it is to provide a description of your environment (ie, is
> this a single server or a member of a cluster? are you using NFS? etc)...

I am using a single server, mbox, local disks (/home and /var is XFS on
HP SmartArray).

I tried dovecot 2.2.7, 2.2.10 and 2.2.12. All of them produce tha same
errors. ("Cached message size smaller than expected", sometimes followed
by "read... Invalid argument".)

2.1.1 seems to only produce "Cached message size smaller than expected"
without the read errors.

Cheers,
--leo

 8< 
# 2.2.12: /etc/dovecot/dovecot.conf
# OS: Linux 2.6.32-431.3.1.el6.x86_64 x86_64 CentOS release 6.5 (Final)
auth_mechanisms = plain login
auth_verbose = yes
default_vsz_limit = 512 M
first_valid_uid = 100
imap_client_workarounds = tb-extra-mailbox-sep
login_trusted_networks = 172.23.60.0/24
mail_location = mbox:~/mail:INBOX=/var/mail/%u
mail_plugins = " mail_log notify"
mail_privileged_group = mail
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
mbox_write_locks = fcntl
namespace inbox {
  inbox = yes
  location = mbox:~/mail:INBOX=/var/mail/%u
  mailbox Drafts {
special_use = \Drafts
  }
  mailbox Junk {
special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbox Trash {
special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
passdb {
  driver = pam
}
plugin {
  mail_log_events = delete undelete expunge copy mailbox_delete
mailbox_rename
  mail_log_fields = uid box msgid size
}
protocols = imap pop3
service auth {
  unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
  }
}
service imap-postlogin {
  executable = script-login -d /usr/local/sbin/dovecot-post-login.pl
}
service imap {
  executable = imap imap-postlogin
}
ssl = required
ssl_cert = 

[Dovecot] Index cache errors worse with 2.2.x

2014-05-07 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I am getting "Cached message size smaller than expected" errors since 
dovecot-2.1.x.
Until now, I thought that those errors don't do any harm, I assumed that the 
cache will just be rebuilt after the error had been detected.

However, since dovecot 2.2.x (I tried 2.2.7 and 2.2.10), the errors sometimes 
seem to actually cause mail access to fail.

With dovecot-2.1.1, only the first two messages were logged, since using 2.2.7 
and 2.2.10, the "read ... failed: Invalid argument" sometimes appear:
 8< 
May  7 17:03:52 samba dovecot: imap(xyz): Error: Cached message size smaller 
than expected (2246 < 2247)
May  7 17:03:52 samba dovecot: imap(xyz): Error: Corrupted index cache file 
/home/xyz/mail/.imap/INBOX/dovecot.index.cache: Broken physical size for mail 
UID 11277
May  7 17:03:52 samba dovecot: imap(xyz): Error: read(/var/mail/xyz) failed: 
Invalid argument
May  7 17:03:52 samba dovecot: imap(xyz): Error: read(/var/mail/xyz) failed: 
Invalid argument (uid=11277)
 8< 

I am using dovecot on RHEL6 with mbox mailboxes. Message size differences are 
always 1 byte.

Any hints would be appreciated!

Cheers,
--leo

P.S.: Those errors occur some times a day and affect different users..
(Upgrade 2.1.1 -> 2.2.7 was on 2013-11-22, 2.2.10 was installed on 2014-01-20.)

# for f in maillog* ; do echo -n "$f: "; grep "dovecot:.*Error: 
read.*failed.*Invalid arg" $f | wc -l; done
maillog: 31
maillog-20130801: 0
maillog-20130901: 1
maillog-20131001: 0
maillog-20131101: 0
maillog-20131201: 30
maillog-20140101: 92
maillog-20140201: 110
maillog-20140301: 99
maillog-20140401: 133
maillog-20140501: 100

# for f in maillog* ; do echo -n "$f: "; grep "dovecot:.*Error: Cached message 
size smaller than expected" $f | wc -l; done
maillog: 99
maillog-20130801: 465
maillog-20130901: 484
maillog-20131001: 512
maillog-20131101: 460
maillog-20131201: 520
maillog-20140101: 402
maillog-20140201: 400
maillog-20140301: 355
maillog-20140401: 481
maillog-20140501: 434

-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria


Re: [Dovecot] userdb namespace settings bug

2012-05-14 Thread Alexander &#x27;Leo'; Bergolth
On 05/14/2012 10:40 AM, Alexander 'Leo' Bergolth wrote:
> On 05/13/2012 11:40 PM, Alexander 'Leo' Bergolth wrote:
>> Since upgrading to 2.1.6, setting namespaces via environment variables
>> using a imap-postlogin-script *sometimes* doesn't work.
>>
>> See the error message:
>> Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/
> 
> The prefix "plugin/" is added in mail-storage-service.c:set_line():
> 
>  8< 
> if (!settings_parse_is_valid_key(set_parser, key)) {
> /* assume it's a plugin setting */
> key = t_strconcat("plugin/", key, NULL);
>  8< 
> 
> Looks like dovecot doesn't think that s-gsd isn't a valid namespace...
> Maybe the order of parsing the userdb settings is not well defined?
> 
> I think it should parse the list of allowed namespaces first
> (namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage) and the namespace specific
> settings after that.
> 
> However, the debug output shows a different order:
> 
>  8< 
> May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
> plugin/namespace/s-gsd/prefix=Shared/GSD/
> May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
> plugin/namespace/s-rufhilfe/location=maildir:/var/spool/mail/Shared/Rufhilfe:INDEX=~/Maildir/index/Shared/Rufhilfe
> May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
> namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage
> May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
> namespace/s-rufhilfe/separator=/
>  8< 
> 
> The first two namespace settings are rejected because the allowed namespaces 
> are
> not configured yet.
> The third line configures the namespaces and subsequent namespace-settings 
> are working fine.
> 
> Does that sound reasonable?
> 
> Any hints on how to change the order of userdb settings?

OK, got it.

userdb settings are parsed in the same order as set in USERDB_KEYS.
The key NAMESPACES has to be defined before the namespace-specific keys.

My post-login script was setting this variable dynamically from a hash
so the order was undefined. That's why it did actually work sometimes... :-)

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] userdb namespace settings bug

2012-05-14 Thread Alexander &#x27;Leo'; Bergolth
On 05/13/2012 11:40 PM, Alexander 'Leo' Bergolth wrote:
> Since upgrading to 2.1.6, setting namespaces via environment variables
> using a imap-postlogin-script *sometimes* doesn't work.
> 
> Sometimes, the prefix of a namespace isn't set correctly, but is set to
> an empty string, which leads to the following error:
> namespace configuration error: Duplicate namespace prefix: ""
> 
> However, the environment is set correctly, the error seems to occur when
> parsing the environment.
> 
> See the attached log:
> The postlogin-script sets the environment variables attached as
> dovecot-postlogin-environment.txt. (dumped from postlogin script via env)
> 
> However, the variable "NAMESPACE/S-GSD/PREFIX=Shared/GSD/" gets parsed
> as: plugin/namespace/s-gsd/prefix=Shared/GSD/
> 
> See the error message:
> Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/

The prefix "plugin/" is added in mail-storage-service.c:set_line():

 8< 
if (!settings_parse_is_valid_key(set_parser, key)) {
/* assume it's a plugin setting */
key = t_strconcat("plugin/", key, NULL);
 8< 

Looks like dovecot doesn't think that s-gsd isn't a valid namespace...
Maybe the order of parsing the userdb settings is not well defined?

I think it should parse the list of allowed namespaces first
(namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage) and the namespace specific
settings after that.

However, the debug output shows a different order:

 8< 
May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
plugin/namespace/s-gsd/prefix=Shared/GSD/
May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
plugin/namespace/s-rufhilfe/location=maildir:/var/spool/mail/Shared/Rufhilfe:INDEX=~/Maildir/index/Shared/Rufhilfe
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-rufhilfe/separator=/
 8< 

The first two namespace settings are rejected because the allowed namespaces are
not configured yet.
The third line configures the namespaces and subsequent namespace-settings are 
working fine.

Does that sound reasonable?

Any hints on how to change the order of userdb settings?

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



[Dovecot] userdb namespace settings bug

2012-05-13 Thread Alexander &#x27;Leo'; Bergolth
Hi!

Since upgrading to 2.1.6, setting namespaces via environment variables
using a imap-postlogin-script *sometimes* doesn't work.

Sometimes, the prefix of a namespace isn't set correctly, but is set to
an empty string, which leads to the following error:
namespace configuration error: Duplicate namespace prefix: ""

However, the environment is set correctly, the error seems to occur when
parsing the environment.

See the attached log:
The postlogin-script sets the environment variables attached as
dovecot-postlogin-environment.txt. (dumped from postlogin script via env)

However, the variable "NAMESPACE/S-GSD/PREFIX=Shared/GSD/" gets parsed
as: plugin/namespace/s-gsd/prefix=Shared/GSD/

See the error message:
Unknown userdb setting: plugin/namespace/s-gsd/prefix=Shared/GSD/

After restarting dovecot, the same configuration sometimes works correctly.

I'd greatly appreciate your help! Unfortunately I have done the upgrade
on a production system, so the issue is quite serious for me..

Will downgrading to 2.0 work? (Index-files, etc?)

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria

May 13 23:00:22 samba dovecot: imap-login: Login: user=, 
method=PLAIN, rip=172.23.60.1, lip=172.23.60.3, mpid=10588, secured, 
session=
May 13 23:00:22 samba dovecot: imap-postlogin: Error: adding 
NAMESPACE/S-GSD/PREFIX /var/spool/mail/Shared/GSD
May 13 23:00:22 samba dovecot: imap-postlogin: Error: adding 
NAMESPACE/S-KIT/PREFIX /var/spool/mail/Shared/KIT
May 13 23:00:22 samba dovecot: imap-postlogin: Error: adding 
NAMESPACE/S-RUFHILFE/PREFIX /var/spool/mail/Shared/Rufhilfe
May 13 23:00:22 samba dovecot: imap-postlogin: Error: adding 
NAMESPACE/S-SEF/PREFIX /var/spool/mail/Shared/SEF
May 13 23:00:22 samba dovecot: imap-postlogin: Error: adding 
NAMESPACE/S-HOMEPAGE/PREFIX /var/spool/mail/Shared/homepage
May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
plugin/namespace/s-gsd/prefix=Shared/GSD/
May 13 23:00:22 samba dovecot: imap: Debug: Unknown userdb setting: 
plugin/namespace/s-rufhilfe/location=maildir:/var/spool/mail/Shared/Rufhilfe:INDEX=~/Maildir/index/Shared/Rufhilfe
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace=s-gsd s-kit s-rufhilfe s-sef s-homepage
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-rufhilfe/separator=/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-rufhilfe/list=yes
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-sef/separator=/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-kit/location=maildir:/var/spool/mail/Shared/KIT:INDEX=~/Maildir/index/Shared/KIT
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-homepage/separator=/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-homepage/prefix=Shared/homepage/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-sef/location=maildir:/var/spool/mail/Shared/SEF:INDEX=~/Maildir/index/Shared/SEF
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-gsd/location=maildir:/var/spool/mail/Shared/GSD:INDEX=~/Maildir/index/Shared/GSD
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-homepage/type=public
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-homepage/location=maildir:/var/spool/mail/Shared/homepage:INDEX=~/Maildir/index/Shared/homepage
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-gsd/separator=/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-sef/prefix=Shared/SEF/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-kit/prefix=Shared/KIT/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-sef/list=yes
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-rufhilfe/type=public
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-kit/type=public
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-sef/type=public
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-homepage/list=yes
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-rufhilfe/prefix=Shared/Rufhilfe/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-kit/separator=/
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-kit/list=yes
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-gsd/list=yes
May 13 23:00:22 samba dovecot: imap: Debug: Added userdb setting: 
namespace/s-gsd/type=public
May 13 23:00:22 samba dovecot: imap(abergolth): Debug: Effective uid=1162, 
gid=1000, home=/home/abergolth
May 13 23:00:22 samba doveco

Re: [Dovecot] setting namespaces using script-login environment in 2.0

2011-11-16 Thread Alexander &#x27;Leo'; Bergolth
On 11/04/2011 10:18 PM, Timo Sirainen wrote:
> On Mon, 2011-10-31 at 18:00 +0100, Alexander 'Leo' Bergolth wrote:
>> NAMESPACE_2='maildir:/var/mail/Shared/spamrep:INDEX=~/Maildir/index/Shared/spamrep'
>> NAMESPACE_2_PREFIX=Shared/spamrep/
> 
> The settings are now named.
> http://wiki2.dovecot.org/MailLocation#Custom_namespace_location shows
> the basics. So for example if you have:
> 
> namespace foo {
>   ..
> }
> 
> You can change it via:
> 
> NAMESPACE/FOO/PREFIX=Shared/spamrep/
> NAMESPACE/FOO/SEP=/
> ..etc..
> 
> The '/' character is a bit problematic with shells scripts though, see
> the wiki link how to do it via "env" at least.
> 
> Another problem is if you want to add more namespaces than you have
> configured. IIRC it's possible to simply add:
> 
> NAMESPACE=foo

Thanks a lot, Timo!

Changing to named, /-separated environment variables did the job.

NAMESPACE/S-SPAMREP/LIST=yes
NAMESPACE/S-SPAMREP/LOCATION=maildir:/var/spool/mail/Shared/spamrep:INDEX=~/Maildir/index/Shared/spamrep
NAMESPACE/S-SPAMREP/PREFIX=Shared/spamrep/
NAMESPACE/S-SPAMREP/SEPARATOR=/
NAMESPACE/S-SPAMREP/TYPE=public
NAMESPACE/S-TESTSHARED/LIST=yes
NAMESPACE/S-TESTSHARED/LOCATION=maildir:/var/spool/mail/Shared/testshared:INDEX=~/Maildir/index/Shared/testshared
NAMESPACE/S-TESTSHARED/PREFIX=Shared/testshared/
NAMESPACE/S-TESTSHARED/SEPARATOR=/
NAMESPACE=s-testshared s-spamrep
NAMESPACE/S-TESTSHARED/TYPE=public

USERDB_KEYS=SYSTEM_GROUPS_USER UID GID HOME  NAMESPACE/S-SPAMREP/LIST NAMESPACE 
NAMESPACE/S-TESTSHARED/SEPARATOR NAMESPACE/S-TESTSHARED/TYPE 
NAMESPACE/S-TESTSHARED/PREFIX NAMESPACE/S-TESTSHARED/LIST 
NAMESPACE/S-TESTSHARED/LOCATION NAMESPACE/S-SPAMREP/SEPARATOR 
NAMESPACE/S-SPAMREP/TYPE NAMESPACE/S-SPAMREP/PREFIX NAMESPACE/S-SPAMREP/LOCATION

> And more than one is probably either "foo bar" or "foo,bar". If you get
> something to work, please add example to
> http://wiki2.dovecot.org/PostLoginScripting :)

I'll add my script to the Wiki.

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] setting namespaces using script-login environment in 2.0

2011-11-04 Thread Alexander &#x27;Leo'; Bergolth
On 11/01/2011 09:12 PM, Alexander 'Leo' Bergolth wrote:
> On 10/31/2011 06:41 PM, e-frog wrote:
>> On 31.10.2011 18:00, wrote Alexander 'Leo' Bergolth:
>>> Have environment based namespace settings been abandoned in 2.0?
>>>
>> I think you need to add them to USERDB_KEYS now...
>>
>> http://wiki2.dovecot.org/PostLoginScripting#Running_environment
> 
> I have added NAMESPACE_1 NAMESPACE_1_SEP NAMESPACE_1_TYPE
> NAMESPACE_1_LIST NAMESPACE_1_PREFIX to USERDB_KEYS.
> 
> Unfortunately the namespace still isn't used. :-(

Can anyone confirm that setting namespaces via environment isn't
supported in 2.0 anymore?

Is there another way to dynamically add namespaces?

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] setting namespaces using script-login environment in 2.0

2011-11-01 Thread Alexander &#x27;Leo'; Bergolth
On 10/31/2011 06:41 PM, e-frog wrote:
> On 31.10.2011 18:00, wrote Alexander 'Leo' Bergolth:
>> Have environment based namespace settings been abandoned in 2.0?
>>
> I think you need to add them to USERDB_KEYS now...
> 
> http://wiki2.dovecot.org/PostLoginScripting#Running_environment

I have added NAMESPACE_1 NAMESPACE_1_SEP NAMESPACE_1_TYPE
NAMESPACE_1_LIST NAMESPACE_1_PREFIX to USERDB_KEYS.

Unfortunately the namespace still isn't used. :-(

--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



[Dovecot] setting namespaces using script-login environment in 2.0

2011-10-31 Thread Alexander &#x27;Leo'; Bergolth
Hi!

With dovecot 1.x, I was using a post-login script to dynamically add
shared mailboxes using NAMESPACE_X.. environment variables, based on
filesystem permissions:
After login, the post-login script was executed with user permissions
(mail_drop_priv_before_exec=yes). It added all subdirectories of
"/var/spool/mail/Shared" as namespaces for which the user had write
permissions. E.g.:

NAMESPACE_2='maildir:/var/mail/Shared/spamrep:INDEX=~/Maildir/index/Shared/spamrep'
NAMESPACE_2_PREFIX=Shared/spamrep/
NAMESPACE_2_SEP=/
NAMESPACE_2_TYPE=public
NAMESPACE_2_LIST=yes

See the attached post-pogin-script for details.

After switching to 2.0.14 (using executable script-login -d...), the
script actually gets executed but the namespace settings do not seem to
be honored.
Besides, I don't see any pre-set NAMESPACE_ environment variables anymore.

Have environment based namespace settings been abandoned in 2.0?

Does Dovecot 2.0 maybe provide a better way to only display those
folders, for which the user has at least read permissions?
(Unix-permission based)

Thanks in advance,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] deliver and cloning file permissions

2010-02-13 Thread Alexander &#x27;Leo'; Bergolth
On 02/14/2010 12:45 AM, Pascal Volk wrote:
> On 02/14/2010 12:03 AM Alexander 'Leo' Bergolth wrote:
>> On 02/13/2010 09:28 PM, Pascal Volk wrote:
>>> Dovecot: dovecot.conf²
>>> mail_location = maildir:~/Maildir
>>
>> Unfortunately switching from mbox to maildir is not an option.
>>
>> Btw. I don't see the solution. If the inbox is still /var/mail/
>> and is still group-owned by "mail", dovecot will still have the same
>> problems cloning the group-permissions to ~/Maildir.
> 
> Because you've overlooked, at least removed, the Postfix configuration
> setting in the quoted part. When Dovecot's mail_location is set to
> 'maildir:~/Maildir' and Postfix's mailbox_command (for local users)
> points to Dovecot's deliver, all mails will be delivered via deliver
> into the INBOX from the mail_location setting.
> 
> The users INBOX would be still in /var/mail/, if you would use
> Postfix's local daemon for local delivery and Dovecot's mail_location
> would be set to: mail_location = maildir:~/Maildir:INBOX=/var/mail/%u

OK, thanks, I got the big picture now. :-)
Unfortunately I am forced to mbox inboxes in /var/mail/.

Any other hints?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] deliver and cloning file permissions

2010-02-13 Thread Alexander &#x27;Leo'; Bergolth
On 02/13/2010 09:28 PM, Pascal Volk wrote:
> On 02/13/2010 02:57 PM Alexander 'Leo' Bergolth wrote:
>> I'd like to use deliver (dovecot-1.2.10) as LDA to deliver mails to my
>> local users on my postfix-system.
>>
>> However, deliver tries to copy the filesystem permissions of the
>> mail-spool-files to the user's index files, which doesn't work, since
>> the files in /var/mail/ belong to the group 'mail'.
>>
>> Feb 13 00:21:19 leo-x61 dovecot: deliver(leo):
>> fchown(/home/leo/mail/.imap/INBOX/dovecot.index.log.newlock, -1,
>> 12(mail)) failed: Operation not permitted (egid=100(users), group based
>> on /var/mail/leo)
>>
>> Is there any workaround?
> 
> Hm, what about a 'better solution'? Using Maildir.
[...]
> Dovecot: dovecot.conf²
>   mail_location = maildir:~/Maildir

Unfortunately switching from mbox to maildir is not an option.

Btw. I don't see the solution. If the inbox is still /var/mail/
and is still group-owned by "mail", dovecot will still have the same
problems cloning the group-permissions to ~/Maildir.

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



[Dovecot] deliver and cloning file permissions

2010-02-13 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I'd like to use deliver (dovecot-1.2.10) as LDA to deliver mails to my
local users on my postfix-system.

However, deliver tries to copy the filesystem permissions of the
mail-spool-files to the user's index files, which doesn't work, since
the files in /var/mail/ belong to the group 'mail'.

Feb 13 00:21:19 leo-x61 dovecot: deliver(leo):
fchown(/home/leo/mail/.imap/INBOX/dovecot.index.log.newlock, -1,
12(mail)) failed: Operation not permitted (egid=100(users), group based
on /var/mail/leo)

I know that dovecot tries to clone the mailbox permissions in order to
support shared folders but it would be nice if there was an option to
disable this (or to just try it and ignore the fchown error).

I could manually change group ownership of all mailboxes from mail to
each user's primary group or set the mailbox-modes to 0600 but I'd also
have to do that for every new user.
(Tools to create users like useradd from shadow-utils use hardcoded file
modes and group ownership.)

Is there any workaround?

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
On 11/23/2009 11:05 PM, Timo Sirainen wrote:
> On Mon, 2009-11-23 at 22:56 +0100, Alexander 'Leo' Bergolth wrote:
>>> Also do you have
>>> a /var/spool/mail/Shared/spamrep/cur/ directory?
>> Yes:
>> # ls -ld /var/spool/mail/Shared/spamrep/cur
>> drwxrws--- 2 nobody spamrep 6 2009-11-23 16:02
>> /var/spool/mail/Shared/spamrep/cur
> 
> That's the reason this happens. Anything inside it? Probably not? Just
> rmdir it and new/ and tmp/.

Now that I removed the cur folder from Shared/spamrep, everything works
fine. But could you shed some light on this?

If Shared/spamrep/ contains cur/, new/ and tmp/, I'd suspect that
dovecot should display Shared/spamrep as a folder but not Shared. Why is
Shared/ also missing the \Noselect attribute?

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
On 11/23/2009 11:05 PM, Timo Sirainen wrote:
> On Mon, 2009-11-23 at 22:56 +0100, Alexander 'Leo' Bergolth wrote:
>>> Also do you have
>>> a /var/spool/mail/Shared/spamrep/cur/ directory?
>> Yes:
>> # ls -ld /var/spool/mail/Shared/spamrep/cur
>> drwxrws--- 2 nobody spamrep 6 2009-11-23 16:02
>> /var/spool/mail/Shared/spamrep/cur
> 
> That's the reason this happens. Anything inside it? Probably not? Just
> rmdir it and new/ and tmp/.

That did it. Many thanks!

--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
On 11/23/2009 09:51 PM, Timo Sirainen wrote:
> On Mon, 2009-11-23 at 21:39 +0100, Alexander 'Leo' Bergolth wrote:
>> 16 list "" "%"
>>
>> ... and dovecot returns "Shared" without \Noselect:
>>
>> * LIST (\HasChildren) "/" "Shared"
>>
>> Is there a way to tell dovecot that this is only the base of my
>> namespaces and that it should include a \Noselect attribute?
> 
> In my tests it shows \Noselect.. So something's different with you. What
> does it show if you do 1 LIST "" "Shared*"?

 8< 
1 LIST "" "Shared*"
* LIST (\HasChildren) "/" "Shared/spamrep"
* LIST (\HasNoChildren) "/" "Shared/spamrep/INBOX"
* LIST (\HasNoChildren) "/" "Shared/spamrep/ham"
* LIST (\HasNoChildren) "/" "Shared/spamrep/spam-netreport"
* LIST (\HasNoChildren) "/" "Shared/spamrep/spam"
* LIST (\HasNoChildren) "/" "Shared/spamrep/tmp"
 8< 

LIST "" "*" shows:
 8< 
[...]
* LIST (\NoInferiors \Marked) "/" "INBOX"
* LIST (\HasChildren) "/" "Shared/spamrep"
* LIST (\HasNoChildren) "/" "Shared/spamrep/INBOX"
* LIST (\HasNoChildren) "/" "Shared/spamrep/ham"
[...]
 8< 

(without Shared/)

... but LIST "" "%" shows:
 8< 
[...]
* LIST (\NoInferiors \Marked) "/" "INBOX"
* LIST (\HasChildren) "/" "Shared"
1 OK List completed.
 8< 

> Also do you have
> a /var/spool/mail/Shared/spamrep/cur/ directory?

Yes:
# ls -ld /var/spool/mail/Shared/spamrep/cur
drwxrws--- 2 nobody spamrep 6 2009-11-23 16:02
/var/spool/mail/Shared/spamrep/cur

I am using dovecot 1.2.8:
# rpm -q dovecot
dovecot-1.2.8-0_103.fc10.i386
(From ATrpms: http://atrpms.net/dist/f10/dovecot/ )

I have attached the environment captured at the end of the post-login
script.

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



Re: [Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
On 11/23/2009 07:27 PM, Timo Sirainen wrote:
> On Mon, 2009-11-23 at 19:19 +0100, Alexander 'Leo' Bergolth wrote:
>> Nov 23 19:10:15 strike dovecot: IMAP(leo): Namespace: type=shared, 
>> prefix=Shared/spamrep/, sep=/, inbox=no, hidden=no, list=yes, 
>> subscriptions=no
> 
> See if using type=public works better. type=shared namespace is kind of
> a special case used to access other users' mailboxes.

Yes, thanks! type=public works fine.

Another problem is that with dovecot 1.2, Thunderbird shows "Shared"
(the folder that contains all of my dynamically added namespaces) as a
real folder, not grey and italic as before.
When selecting it, the following message pops up:
"The current command did not succeed. The mail server responded:
[NONEXISTENT] Mailbox doesn't exist: Shared."

Before the dovecot update, Thunderbird didn't show Shared as a real
folder, it was greyed out and selecting it didn't cause an IMAP "SELECT"
command.

Looking at the imap traffic, thunderbird does a

16 list "" "%"

... and dovecot returns "Shared" without \Noselect:

* LIST (\HasChildren) "/" "Shared"

Is there a way to tell dovecot that this is only the base of my
namespaces and that it should include a \Noselect attribute?

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria




Re: [Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
On 11/23/2009 06:28 PM, Timo Sirainen wrote:
> On Mon, 2009-11-23 at 17:03 +0100, Alexander 'Leo' Bergolth wrote:
>> However now that I've upgraded to 1.2.8, I cannot create subfolders
>> anymore. The server responds with "NO Invalid mailbox name:
>> test/testsub". The hierarchy separator for the namespaces is / because I
>> am mixing maildir and mbox namespaces and list=yes.
>>
>> The details:
>> I am using a post-login script (attached) that detects all subfolders of
>> /var/spool/mail/Shared for which the current user has at least read
>> access. For every subfolder, it creates a separate namespace with the
>> prefix Shared/. The shared mailbox trees are in maildir format.
> 
> Are you setting the hierarchy separator in environment for the other
> created namespaces? It sounds like you aren't. Looking at logs with
> mail_debug=yes would verify.

Yes, I am. I am using 
  $ENV{"NAMESPACE_${nr}_SEP"}= "/";
... in the post-login script.

The debug log says:
 8< 
Nov 23 19:10:15 strike dovecot: IMAP(leo): Namespace: type=private, prefix=, 
sep=/, inbox=yes, hidden=no, list=yes, subscriptions=yes
Nov 23 19:10:15 strike dovecot: IMAP(leo): mbox: data=~/mail:INBOX=/var/mail/leo
Nov 23 19:10:15 strike dovecot: IMAP(leo): fs: root=/home/leo/mail, index=, 
control=, inbox=/var/mail/leo
Nov 23 19:10:15 strike dovecot: IMAP(leo): Namespace: type=shared, 
prefix=Shared/spamrep/, sep=/, inbox=no, hidden=no, list=yes, subscriptions=no
Nov 23 19:10:15 strike dovecot: IMAP(leo): maildir: 
data=/var/spool/mail/Shared/spamrep:CONTROL=~/Maildir/control/Shared/spamrep:INDEX=~/Maildir/index/Share
d/spamrep
Nov 23 19:10:15 strike dovecot: IMAP(leo): maildir++: 
root=/var/spool/mail/Shared/spamrep, 
index=/home/leo/Maildir/index/Shared/spamrep, 
control=/home/leo/Maildir/control/Shared/spamrep, inbox=
 8< 

Trying to create Shared/spamrep/test/testsub fails for example...

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at   
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



[Dovecot] shared mailboxes using namespaces in 1.2

2009-11-23 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I've been using shared mailbox trees using maildir, unix permissions and
separate namespaces per shared tree since dovecot 1.0.

However now that I've upgraded to 1.2.8, I cannot create subfolders
anymore. The server responds with "NO Invalid mailbox name:
test/testsub". The hierarchy separator for the namespaces is / because I
am mixing maildir and mbox namespaces and list=yes.

The details:
I am using a post-login script (attached) that detects all subfolders of
/var/spool/mail/Shared for which the current user has at least read
access. For every subfolder, it creates a separate namespace with the
prefix Shared/. The shared mailbox trees are in maildir format.

If one of those namespace-prefixes is e.g. "Shared/sharedmailbox/", I am
able to create "Shared/sharedmailbox/test" but trying to create
"Shared/sharedmailbox/test/testsub" will fail with the above error. If I
set the herarchy separator to '.' even creating
"Shared/sharedmailbox/test" will fail.

Any hints?

Thanks,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu.ac.at
fax  ::: +43-1-31336-906050
location ::: IT-Services | Vienna University of Economics | Austria



# 1.2.8: /etc/dovecot.conf
# OS: Linux 2.6.27.12-170.2.5.fc10.i686.PAE i686 Fedora release 10 (Cambridge) 
login_dir: /var/run/dovecot/login
login_executable(default): /usr/libexec/dovecot/imap-login
login_executable(imap): /usr/libexec/dovecot/imap-login
login_executable(pop3): /usr/libexec/dovecot/pop3-login
first_valid_uid: 100
mail_location: mbox:~/mail:INBOX=/var/mail/%u
mail_drop_priv_before_exec(default): yes
mail_drop_priv_before_exec(imap): yes
mail_drop_priv_before_exec(pop3): no
mail_executable(default): /usr/local/sbin/dovecot-post-login.pl 
/usr/libexec/dovecot/imap
mail_executable(imap): /usr/local/sbin/dovecot-post-login.pl 
/usr/libexec/dovecot/imap
mail_executable(pop3): /usr/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/lib/dovecot/imap
mail_plugin_dir(imap): /usr/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/lib/dovecot/pop3
namespace:
  type: private
  separator: /
  location: mbox:~/mail:INBOX=/var/mail/%u
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  postmaster_address: postmas...@strike.wu-wien.ac.at
auth default:
  mechanisms: plain gssapi
  passdb:
driver: pam
  userdb:
driver: passwd
  socket:
type: listen
client:
  path: /var/spool/postfix/private/auth
  mode: 432
  user: postfix
  group: postfix



[Dovecot] deliver: keep existing From_ line

2007-12-30 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I'm using procmail to filter my email. (I have to use it because of
various features that are not supported by sieve.)
However, I'd like to deliver mail to my mboxes using dovecots deliver
program in order to update index files and speed up mbox access.

Using "| $DELIVER -m " in my procmail receipes, everything
works fine, except that the envelope sender address is mangled. deliver
sets it to MAILER-DAEMON, even though it is already provided in the
first line of the mail.

I cannot use the "-f " options of deliver, since procmail
doesn't provide the envelope-sender address in a variable. (I'd have to
extract it from the first line of the mail using a separate receipe,
which isn't very efficient.)

Is there a way to keep the already existing "From " line?

Thanks in advance,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria



Re: [Dovecot] namespaces, shared mailboxes

2007-12-02 Thread Alexander &#x27;Leo'; Bergolth
On 12/02/2007 09:35 PM, Benjamin R. Haskell wrote:
> On Sun, 2 Dec 2007, Nikolay Shopik wrote:
>> On 02.12.2007 23:21, Alexander 'Leo' Bergolth wrote:
>>> [...]
>>> I'd like to be able to deliver e.g. new mail to the technical support
>>> directly to "Shared/tech/" but if that's not possible, it isn't a big
>>> problem, I'll just use "Shared/tech/INCOMING".
>>>
>> You can't deliver to namespaces using 1.0 dovecot tree only 1.1
>> support it.
>>
> Using dovecot's 'deliver' in 1.0, you can't. It's pretty easy using
> another MDA/LDA.
> 
> e.g. using procmail: DEFAULT=/var/spool/mail/Shared/tech/

Yes, I'm already doing exactly that:
tech-support: "| /usr/bin/procmail DEFAULT=/var/spool/mail/Shared/tech/
UMASK=007"

But the problem is that clients won't see the mails, unless I create an
empty directory "/var/spool/mail/Shared/tech/.INBOX". Once that
directory is in place, clients will show the delivered mails in
"Shared/tech/INBOX". (Even though I delivered them to "../tech/".)

Cheers,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria



Re: [Dovecot] namespaces, shared mailboxes

2007-12-02 Thread Alexander &#x27;Leo'; Bergolth
On 12/02/2007 08:59 PM, Benjamin R. Haskell wrote:
> On Sun, 2 Dec 2007, Timo Sirainen wrote:
>> On Sat, 2007-12-01 at 23:59 +0100, Alexander 'Leo' Bergolth wrote:
>>> I'd like to provide shared mailboxes with maildir that should appear
>>> like 'Shared/' to the clients.
>>>
>>> Using the namespace configuration below, everything works fine, exept
>>> one thing: Mail clients (only tested with Thunderbird) won't allow to
>>> put mails directly in 'Shared/mailboxname' (the folder it is greyed
>>> out). You currently have to create subfolders and put the mails in those
>>> subfolders.
>> ..
>>> namespace shared {
>>>   separator = /
>>>   # hidden = yes
>>>   prefix = Shared/spamrep/
>>>   location =
>>> maildir:/var/spool/mail/Shared/spamrep:CONTROL=~/Maildir/control/Shared/spamrep:INDEX=~/Mail\
>>>
>>> dir/index/Shared/spamrep
>>
>> I find it strange that this kind of configuration even appears to
>> work. :) If you somehow manage to get it working with v1.0, there's a
>> good chance that it won't work anymore with v1.1.
>>
>> So if you want to access "Shared/spamrep" as a mailbox, the prefix must
>> be Shared/.
>>
>> If you wanted users to have different views of what the mailboxes look
>> like, you could just change the location to be different for different
>> users. Create symlinks to the visible global mailboxes to those
>> locations.
> 
> Having multiple namespaces setup that way seems reasonable to me.
> 
> e.g.
> /var/spool/mail/Shared/tech/...
> /var/spool/mail/Shared/financial/...
> 
> where 'Shared/tech' would be visible to many, but 'Shared/financial'
> would be visible only to execs/accountants. And both would show up under
> a common 'Shared/' prefix to keep them distinct from user folders.

Yes, that's exactly my intention. There should be shared mailboxes for
departments or other groups of people. People having access to those
folders should be able to create subfolders but they should not be able
to add new folders directly under "Shared".

> It sounds like he just wants to be able to SELECT the root of a namespace.

I'd like to be able to deliver e.g. new mail to the technical support
directly to "Shared/tech/" but if that's not possible, it isn't a big
problem, I'll just use "Shared/tech/INCOMING".

Cheers,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria



Re: [Dovecot] namespaces, shared mailboxes

2007-12-02 Thread Alexander &#x27;Leo'; Bergolth
On 12/02/2007 02:45 PM, Timo Sirainen wrote:
> On Sat, 2007-12-01 at 23:59 +0100, Alexander 'Leo' Bergolth wrote:
>> I'd like to provide shared mailboxes with maildir that should appear
>> like 'Shared/' to the clients.
>>
>> Using the namespace configuration below, everything works fine, exept
>> one thing: Mail clients (only tested with Thunderbird) won't allow to
>> put mails directly in 'Shared/mailboxname' (the folder it is greyed
>> out). You currently have to create subfolders and put the mails in those
>> subfolders.
> ..
>> namespace shared {
>>   separator = /
>>   # hidden = yes
>>   prefix = Shared/spamrep/
>>   location =
>> maildir:/var/spool/mail/Shared/spamrep:CONTROL=~/Maildir/control/Shared/spamrep:INDEX=~/Mail\
>> dir/index/Shared/spamrep
> 
> I find it strange that this kind of configuration even appears to
> work. :) If you somehow manage to get it working with v1.0, there's a
> good chance that it won't work anymore with v1.1.
> 
> So if you want to access "Shared/spamrep" as a mailbox, the prefix must
> be Shared/.

OK, I'll do mail delivery to some subfolder like "Shared/spamrep/INCOMING".
If I don't put any mails directly in "Shared/spamrep", my setup is OK,
isn't it?

> If you wanted users to have different views of what the mailboxes look
> like, you could just change the location to be different for different
> users. Create symlinks to the visible global mailboxes to those
> locations.

I'd like to automatically show shared folders to my users based on group
permissions to avoid having to manage symlinks for every user. Using a
post-login script, this setup works just fine, so I'll try to stick to
the current setup.

Thanks,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria



Re: [Dovecot] namespaces, shared mailboxes

2007-12-02 Thread Alexander &#x27;Leo'; Bergolth
On 12/02/2007 09:41 AM, Nikolay Shopik wrote:
> On 02.12.2007 1:59, Alexander 'Leo' Bergolth wrote:
>> I'd like to provide shared mailboxes with maildir that should appear
>> like 'Shared/' to the clients.
>>
>> Using the namespace configuration below, everything works fine, exept
>> one thing: Mail clients (only tested with Thunderbird) won't allow to
>> put mails directly in 'Shared/mailboxname' (the folder it is greyed
>> out). You currently have to create subfolders and put the mails in those
>> subfolders.
> [...]
> Because AFAIK you can't create messages in prefix folder. Make your
> prefix less longer like
> prefix = Shared/

The problem with this solution is that there are shared folders for
different groups in Shared and dovecot will return an internal error
when trying to list a mailbox for which the user doesn't have read
permissions. See this thread for details:
  http://thread.gmane.org/gmane.mail.imap.dovecot/23528

That's why I had to write a post-login script that dynamically adds only
those directories as seperate namespaces to which the current user has
read-access.

Btw. I found out that if I create an empty directory
"Shared//.INBOX/", Mails in "Shared/" (not
those in ".INBOX") are shown as a subfolder named INBOX in the client.
(Mails in "Shared//.INBOX" are ignored.) Maybe there is a
way to persuade the client to show those INBOX-Mails directly in
"Shared/"?

Cheers,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria



[Dovecot] namespaces, shared mailboxes

2007-12-01 Thread Alexander &#x27;Leo'; Bergolth
Hi!

I'd like to provide shared mailboxes with maildir that should appear
like 'Shared/' to the clients.

Using the namespace configuration below, everything works fine, exept
one thing: Mail clients (only tested with Thunderbird) won't allow to
put mails directly in 'Shared/mailboxname' (the folder it is greyed
out). You currently have to create subfolders and put the mails in those
subfolders.

Is there any workaround for this problem?

 8< 
namespace private {
  separator = /
  inbox = yes
  prefix =
  location = mbox:~/mail:INBOX=/var/mail/%u
}

namespace shared {
  separator = /
  # hidden = yes
  prefix = Shared/spamrep/
  location =
maildir:/var/spool/mail/Shared/spamrep:CONTROL=~/Maildir/control/Shared/spamrep:INDEX=~/Mail\
dir/index/Shared/spamrep
}
 8< 

I'm using dovecot 1.0.8.

"Server supports folders that contain subfolders and messages" is
enabled in Thunderbird's advanced server settings.

Thanks in advance,
--leo
-- 
e-mail   ::: Alexander.Bergolth (at) wu-wien.ac.at
fax  ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria