mail icon indicating copy to clipboard operation
mail copied to clipboard

Authenticated ciphertext could not be decoded

Open AT-SGAI-CSIC opened this issue 1 year ago • 6 comments

Steps to reproduce

  1. Execute cronjob
  2. Show logs of nextcloud

Expected behavior

Doesn't show these log messages

Actual behavior

We have observed that when the cronjob is executed appears multiple logs with the message Authenticated ciphertext could not be decoded:

{"reqId":"Rbg7ordtQZbFl2vD9Exi","level":3,"time":"2024-05-22T18:22:30+02:00","remoteAddr":"","user":"--","app":"mail","method":"","url":"--","message":"Cron mail sync failed for account 385","userAgent":"--","version":"28.0.3.3","exception":{"Exception":"Exception","Message":"Authenticated ciphertext could not be decoded.","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/Security/Crypto.php","line":123,"function":"decryptWithoutSecret","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/IMAP/IMAPClientFactory.php","line":89,"function":"decrypt","class":"OC\\Security\\Crypto","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/IMAP/MailboxSync.php","line":103,"function":"getClient","class":"OCA\\Mail\\IMAP\\IMAPClientFactory","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":109,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/lib/private/Security/Crypto.php","Line":135,"message":"Cron mail sync failed for account {accountId}","exception":{},"CustomMessage":"Cron mail sync failed for account 385"}}

Mail app version

3.6.1

Mailserver or service

No response

Operating system

AlmaLinux release 8.9

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database

PostgreSQL

Additional info

We see that the accounts that have the problem are ok. There are active and working normally. If we try to update the mail account it's seems working, but in case of sync or diagnose fails:

imagen

AT-SGAI-CSIC avatar May 22 '24 16:05 AT-SGAI-CSIC

Do you use more than one application/nextcloud server?

ChristophWurst avatar May 22 '24 16:05 ChristophWurst

Sorry, I don't understand the question, Do you mean other nextcloud instances?

AT-SGAI-CSIC avatar May 23 '24 06:05 AT-SGAI-CSIC

More than one server running Nextcloud. I'm asking because this error only occurs if the secret in config.php changed or there is more than one value. This can happen for wrongly set up clusters, or when a backup is restored badly.

ChristophWurst avatar May 23 '24 07:05 ChristophWurst

Yes, we have many server runing Nextcloud behind HAproxy loadbalancer, all the nodes share (NFS) the same file config.php. The cronjob it's execute in only one node.

AT-SGAI-CSIC avatar May 23 '24 11:05 AT-SGAI-CSIC

Yes, we have many server runing Nextcloud behind HAproxy loadbalancer, all the nodes share (NFS) the same file config.php.

Good :+1:

Can you check your backups for a change of the secret in config.php?

ChristophWurst avatar May 23 '24 12:05 ChristophWurst

Ohh, we see that we have many email account configured without password, and precisely those accounts are what cause the problem. It's possible to delete those email accounts automatically?

AT-SGAI-CSIC avatar May 23 '24 13:05 AT-SGAI-CSIC

Hi, we try to delete the accounts with cli, but we have the message: imagen

How we can delete this accounts?

AT-SGAI-CSIC avatar May 28 '24 07:05 AT-SGAI-CSIC

You have to deprovision them via the admin UI. It's the same place you have provisioned the accounts.

ChristophWurst avatar May 28 '24 07:05 ChristophWurst

But with the deprovision option you deprovisioning all the accounts, not just those with an empty password?

AT-SGAI-CSIC avatar May 28 '24 07:05 AT-SGAI-CSIC

Correct

ChristophWurst avatar May 28 '24 07:05 ChristophWurst

Ok, thank you very much for the answer.

AT-SGAI-CSIC avatar May 28 '24 07:05 AT-SGAI-CSIC