Very slow mail download/notification with dovecot 2.3.7 and Thunderbird​

2020-12-27 Thread ml_dovecot
Hi!

I know that there are many results if I search for "dovecot thunderbird
very slow" on Google but none of them helped me with my problem. :(  (I
already posted this on February 2020, but forgot to answer. O.o)

I am running Ubuntu 20.04 (4GB RAM, 40GB HDD with EXT4) server with the
following software:

- Dovecot 2.3.7.2
 All accounts are using Maildir
 Sieve filters

- Postfix 3.4.13
 with opendkim, spamassassin, razor, pyzor, 

And as IMAP client I am using Thunderbird 78.6 on Windows 10.
Sieve is used to sort some incoming mails into my 228 folders (56 INBOX.
folders and its subfolders (output of "find .INBOX.* -maxdepth 4 -type d
-print |wc -l")).  The total size of my Maildir directory is 5.5GB.

My problem is that it always takes very very long to synchronize the
INBOX and its subfolders. Even if there are only a few new messages to
be downloaded. Sometimes Thunderbird outputs something like "downloading
message 1 of 19" and it takes at least 60 seconds to download all of
them. None of these mails is larger than 5kB. And sometimes it seems
that the transfer is suspended for a long time and it takes >5 Minutes
to synchronize only a few mails. :(

And it seems that some folders are never updated in TB. In example I
sort all messages from this list into a "INBOX.Mailinglists.ML-Dovecot"
subfolder by using a simple sieve rule. But even after 10 minutes TB
thinks that there are no new messages. As soon as I click on the
ML-Dovecot folder I see in the /var/log/dovecot-info.log file that TB
logs on to the server and then displays hundreds, of new messages. I
checked twice but I have subscribed to all 228 folders.

How can I find the bottleneck?
Is there a test tool available that simulates a simple mail client and
can analyse an IMAP server?

This is the output of "dovecot -n":

===
# 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.7.2 ()
# OS: Linux 5.4.0-54-generic x86_64 Ubuntu 20.04.1 LTS
# Hostname: mail.XXX.de
auth_mechanisms = plain login
debug_log_path = /var/log/dovecot-debug.log
default_client_limit = 15653
default_process_limit = 5200
first_valid_uid = 150
info_log_path = /var/log/dovecot-info.log
last_valid_uid = 150
lda_original_recipient_header = X-Original-To
log_path = /var/log/dovecot-error.log
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k
mail_gid = mail
mail_home = /var/vmail/%d/%n
mail_location = maildir:~/Maildir
mail_uid = vmail
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 index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    special_use = \Archive
  }
  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 =
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  sieve = ~/.dovecot.sieve
  sieve_default = /var/vmail/global.sieve
  sieve_dir = ~/sieve
}
postmaster_address = thorsten@MY_DOMAIN.TLD
protocols = " imap sieve pop3"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    group = mail
    mode = 0666
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 143
  }
  inet_listener imaps {
    port = 993
    ssl = yes
  }
  process_limit = 50
  process_min_avail = 2
  service_count = 20
}
service imap {
  process_limit = 1024
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
  service_count = 0
}
ssl_cert =  was automatically rejected:%n%r
}
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep
  imap_idle_notify_interval = 10 mins
  mail_max_userip_connections = 100
  mail_plugins =
}
protocol sieve {
  info_log_path = /var/log/dovecot-sieve.log
  mail_max_userip_connections = 100
  managesieve_implementation_string = Dovecot Pigeonhole
  managesieve_max_line_length = 65536
===

Output of "free -h":
===
free -h
  total    used    free  shared  buff/cache  
available
Mem:  3.8Gi   1.7Gi   1.1Gi    10Mi  
958Mi   1.7Gi
Swap: 1.0Gi   375Mi   648Mi
===

Thank you very much!
Thorsten



.imap folders

2020-12-27 Thread Elise

My user account is located at /usr/home/elise and has a subfolder ./mail
In that folder I have some subfolders/subdirectories. What happens now 
is that dovecot creates all kind of .imap folders in these subfolders.

They are all exact mirrors of the base folder(s) the .imap is part of.

Can you tell me how I can prevent that dovecot creates these .imap 
folders other than in my home user folder /usr/home/elise and the

/usr/home/elise/mail folder?

/Elise



Re: Very slow mail download/notification with dovecot 2.3.7 and Thunderbird​

2020-12-27 Thread Juri Haberland
On 27/12/2020 15:11, ml_dove...@thorsten-reichelt.de wrote:

> And it seems that some folders are never updated in TB. In example I
> sort all messages from this list into a "INBOX.Mailinglists.ML-Dovecot"
> subfolder by using a simple sieve rule. But even after 10 minutes TB
> thinks that there are no new messages. As soon as I click on the
> ML-Dovecot folder I see in the /var/log/dovecot-info.log file that TB
> logs on to the server and then displays hundreds, of new messages. I
> checked twice but I have subscribed to all 228 folders.

I can't help you with your performance problem, but for Thunderbird to
check all folders, you need to set "mail.check_all_imap_folders_for_new"
to 'true' in the Thunderbird config editor.


Regards,
  Juri


Re: .imap folders

2020-12-27 Thread Aki Tuomi


> On 27/12/2020 17:10 Elise  wrote:
> 
> 
> My user account is located at /usr/home/elise and has a subfolder ./mail
>  In that folder I have some subfolders/subdirectories. What happens now is 
> that dovecot creates all kind of .imap folders in these subfolders.
>  They are all exact mirrors of the base folder(s) the .imap is part of.
>  
>  Can you tell me how I can prevent that dovecot creates these .imap folders 
> other than in my home user folder /usr/home/elise and the
>  /usr/home/elise/mail folder?
>  
>  /Elise
>  
>

The .imap directories contain indexes for dovecot. If you want to put them 
elsewhere, try adding :INDEX=/somewhere/else/%u to your mail location. 

Aki


Re: BUG REPORT: MAIL-CRYPT plugin: doveadm mailbox cryptokey -O option

2020-12-27 Thread Aki Tuomi


> On 26/12/2020 10:41 ean365  wrote:
> 
> 
> Aki:
>  
>  I have identified a bug in the "-O" option of "doveadm mailbox cryptokey 
> password" plugin command -- it is expecting an argument, but it is supposed 
> to be a boolean option. I have also identified the (simple) fix to the source 
> on github...
>  
>  I am a dovecot community noob, so please forgive me if this has already been 
> identified... (if so, I hope it gets fixed soon)...
> 
>  The "-O" option in struct doveadm_cmd_mcp_key_password is set to expect a 
> STR parameter, but it should be BOOL. See line 1027 in 
> plugins/mail-crypt/doveadm-mail-crypt.c of master branch...
>  
>  Currently:
>  DOVEADM_CMD_PARAM('O',"ask-old-password", CMD_PARAM_STR,0)
>  
> Should be:
>  DOVEADM_CMD_PARAM('O',"ask-old-password", CMD_PARAM_BOOL,0)
>  
>  Workaround is to specify -O last on command line with a dummy argument, like 
> this:
>  doveadm mailbox cryptokey password -N -O ""
>  
>  Also, a quick question and suggestion -- Why does the doveadm mailbox 
> cryptokey password command not ask for a new password twice, with a check 
> that both entries must match before the password is changed? The last thing 
> we would want is to type something wrong accidentally, and change the new 
> password to something unknown -- rendering encrypted email unrecoverable. I 
> would like to suggest that the code in cmd_mcp_key_password_run be amended to 
> include verifying password entry twice.
>  
>  (I am writing a simple addition to postfixadmin that changes the user's 
> mail-crypt password whenever they use postfixadmin to change their login 
> password. It calls doveadm to change the keys. I came across this bug while 
> working through this.)
>  
>  Thanks for all your help!
>  Eric
>

Thank you for reporting this, we'll take a look.

Aki


LDA ignores virtual mailbox settings

2020-12-27 Thread Toni Mueller


Hi,

I have a Debian/Buster system with Postfix and Dovecot from the Debian
repo, and with virtual users only (ie, no system users). These virtual
users are having all of their uids, gids, homes and mail quota in an
PostgreSQL database. The intent is to have postfix deliver the email via
dovecot's LDA, so I can set quota on a per-user basis.

But for some odd reason, Dovecot's LDA can't find the user data from the
userdb, and then complains about not being able to write to /var/mail.
The following example shows how things fail when delivering a message
from Postfix's queue (therefore, the passdb failure is expected):

In /etc/dovecot.conf, I have this, amongst other things:


mail_location = maildir:~/Maildir:INBOX=~/Maildir
passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}
userdb {
  driver = prefetch
}
userdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}
protocol lda {
  mail_plugins = autocreate quota mail_log trash virtual notify
}




