I got the solution! At least, after many hours of trials and debugging!
very simple, but how difficult to resolve:
in Yunohost dovecot configuration (for example: in /etc/dovecot/yunohost.d/post-ext.conf ) just add :
auth_cache_size = 10M
For those who will encounter the same kind of problems:
It is possible to add debug messages to dovecot and postfix using:
and
For my side, i used the debug parameters in dovecot:
log_debug = (category=auth) OR (category=smtp)
Then i could analyse the log file with the command:
sudo tail -f /var/log/mail.log
Here is how SMTP works:
- first your mail client connects to Postfix
- in /etc/postfix/main.cf, we can see that dovecot is used by Postfix to authenticate the user (with
smtpd_sasl_type = dovecotparameter) - so Postfix sends a connexion request to Dovecot
- Then dovecot goes through LDAP to authenticate the user
In my case, the time to authenticate was about 14 seconds. Postfix can not wait more than 10 seconds, and this delay can not be tuned ! There is no such parameter in Postfix config file. I tried a lot, but no one works!
But Dovecot proposes some guidelines to tune performance, and especially for CPU
There is the solution !
I hope these explanations will help !