nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
819 stars 255 forks source link

LDAP users who haven't logged into web interface causes logging errors #9274

Open JRGonz opened 5 months ago

JRGonz commented 5 months ago

Steps to reproduce

  1. Connect Nextcloud to LDAP backend
  2. Provision e-mail server
  3. Users login to mobile apps
  4. Unless users login using desktop browser nextcloud spits out errors

Expected behavior

Logging into the mobile app should store passwords properly for provisioned e-mail server.

Actual behavior

LDAP users who have never logged into the web interface give the following error:

[accountId] => 82\n)\n)","userAgent":"--","version":"28.0.1.1","exception":{"Exception":"Horde_Imap_Client_Exception","Message":"Mail server denied authentication.","Code":102,"Trace":[{"file":"/var/www/cloud.domain.tld/apps/mail/lib/IMAP/ImapClientRateLimitingDecorator.php","line":73,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":[" sensitive parameters replaced "]},{"file":"/var/www/cloud.domain.tld/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"OCA\Mail\IMAP\ImapClientRateLimitingDecorator","type":"->","args":[" sensitive parameters replaced "]},{"file":"/var/www/cloud.domain.tld/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":1404,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":[" sensitive parameters replaced "]},{"file":"/var/www/cloud.domain.tld/apps/mail/lib/IMAP/FolderMapper .php","line":58,"function":"listMailboxes","class":"Horde_Imap_Client_Base","type":"->"},{"file":"/var/www/cloud.domain.tld/apps/mail/lib/Service/MailManager.php","line":598,"function":"getFolders","class":"OCA\Mail\IMAP\FolderMapper","type":"->"},{"file":"/var/www/cloud.domain.tld/apps/mail/lib/BackgroundJob/QuotaJob.php","line":92,"function":"getQuota","class":"OCA\Mail\Service\MailManager","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\Mail\BackgroundJob\QuotaJob","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class": "OCP\BackgroundJob\Job","type":"->"},{"file":"/var/www/cloud.domain.tld/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\BackgroundJob\TimedJob","type":"->"},{"file":"/var/www/cloud.domain.tld/cron.php","line":152,"function":"execute","class":"OCP\BackgroundJob\TimedJob","type":"->"}],"File":"/var/www/cloud.domain.tld/apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":572,"message":"Error while running background job (class: OCA\Mail\BackgroundJob\QuotaJob, arguments: Array\n(\n [accountId] => 82\n)\n)","exception":{"details":null,"logged":false,"raw_msg":"Mail server denied authentication."},"CustomMessage":"Error while running background job (class: OCA\Mail\BackgroundJob\QuotaJob, arguments: Array\n(\n [accountId] => 82\n)\n)"}}

Mail app version

3.5.5

Mailserver or service

dovecot/postfix

Operating system

debian (bookworm)

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database

MySQL

Additional info

My setup for ldap/dovecot/postfix is a little bit convoluted. I opted for using pam so users have home directories created on the mail server with a skel Maildir being copied upon successful login. This occurs once the email server is accessed since it is authenticating against pam which authenticates against ldap. Maybe a solution is for the mobile app to call the mail app somehow to ensure that password for mail provisioning are stored properly? Not sure if that is the issue but I do know that a user who logs into the web interface and access the mail app gets a perfectly provisioned account with dirs created and nextcloud no longer logs an error.

Another option might be to possibly reduce this error to an INFO message instead or something that will not taint the administrator page with a warning that there are x erros in the log.

ChristophWurst commented 5 months ago

Could ba a duplicate of https://github.com/nextcloud/mail/issues/8963

JRGonz commented 5 months ago

Could ba a duplicate of #8963

I wasn't sure if it was the same problem or not. My apologies if it is.

kesselb commented 3 days ago

Hi @JRGonz,

Still happening? If I'm not mistaken, https://github.com/nextcloud/mail/pull/9493 should prevent it.