16:04:16 postfix/qmgr[4970]: 8CD6CE072E: from=, size=880, 
nrcpt=1 (queue active)
16:04:16 dovecot: auth: Debug: master in: 
USER#0111#011u...@example.com#011service=lda
16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb didn't return 
userdb entries, trying the next userdb
16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
'/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota as 
quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND status = 'A'
16:04:16 dovecot: auth: Debug: userdb out: 
USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0

^^

This shows that the database lookup works. The intended effect should be
that the message is delivered to

/path-to-mailboxen/example.com/user/Maidir/new


16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
setegid(privileged) failed: Operation not permitted
16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
Mailbox INBOX: open(/var/mail/u...@example.com) failed: Permission denied 
(euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're not 
in group 8(mail), dir owned by 0:8 mode=0775)

^^

And this shows that dovecot-lda just ignores the result.


16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
open(/var/mail/u...@example.com) failed: Permission denied (euid=12345(mailbox) 
egid=12345(mailbox) missing +w perm: /var/mail, we're not in group 8(mail), dir 
owned by 0:8 mode=0775)
16:04:16 dovecot: lda(u...@example.com)<5291>: 
msgid=<20201226224933.014...@laptop.example.com>: save failed to open mailbox 
INBOX: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
open(/var/mail/u...@example.com) failed: Permission denied (euid=12345(mailbox) 
egid=12345(mailbox) missing +w perm: /var/mail, we're not in group 8(mail), dir 
owned by 0:8 mode=0775)
16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
orig_to=, relay=dovecot, delay=62083, 
delays=62083/0.04/0/0.04, dsn=4.3.0, status=deferred (temporary failure)


