docker-mailserver: postfix/submissions/smtpd: SASL authentication failure: Couldn't find mech XOAUTH2

πŸ“ Preliminary Checks

  • I tried searching for an existing issue and followed the debugging docs advice, but still need assistance.

πŸ‘€ What Happened?

I use roundcube to connect to IMAP with OAUTH2 and everything works correct. I can login to the mailbox and read the mails.

When I try to send an e-mail, I get the following error in the docker mailserver logs:

postfix/submissions/smtpd[1653]: warning: SASL authentication failure: Couldn't find mech XOAUTH2
postfix/submissions/smtpd[1653]: warning: SASL XOAUTH2 authentication failed: no mechanism available, sasl_username=(unavailable)

πŸ‘Ÿ Reproduction Steps

Authenticate with OAUTH2 and try to send and e-mail

πŸ‹ DMS Version

v14.0.0

πŸ’» Operating System and Architecture

Ubuntu 22.04

βš™οΈ Container configuration files

No response

πŸ“œ Relevant log output

postfix/submissions/smtpd[1653]: warning: SASL authentication failure: Couldn't find mech XOAUTH2
postfix/submissions/smtpd[1653]: warning: hostname[ip-adres]: SASL XOAUTH2 authentication failed: no mechanism available, sasl_username=(unavailable)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

  1. Check that dovecote is requesting 3 scopes: openid, profile, and email.

  2. Ensure that the username attribute is being returned along with the email. If the username is under sub you might have to change the attribute to that.

  3. Try logging in with your email address instead and setting the attribute to email.

  1. Check that dovecote is requesting 3 scopes: openid, profile, and email.

Checked and this is correct. Requesting openid, profie and email in the roundcube config

$config['oauth_scope'] = 'email openid profile';
  1. Ensure that the username attribute is being returned along with the email. If the username is under sub you might have to change the attribute to that.

I found out that the attribute in the userinfo endpoint of Authelia for username is preferred_username. Changed the configuration to

OAUTH2_INTROSPECTION_URL=https://authelia.example.be/api/oidc/userinfo
OAUTH2_USERNAME_ATTRIBUTE=preferred_username

And I can login again with roundcube to my mailbox. Sending e-mails remains the same. It is correct that in the introspection endpoint the username attribute is username.

Sending e-mails remains a problem.

postfix/submission/smtpd[1526]: connect from roundcube[IP]
postfix/submission/smtpd[1526]: Anonymous TLS connection established from roundcube[IP]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384
postfix/submission/smtpd[1526]: warning: SASL authentication failure: Couldn't find mech XOAUTH2
postfix/submission/smtpd[1526]: warning: roundcube[IP]: SASL XOAUTH2 authentication failed: no mechanism available, sasl_username=(unavailable)

Hi @polarathene @thechubbypanda

thank you for your feedback.

Unfortunately it doesn’t work. If I use

OAUTH2_INTROSPECTION_URL=https://auth.example.com/api/oidc/userinfo
OAUTH2_USERNAME_ATTRIBUTE=username

I get this error in the logs:

dovecot: auth: Error: oauth2(user, IP,<*******>): oauth2 failed: Introspection failed: No username returned

and I can’t login to IMAP with roundcube.

If I add

OAUTH2_INTROSPECTION_URL=https://clientid:secret@authelia.example.com/api/oidc/introspection
OAUTH2_USERNAME_ATTRIBUTE=username
OAUTH2_INTROSPECTION_MODE=post

I can login to IMAP with roundcube but I get the following error when I send an e-mail with SMTP on port 465 and 587:

postfix/submissions/smtpd[1653]: warning: SASL authentication failure: Couldn't find mech XOAUTH2
postfix/submissions/smtpd[1653]: warning: hostname[ip-adres]: SASL XOAUTH2 authentication failed: no mechanism available, sasl_username=(unavailable)

Thank you for your help! Kristof