[Dovecot] how to "hide" mailbox from the IMAP clients
Hello, everyone!
Is it possible to "hide" mailbox from the IMAP clients, so as to prevent any user from subscribing to the some folders?
My storages are "mbox maildir".
For example, to hide the directory where the personal Sieve scripts are stored or etc.
=kostik
On Ter, 06 Out 2009, Kostik wrote:
Hello, everyone!
Is it possible to "hide" mailbox from the IMAP clients, so as to prevent any user from subscribing to the some folders?
My storages are "mbox maildir".
For example, to hide the directory where the personal Sieve scripts are stored or etc.
I think you're approaching the problem from a wrong perspective. You
should not "hide" non-mail folders from clients, but you should "hide"
them from the server. If it's not a mail folder, Dovecot should not
treat it as one.
How to do that depends on your settings, but basically you should not
include the folder with scripts inside the folder with the mailboxes,
but instead store it elsewhere.
-- Eduardo M KALINOWSKI eduardo@kalinowski.com.br
Eduardo M KALINOWSKI wrote:
On Ter, 06 Out 2009, Kostik wrote:
Hello, everyone!
Is it possible to "hide" mailbox from the IMAP clients, so as to prevent any user from subscribing to the some folders?
My storages are "mbox maildir".
For example, to hide the directory where the personal Sieve scripts are stored or etc.
I think you're approaching the problem from a wrong perspective. You should not "hide" non-mail folders from clients, but you should "hide" them from the server. If it's not a mail folder, Dovecot should not treat it as one.
How to do that depends on your settings, but basically you should not include the folder with scripts inside the folder with the mailboxes, but instead store it elsewhere.
Yes, you're right! For legacy reasons, my clients have their mailboxes directly in their homedir. That not problem, because they have only imap access to that server. But I am interested to hide some "non-mail" folders.
mailbox_location re-design is not possible right now. :(
=kostik
On Tue, 2009-10-06 at 18:58 +0400, Kostik wrote:
Yes, you're right! For legacy reasons, my clients have their mailboxes directly in their homedir. That not problem, because they have only imap access to that server. But I am interested to hide some "non-mail" folders.
mailbox_location re-design is not possible right now. :(
How about redesign for the Sieve script location? You could use for example:
sieve_dir = /var/sieve/%u/scripts/ sieve = /var/sieve/%u/active
or something. Anyway, are you using mbox or maildir? With maildir you could also do something else, but with mbox there's really no way to hide files.
Timo Sirainen wrote:
On Tue, 2009-10-06 at 18:58 +0400, Kostik wrote: How about redesign for the Sieve script location? You could use for example:
sieve_dir = /var/sieve/%u/scripts/ sieve = /var/sieve/%u/active
or something. Anyway, are you using mbox or maildir? With maildir you could also do something else, but with mbox there's really no way to hide files.
Changing sieve script location is not convenient in my environment. We are using mbox, most of all. I'll start to think about changing mail location.
Thank you!
=kostik
Hi to everyone.
Timo,
With dovecot-1.2.6 "multiple quota roots" complains: "stat((null)) failed: Bad address" to log file.
My setup is:
plugin { quota = dirsize:dirsize quota quota2 = fs:fs quota:group }
Complains from (plugins/quota/quota-fs.c):
if (stat(root->storage_mount_path, &rst) < 0) { if (_root->quota->set->debug) { i_error("stat(%s) failed: %m", root->storage_mount_path); } return FALSE; }
root->storage_mount_path is NULL here.
But "single quota" setup (dirsize or fs) works fine.
Full log (multiple quota):
Quota root: name=dirsize quota backend=dirsize args= Quota rule: root=dirsize quota mailbox=* bytes=48234496 messages=0 Quota root: name=fs quota backend=fs args=group mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc fs quota add storage dir = /var/virtual/home/I/I/koc fs quota block device = nfsf:/export fs quota mount point = /mount/m6 stat((null)) failed: Bad address stat((null)) failed: Bad address stat((null)) failed: Bad address ...
Full log (single fs quota):
Quota root: name=fs quota backend=fs args=group Quota rule: root=fs quota mailbox=* bytes=48234496 messages=0 mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc fs quota add storage dir = /var/virtual/home/I/I/koc fs quota block device = nfsf:/export fs quota mount point = /mount/m6 quota-fs: host=nfsf, path=/export, gid=52304385, bytes quota-fs: gid=52304385, value=48660480, limit=52428800, active=1
=kostik
Hello.
Actually it is a problem for me.
Introduction: If dovecot LDA save failed to mbox (not enough disk space, for example), it does not do rollback. Then my mailbox was corrupted. Last message is dropped in the middle of headers(body, attachments, etc).
Same if I use file system quota, but does not set "quota plugin" for LDA. If user receives message which is over quota: save failed, no rollback, mbox corrupted. But if I set "quota plugin" for LDA, then LDA works fine.
In my case, this problem occurs when: -- use file system quota -- and set "quota plugin" for LDA -- and set "multiple quota roots": dirsize + fs -- and mail dir size less than all user files (if user have mail and some other files on it home dir).
If user receives message which is over FS quota but under dirsize quota, then "dirsize quota plugin" say: "OK". But "fs quota plugin" say: "stat((null)) failed: Bad address". And LDA tries to deliver message to mbox: save failed, no rollback, mbox corrupted.
Timo or anybody! Please! Help me! :)
=kostik
With dovecot-1.2.6 "multiple quota roots" complains: "stat((null)) failed: Bad address" to log file.
My setup is:
plugin { quota = dirsize:dirsize quota quota2 = fs:fs quota:group }
Complains from (plugins/quota/quota-fs.c):
if (stat(root->>storage_mount_path, &rst) < 0) { if (_root->quota->set->debug) { i_error("stat(%s) failed: %m", root->storage_mount_path); } return FALSE; }
root->>storage_mount_path is NULL here.
But "single quota" setup (dirsize or fs) works fine.
Full log (multiple quota):
Quota root: name=dirsize quota backend=dirsize args= Quota rule: root=dirsize quota mailbox=* bytes=48234496 messages=0 Quota root: name=fs quota backend=fs args=group mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc fs quota add storage dir = /var/virtual/home/I/I/koc fs quota block device = nfsf:/export fs quota mount point = /mount/m6 stat((null)) failed: Bad address stat((null)) failed: Bad address stat((null)) failed: Bad address ...
Full log (single fs quota):
Quota root: name=fs quota backend=fs args=group Quota rule: root=fs quota mailbox=* bytes=48234496 messages=0 mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc fs quota add storage dir = /var/virtual/home/I/I/koc fs quota block device = nfsf:/export fs quota mount point = /mount/m6 quota-fs: host=nfsf, path=/export, gid=52304385, bytes quota-fs: gid=52304385, value=48660480, limit=52428800, active=1
On Tue, 2009-10-13 at 23:00 +0400, Kostik wrote:
Hello.
Actually it is a problem for me.
Introduction: If dovecot LDA save failed to mbox (not enough disk space, for example), it does not do rollback. Then my mailbox was corrupted. Last message is dropped in the middle of headers(body, attachments, etc).
That shouldn't be happening, even if you're not using quota plugin at all. What does Dovecot log in that situation?
If user receives message which is over FS quota but under dirsize quota, then "dirsize quota plugin" say: "OK". But "fs quota plugin" say: "stat((null)) failed: Bad address". And LDA tries to deliver message to mbox: save failed, no rollback, mbox corrupted.
The stat((null)) should be fixed by this: http://hg.dovecot.org/dovecot-2.0/rev/14eeed133d57
On Thu, 2009-10-15 at 13:56 -0400, Timo Sirainen wrote:
On Tue, 2009-10-13 at 23:00 +0400, Kostik wrote:
Hello.
Actually it is a problem for me.
Introduction: If dovecot LDA save failed to mbox (not enough disk space, for example), it does not do rollback. Then my mailbox was corrupted. Last message is dropped in the middle of headers(body, attachments, etc).
That shouldn't be happening, even if you're not using quota plugin at all. What does Dovecot log in that situation?
Or what does your MTA log? Does it say deliver crashed? Because that's the only reason I can think of that it would leave the mbox corrupted. Post your dovecot -n output also?
Timo Sirainen wrote:
Introduction: If dovecot LDA save failed to mbox (not enough disk space, for example), it does not do rollback. Then my mailbox was corrupted. Last message is dropped in the middle of headers(body, attachments, etc).
That shouldn't be happening, even if you're not using quota plugin at all. What does Dovecot log in that situation?
I'm sorry, but this happens if I do not use quota plugin for LDA. :(
My environment is: -- OS: Linux 2.6.30 i686 Slackware 11.0.0 -- dovecot 1.2.6 (with 2 patchs: stat((null)) + istream-seekable) -- user inbox(mbox) and homedir(with mbox) locate at NFS (OS: Linux 2.6.18.7 i686 Slackware 11.0.0) -- NFS has file system group quota
Test user is over quoted:
Disk quotas for group #5751796 (gid 5751796): Filesystem blocks quota limit nfse:/export 23768* 10240 10240
dovecot -n
# 1.2.6: /usr/local/etc/dovecot.conf # OS: Linux 2.6.30 i686 Slackware 11.0.0 base_dir: /var/run/dovecot/
[ skip listen and ssl_* conf params ]
mmap_disable: yes mail_nfs_storage: yes mail_nfs_index: yes mbox_write_locks: dotlock_try fcntl
mail_plugins(default): quota imap_quota mail_plugins(imap): quota imap_quota mail_plugins(pop3): quota
lda: mail_plugins: quota quota_full_tempfail: no sendmail_path: /usr/lib/sendmail rejection_subject: Rejected: %s rejection_reason: Your message to <%t> was automatically rejected:%n%r auth_socket_path: /var/run/dovecot/auth-master auth default: mechanisms: plain login passdb: driver: sql userdb: driver: prefetch userdb: driver: sql socket: type: listen master: path: /var/run/dovecot/auth-master mode: 384 plugin: quota: dirsize:Quota quota2: fs:Quota:group
If I change only one string (disable LDA quota): "lda: mail_plugins: quota", my inbox starts corrupt.
- LDA with quota plugin log:
$ echo "123123123" | /usr/local/libexec/dovecot/deliver -d koc
Quota root: name=Quota backend=dirsize args= Quota rule: root=Quota mailbox=* bytes=10383360 messages=0 Quota root: name=Quota backend=fs args=group Quota rule: root=Quota mailbox=* bytes=10383360 messages=0 mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc fs quota add storage dir = /var/virtual/home/I/I/koc fs quota block device = nfse:/export fs quota mount point = /mount/m5 quota-fs: host=nfse, path=/export, gid=5751796, bytes quota-fs: gid=5751796, value=24338432, limit=10485760, active=1 from=<>, msgid=: save failed to INBOX: Quota exceeded (mailbox for user is full) from=<>, msgid=: rejected: Quota exceeded (mailbox for user is full) msgid=: Return-Path missing, rejection reason: Quota exceeded (mailbox for user is full)
- LDA without quota plugin:
$ echo "123123123" | /usr/local/libexec/dovecot/deliver -d koc
mbox: data=~/:INBOX=/var/virtual/mail/I/I/koc:INDEX=MEMORY fs: root=/var/virtual/home/I/I/koc, index=, control=, inbox=/var/virtual/mail/I/I/koc close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded from=<>, msgid=: saved mail to INBOX
My INBOX before delivery: -rw------- 1 5751796 5751796 4087 2009-10-16 17:24 koc after: -rw------- 1 5751796 5751796 4096 2009-10-16 17:25 koc (look at size, now it 8*512k blocks)
If INBOX is zero size, than deliver say same: "lock failed, saved mail to INBOX", but INBOX size still zero. If INBOX is 1 byte size, than deliver say same, but message writes to INBOX to full 512k block.
Or what does your MTA log? Does it say deliver crashed? Because that's the only reason I can think of that it would leave the mbox corrupted. Post your dovecot -n output also?
MTA log is: stat=ok3: saved mail to INBOX. Deliver not crash. I can make strace if it helps.
The stat((null)) should be fixed by this: http://hg.dovecot.org/dovecot-2.0/rev/14eeed133d57
I backport it to dovecot-1.2 and "stat((null))" fixed now! Thanx again, Timo!
=kostik
On Fri, 2009-10-16 at 18:06 +0400, Kostik wrote:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
Oh, it fails too late. Does this help? http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
Hi!
TS> On Fri, 2009-10-16 at 18:06 +0400, Kostik wrote:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
TS> Oh, it fails too late. Does this help? TS> http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
It helped, but only half:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded from=<>, msgid=: save failed to INBOX: Not enough disk space from=<>, msgid=: rejected: Not enough disk space msgid=: Return-Path missing, rejection reason: Not enough disk space
LDA return delivery error now, but inbox does not rolled back anyway.
=kostik
On Fri, 2009-10-16 at 22:16 +0400, Kostik wrote:
TS> Oh, it fails too late. Does this help? TS> http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
It helped, but only half:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
This was again the only error? It's still failing too late. It should be failing in fdatasync() earlier. What does it log with attached patch?
TS> On Fri, 2009-10-16 at 22:16 +0400, Kostik wrote:
TS> Oh, it fails too late. Does this help? TS> http://hg.dovecot.org/dovecot-1.2/rev/ebb44fb7d9de
It helped, but only half:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
TS> This was again the only error? It's still failing too late. It should be TS> failing in fdatasync() earlier. What does it log with attached patch?
Yes, this is full debug log. Log after patch:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded fdatasync() succeeded from=<>, msgid=: saved mail to INBOX
TS> On Fri, 2009-10-16 at 22:41 +0400, Kostik wrote:
close(/var/virtual/mail/I/I/koc.lock) failed: Disk quota exceeded
TS> Oh, I didn't read carefully enough. Closing .lock failed, not mbox. Does TS> the attached patch help?
No. Error on closing .lock disappeared, but mbox does not rollback. And LDA now return "saved" instead "rejected".
Oct 16 23:03:49 dovecot: deliver(koc): from=<>, msgid=: saved mail to INBOX
Strace:
open("/var/virtual/mail/I/I/koc.lock", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0666) = 7 write(7, "13772:pigeon01", 14) = 14 fdatasync(7) = -1 EDQUOT (Disk quota exceeded) ftruncate64(7, 0) = 0 fstat64(7, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 close(7) = 0 lstat64("/var/virtual/mail/I/I/koc.lock", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 open("/var/virtual/mail/I/I/koc", O_RDWR|O_LARGEFILE) = 7 fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0 time(NULL) = 1255719829 alarm(5) = 0 fcntl64(7, F_SETLKW64, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}, 0xbfd78390) = 0 alarm(0) = 5 stat64("/var/virtual/mail/I/I/koc", {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0 fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0 _llseek(7, 4086, [4086], SEEK_SET) = 0 read(7, "\n", 1) = 1 fstat64(7, {st_mode=S_IFREG|0600, st_size=4087, ...}) = 0 brk(0x8151000) = 0x8151000 write(7, "From MAILER-DAEMON Fri Oct 16 2"..., 168) = 168 pwrite64(7, "\nContent-Length: 0", 18, 4235) = 18 fstat64(7, {st_mode=S_IFREG|0600, st_size=4255, ...}) = 0 fdatasync(7) = 0 write(7, "\n", 1) = 1 brk(0x8149000) = 0x8149000 lstat64("/var/virtual/mail/I/I/koc.lock", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0 unlink("/var/virtual/mail/I/I/koc.lock") = 0 fcntl64(7, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}, 0xbfd784c0) = 0 alarm(0) = 0 time([1255719829]) = 1255719829 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0 send(6, "<22>Oct 16 23:03:49 dovecot: del"..., 88, MSG_NOSIGNAL) = 88 close(7) = -1 EDQUOT (Disk quota exceeded)
=kostik
On Fri, 2009-10-16 at 23:23 +0400, Kostik wrote:
OK, so two problems:
write(7, "From MAILER-DAEMON Fri Oct 16 2"..., 168) = 168 pwrite64(7, "\nContent-Length: 0", 18, 4235) = 18
It's writing a zero byte mail. Was the incoming mail really zero bytes, or is there something that truncates it?
fstat64(7, {st_mode=S_IFREG|0600, st_size=4255, ...}) = 0 fdatasync(7) = 0 write(7, "\n", 1) = 1
write() happened after fdatasync(), that causes this to fail:
close(7) = -1 EDQUOT (Disk quota exceeded)
So this later problem should be fixed by: http://hg.dovecot.org/dovecot-1.2/rev/b5e6de777e52
TS> OK, so two problems:
write(7, "From MAILER-DAEMON Fri Oct 16 2"..., 168) = 168 pwrite64(7, "\nContent-Length: 0", 18, 4235) = 18
TS> It's writing a zero byte mail. Was the incoming mail really zero bytes, TS> or is there something that truncates it?
No, it's not a problem. This is a really zero bytes message: $ echo "123123123" | strace /usr/local/libexec/dovecot/deliver -d koc
fstat64(7, {st_mode=S_IFREG|0600, st_size=4255, ...}) = 0 fdatasync(7) = 0 write(7, "\n", 1) = 1
TS> write() happened after fdatasync(), that causes this to fail:
close(7) = -1 EDQUOT (Disk quota exceeded)
TS> So this later problem should be fixed by: TS> http://hg.dovecot.org/dovecot-1.2/rev/b5e6de777e52
Yabba-Dabba Do! :) Yes, this patch solves the problem: "rejected: Not enough disk space". And inbox is rollbacked now.
Timo, many thanks for all your help!
=kostik
Hello.
I fix this issue by manually set "mount" option to user home:
quota2 = fs:fs quota:group:mount=%h
From here: http://wiki.dovecot.org/Quota/FS
mount=<path>: Report quota from given path. Default is to use the path for the mail root directory.
But by default it is NULL.
=kostik
Kostik wrote:
Hi to everyone.
Timo,
With dovecot-1.2.6 "multiple quota roots" complains: "stat((null)) failed: Bad address" to log file.
My setup is:
plugin { quota = dirsize:dirsize quota quota2 = fs:fs quota:group }
Complains from (plugins/quota/quota-fs.c):
if (stat(root->storage_mount_path, &rst) < 0) { if (_root->quota->set->debug) { i_error("stat(%s) failed: %m", root->storage_mount_path); } return FALSE; }
root->storage_mount_path is NULL here.
Am 06.10.2009 um 16:27 schrieb Kostik:
For example, to hide the directory where the personal Sieve scripts
are stored or etc.
With recent versions the sieve scripts are stored in the home
directory per default, rather than the maildir itself. You may wan't
to verify this parameter:
sieve = ~/.dovecot.sieve
Regards Thomas
participants (4)
-
Eduardo M KALINOWSKI
-
Kostik
-
Thomas Leuxner
-
Timo Sirainen