In /etc/postfix/master.cf, I have this to call it:

dovecot   unix  -   n   n   -   -   pipe
  flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} -d 
${user}@${domain} -a ${recipient}


I've tried strace-ing dovecot-lda, but it didn't really help me to
understand why it discards the result of the userdb lookup.


Can anyone please provide a cluebat, please?



Thanks,
Toni



Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Aki Tuomi


> On 27/12/2020 18:19 Toni Mueller  wrote:
> 
>  
> Hi,
> 
> I have a Debian/Buster system with Postfix and Dovecot from the Debian
> repo, and with virtual users only (ie, no system users). These virtual
> users are having all of their uids, gids, homes and mail quota in an
> PostgreSQL database. The intent is to have postfix deliver the email via
> dovecot's LDA, so I can set quota on a per-user basis.
> 
> But for some odd reason, Dovecot's LDA can't find the user data from the
> userdb, and then complains about not being able to write to /var/mail.
> The following example shows how things fail when delivering a message
> from Postfix's queue (therefore, the passdb failure is expected):
> 
> In /etc/dovecot.conf, I have this, amongst other things:
> 
> 
> mail_location = maildir:~/Maildir:INBOX=~/Maildir
> passdb {
>   driver = sql
>   args = /etc/dovecot/dovecot-sql.conf.ext
> }
> userdb {
>   driver = prefetch
> }
> userdb {
>   driver = sql
>   args = /etc/dovecot/dovecot-sql.conf.ext
> }
> protocol lda {
>   mail_plugins = autocreate quota mail_log trash virtual notify
> }
> 
> 
> 
> 
> 16:04:16 postfix/qmgr[4970]: 8CD6CE072E: from=, size=880, 
> nrcpt=1 (queue active)
> 16:04:16 dovecot: auth: Debug: master in: 
> USER#0111#011u...@example.com#011service=lda
> 16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb didn't 
> return userdb entries, trying the next userdb
> 16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
> '/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota as 
> quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND status = 
> 'A'
> 16:04:16 dovecot: auth: Debug: userdb out: 
> USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0
> 
> ^^
> 
> This shows that the database lookup works. The intended effect should be
> that the message is delivered to
> 
> /path-to-mailboxen/example.com/user/Maidir/new
> 
> 
> 16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
> setegid(privileged) failed: Operation not permitted
> 16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
> Mailbox INBOX: open(/var/mail/u...@example.com) failed: Permission denied 
> (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're 
> not in group 8(mail), dir owned by 0:8 mode=0775)
> 
> ^^
> 
> And this shows that dovecot-lda just ignores the result.
> 
> 
> 16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
> Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> open(/var/mail/u...@example.com) failed: Permission denied 
> (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're 
> not in group 8(mail), dir owned by 0:8 mode=0775)
> 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> msgid=<20201226224933.014...@laptop.example.com>: save failed to open mailbox 
> INBOX: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> open(/var/mail/u...@example.com) failed: Permission denied 
> (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're 
> not in group 8(mail), dir owned by 0:8 mode=0775)
> 16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
> orig_to=, relay=dovecot, delay=62083, 
> delays=62083/0.04/0/0.04, dsn=4.3.0, status=deferred (temporary failure)
> 
> 
> In /etc/postfix/master.cf, I have this to call it:
> 
> dovecot   unix  -   n   n   -   -   pipe
>   flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} -d 
> ${user}@${domain} -a ${recipient}
> 
> 
> I've tried strace-ing dovecot-lda, but it didn't really help me to
> understand why it discards the result of the userdb lookup.
> 
> 
> Can anyone please provide a cluebat, please?
> 
> 
> 
> Thanks,
> Toni

Try adding

mail_privileged_group = mail

to your dovecot.conf. See 
https://doc.dovecot.org/settings/core/#mail-privileged-group

Aki


Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Toni Mueller


Hi Aki,

On Sun, Dec 27, 2020 at 09:18:25PM +0200, Aki Tuomi wrote:
> > On 27/12/2020 18:19 Toni Mueller  wrote:
> > 
> > 16:04:16 postfix/qmgr[4970]: 8CD6CE072E: from=, size=880, 
> > nrcpt=1 (queue active)
> > 16:04:16 dovecot: auth: Debug: master in: 
> > USER#0111#011u...@example.com#011service=lda
> > 16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb didn't 
> > return userdb entries, trying the next userdb
> > 16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
> > '/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota as 
> > quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND status = 
> > 'A'
> > 16:04:16 dovecot: auth: Debug: userdb out: 
> > USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0
> > 
> > ^^
> > 
> > This shows that the database lookup works. The intended effect should be
> > that the message is delivered to
> > 
> > /path-to-mailboxen/example.com/user/Maidir/new
> > 
> > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > Error: setegid(privileged) failed: Operation not permitted
> > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > Error: Mailbox INBOX: open(/var/mail/u...@example.com) failed: Permission 
> > denied (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
> > we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > 
> > ^^
> > 
> > And this shows that dovecot-lda just ignores the result.
> > 
> > 
> > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > Error: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> > open(/var/mail/u...@example.com) failed: Permission denied 
> > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're 
> > not in group 8(mail), dir owned by 0:8 mode=0775)
> > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > msgid=<20201226224933.014...@laptop.example.com>: save failed to open 
> > mailbox INBOX: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> > open(/var/mail/u...@example.com) failed: Permission denied 
> > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're 
> > not in group 8(mail), dir owned by 0:8 mode=0775)
> > 16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
> > orig_to=, relay=dovecot, delay=62083, 
> > delays=62083/0.04/0/0.04, dsn=4.3.0, status=deferred (temporary failure)
> > 
> > 
> > In /etc/postfix/master.cf, I have this to call it:
> > 
> > dovecot   unix  -   n   n   -   -   pipe
> >   flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} -d 
> > ${user}@${domain} -a ${recipient}
> > 
> Try adding
> 
> mail_privileged_group = mail

I am not sure why you recommend this. I never ever want to deliver to
/var/mail, and my mailbox directory has group 'mailbox' - hence I have

mail_privileged_group = mailbox

in my configuration.

My question is why this thing wants to deliver to /var/mail, despite
having a different location from the userdb, and how I can force it to
use the location from the userdb.


Thanks,
Toni



Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Aki Tuomi


> On 27/12/2020 21:54 Toni Mueller  wrote:
> 
>  
> Hi Aki,
> 
> On Sun, Dec 27, 2020 at 09:18:25PM +0200, Aki Tuomi wrote:
> > > On 27/12/2020 18:19 Toni Mueller  wrote:
> > > 
> > > 16:04:16 postfix/qmgr[4970]: 8CD6CE072E: from=, 
> > > size=880, nrcpt=1 (queue active)
> > > 16:04:16 dovecot: auth: Debug: master in: 
> > > USER#0111#011u...@example.com#011service=lda
> > > 16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb didn't 
> > > return userdb entries, trying the next userdb
> > > 16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
> > > '/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota as 
> > > quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND status 
> > > = 'A'
> > > 16:04:16 dovecot: auth: Debug: userdb out: 
> > > USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0
> > > 
> > > ^^
> > > 
> > > This shows that the database lookup works. The intended effect should be
> > > that the message is delivered to
> > > 
> > > /path-to-mailboxen/example.com/user/Maidir/new
> > > 
> > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > Error: setegid(privileged) failed: Operation not permitted
> > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > Error: Mailbox INBOX: open(/var/mail/u...@example.com) failed: Permission 
> > > denied (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: 
> > > /var/mail, we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > 
> > > ^^
> > > 
> > > And this shows that dovecot-lda just ignores the result.
> > > 
> > > 
> > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > Error: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> > > open(/var/mail/u...@example.com) failed: Permission denied 
> > > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
> > > we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > msgid=<20201226224933.014...@laptop.example.com>: save failed to open 
> > > mailbox INBOX: Mailbox INBOX: Failed to autocreate mailbox: Mailbox 
> > > INBOX: open(/var/mail/u...@example.com) failed: Permission denied 
> > > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
> > > we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > 16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
> > > orig_to=, relay=dovecot, delay=62083, 
> > > delays=62083/0.04/0/0.04, dsn=4.3.0, status=deferred (temporary failure)
> > > 
> > > 
> > > In /etc/postfix/master.cf, I have this to call it:
> > > 
> > > dovecot   unix  -   n   n   -   -   pipe
> > >   flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} -d 
> > > ${user}@${domain} -a ${recipient}
> > > 
> > Try adding
> > 
> > mail_privileged_group = mail
> 
> I am not sure why you recommend this. I never ever want to deliver to
> /var/mail, and my mailbox directory has group 'mailbox' - hence I have
> 
> mail_privileged_group = mailbox
> 
> in my configuration.
> 
> My question is why this thing wants to deliver to /var/mail, despite
> having a different location from the userdb, and how I can force it to
> use the location from the userdb.
> 
> 
> Thanks,
> Toni

Sorry, I misread your problem.. 

can you try checking output of

`doveadm user `

and 

`doveadm auth lookup `

Also, including `doveconf -n` would be useful.

Aki


Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Toni Mueller


Hi,

On Sun, Dec 27, 2020 at 07:54:56PM +, Toni Mueller wrote:
> My question is why this thing wants to deliver to /var/mail, despite
> having a different location from the userdb, and how I can force it to
> use the location from the userdb.

I forgot to say that this thing has no trouble writing a file to roughly
the desired location, reading

/path-to-mailboxen/example.com/user/mail/.imap
/path-to-mailboxen/example.com/user/mail/.imap/dovecot.list.index.log

I've tried again by removing the entire user's directory, then saying
"postfix flush" to push the email, when the file above was re-created.

 
Thanks,
Toni


Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Toni Mueller


Hi Aki,

thanks for your quick response!

On Sun, Dec 27, 2020 at 10:00:40PM +0200, Aki Tuomi wrote:
> > On Sun, Dec 27, 2020 at 09:18:25PM +0200, Aki Tuomi wrote:
> > > > 16:04:16 dovecot: auth: Debug: master in: 
> > > > USER#0111#011u...@example.com#011service=lda
> > > > 16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb 
> > > > didn't return userdb entries, trying the next userdb
> > > > 16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
> > > > '/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota 
> > > > as quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND 
> > > > status = 'A'
> > > > 16:04:16 dovecot: auth: Debug: userdb out: 
> > > > USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0
> > > > 
> > > > ^^
> > > > 
> > > > This shows that the database lookup works. The intended effect should be
> > > > that the message is delivered to
> > > > 
> > > > /path-to-mailboxen/example.com/user/Maidir/new
> > > > 
> > > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > > Error: setegid(privileged) failed: Operation not permitted
> > > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > > Error: Mailbox INBOX: open(/var/mail/u...@example.com) failed: 
> > > > Permission denied (euid=12345(mailbox) egid=12345(mailbox) missing +w 
> > > > perm: /var/mail, we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > > 
> > > > ^^
> > > > 
> > > > And this shows that dovecot-lda just ignores the result.
> > > > 
> > > > 
> > > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > > Error: Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
> > > > open(/var/mail/u...@example.com) failed: Permission denied 
> > > > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
> > > > we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > > 16:04:16 dovecot: lda(u...@example.com)<5291>: 
> > > > msgid=<20201226224933.014...@laptop.example.com>: save failed to open 
> > > > mailbox INBOX: Mailbox INBOX: Failed to autocreate mailbox: Mailbox 
> > > > INBOX: open(/var/mail/u...@example.com) failed: Permission denied 
> > > > (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
> > > > we're not in group 8(mail), dir owned by 0:8 mode=0775)
> > > > 16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
> > > > orig_to=, relay=dovecot, delay=62083, 
> > > > delays=62083/0.04/0/0.04, dsn=4.3.0, status=deferred (temporary failure)
> > > > 
> > > > 
> > > > In /etc/postfix/master.cf, I have this to call it:
> > > > 
> > > > dovecot   unix  -   n   n   -   -   pipe
> > > >   flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} 
> > > > -d ${user}@${domain} -a ${recipient}
> > > > 
> > > Try adding
> > > 
> > > mail_privileged_group = mail
> > 
> > I am not sure why you recommend this. I never ever want to deliver to
> > /var/mail, and my mailbox directory has group 'mailbox' - hence I have
> > 
> > mail_privileged_group = mailbox
> > 
> > in my configuration.
> > 
> > My question is why this thing wants to deliver to /var/mail, despite
> > having a different location from the userdb, and how I can force it to
> > use the location from the userdb.
> > 
> > 
> > Thanks,
> > Toni
> 
> Sorry, I misread your problem.. 
> 
> can you try checking output of
> 
> `doveadm user `

# doveadm user u...@example.com
field   value
uid 12345
gid 12345
home/path-to-mailboxen/example.com/user
mailmaildir:~/Maildir:INBOX=~/Maildir
quota_rule  *:storage=0

> and 
> 
> `doveadm auth lookup `

# doveadm -v auth lookup u...@example.com
passdb: u...@example.com
  user  : u...@example.com

> Also, including `doveconf -n` would be useful.



# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-13-amd64 x86_64 Debian 10.7 
# Hostname: testvm.example.com
auth_debug = yes
auth_debug_passwords = yes
auth_failure_delay = 0
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
deliver_log_format = msgid=%m: %e -> %{to_envelope} %p %w %{delivery_time} 
%{storage_id} %{secured}
disable_plaintext_auth = no
login_access_sockets = tcpwrap
mail_debug = yes
mail_location = maildir:~/Maildir:INBOX=~/Maildir
mail_privileged_group = mailbox
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 index ihave duplicate 
mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location = maildir:~/Maildir:INBOX=~/Maildir
  mailbox Drafts {
special_use = \Drafts
  }
  mailbox Junk {
special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbo

Re: LDA ignores virtual mailbox settings

2020-12-27 Thread Tamsy



*From:* Toni Mueller [mailto:supp...@oeko.net]
*Sent:* Monday, December 28, 2020, 3:18 AM
*To:* Aki Tuomi
*Cc:* dovecot@dovecot.org
*Subject:* LDA ignores virtual mailbox settings


Hi Aki,

thanks for your quick response!

On Sun, Dec 27, 2020 at 10:00:40PM +0200, Aki Tuomi wrote:

On Sun, Dec 27, 2020 at 09:18:25PM +0200, Aki Tuomi wrote:

16:04:16 dovecot: auth: Debug: master 
in:USER#0111#011u...@example.com#011service=lda
16:04:16 dovecot: auth: Debug: prefetch(u...@example.com): passdb didn't return 
userdb entries, trying the next userdb
16:04:16 dovecot: auth: Debug: sql(u...@example.com): SELECT 
'/path-to-mailboxen/' || virtual_users.home AS home, uid , gid , quota as 
quota_rule FROM virtual_users WHERE email = 'u...@example.com' AND status = 'A'
16:04:16 dovecot: auth: Debug: userdb 
out:USER#0111#011u...@example.com#011home=/path-to-mailboxen/example.com/user#011uid=12345#011gid=12345#011quota_rule=*:storage=0

^^

This shows that the database lookup works. The intended effect should be
that the message is delivered to

/path-to-mailboxen/example.com/user/Maidir/new

16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
setegid(privileged) failed: Operation not permitted
16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
Mailbox INBOX: open(/var/mail/u...@example.com) failed: Permission denied 
(euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, we're not in group 
8(mail), dir owned by 0:8 mode=0775)

^^

And this shows that dovecot-lda just ignores the result.


16:04:16 dovecot: lda(u...@example.com)<5291>: Error: 
Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: 
open(/var/mail/u...@example.com) failed: Permission denied (euid=12345(mailbox) 
egid=12345(mailbox) missing +w perm: /var/mail, we're not in group 8(mail), dir owned by 
0:8 mode=0775)
16:04:16 dovecot: lda(u...@example.com)<5291>: 
msgid=<20201226224933.014...@laptop.example.com>: save failed to open mailbox INBOX: 
Mailbox INBOX: Failed to autocreate mailbox: Mailbox INBOX: open(/var/mail/u...@example.com) 
failed: Permission denied (euid=12345(mailbox) egid=12345(mailbox) missing +w perm: /var/mail, 
we're not in group 8(mail), dir owned by 0:8 mode=0775)
16:04:16 postfix/pipe[5284]: 8CD6CE072E: to=, 
orig_to=, relay=dovecot, delay=62083, delays=62083/0.04/0/0.04, 
dsn=4.3.0, status=deferred (temporary failure)


In /etc/postfix/master.cf, I have this to call it:

dovecot   unix  -   n   n   -   -   pipe
   flags=DRhu user=_mailbox argv=/usr/lib/dovecot/deliver -f ${sender} -d 
${user}@${domain} -a ${recipient}


Try adding

mail_privileged_group = mail

I am not sure why you recommend this. I never ever want to deliver to
/var/mail, and my mailbox directory has group 'mailbox' - hence I have

mail_privileged_group = mailbox

in my configuration.

My question is why this thing wants to deliver to /var/mail, despite
having a different location from the userdb, and how I can force it to
use the location from the userdb.


Thanks,
Toni

Sorry, I misread your problem..

can you try checking output of

`doveadm user `

# doveadm useru...@example.com
field   value
uid 12345
gid 12345
home/path-to-mailboxen/example.com/user
mailmaildir:~/Maildir:INBOX=~/Maildir
quota_rule  *:storage=0


and

`doveadm auth lookup `

# doveadm -v auth lookupu...@example.com
passdb:u...@example.com
   user  :u...@example.com


Also, including `doveconf -n` would be useful.

# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-13-amd64 x86_64 Debian 10.7
# Hostname: testvm.example.com
auth_debug = yes
auth_debug_passwords = yes
auth_failure_delay = 0
auth_mechanisms = plain login
auth_verbose = yes
auth_verbose_passwords = plain
deliver_log_format = msgid=%m: %e -> %{to_envelope} %p %w %{delivery_time} 
%{storage_id} %{secured}
disable_plaintext_auth = no
login_access_sockets = tcpwrap
mail_debug = yes
mail_location = maildir:~/Maildir:INBOX=~/Maildir
mail_privileged_group = mailbox
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 index ihave duplicate 
mime foreverypart extracttext
namespace inbox {
   inbox = yes
   location = maildir:~/Maildir:INBOX=~/Maildir
   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 =
}
passdb {
   args = /etc/dovecot/dovecot-sql.conf.ext
   driver = sql
}
plugin {
   expire = Trash 30 Spam 30
   quota = maildir
   quota_rule = *:storage=5
   quota_rule2 = Trash:ignore
   sieve