tarickb / sasl-xoauth2

SASL plugin for XOAUTH2
Other
72 stars 20 forks source link

SASL failure: 'bad protocol / cancel' #42

Closed soreau closed 1 year ago

soreau commented 1 year ago

After upgrading to ubuntu 22.04 on arm64, this module no longer works for gmail relay on postfix. I installed from the ppa, ensure it's loaded, check client and secret id's are in /etc/sasl-xoauth2.conf, and ran sasl-xoauth2-token-tool, went to the browser and put the resulting info the the correct file but no matter what I try, I am getting the following error when trying to send mail:

"SASL authentication failed; cannot authenticate to server smtp.gmail.com[142.251.116.108]: bad protocol / cancel"

I can't seem to find much information about why this happens. Any help is appreciated.

postconf -nf && postconf -Mf

ImAnOwl commented 1 year ago

Check on the README the chroot paragraph, i think it could not verify the certs.

tarickb commented 1 year ago

Please add the following to /etc/sasl-xoauth2.conf:

{
  "client_id": "client ID goes here",
  "client_secret": "client secret goes here",
  "log_to_syslog_on_failure": "yes",
  "log_full_trace_on_failure": "yes"
}

Then restart Postfix and try sending mail again. When it fails you should find some additional logging in /var/log/syslog. Please share that here.

soreau commented 1 year ago

Please add the following to /etc/sasl-xoauth2.conf:

{
  "client_id": "client ID goes here",
  "client_secret": "client secret goes here",
  "log_to_syslog_on_failure": "yes",
  "log_full_trace_on_failure": "yes"
}

Then restart Postfix and try sending mail again. When it fails you should find some additional logging in /var/log/syslog. Please share that here.

https://pastebin.com/raw/emkhKpy8

I tried running update-ca-certificates but it didn't help.

soreau commented 1 year ago

After tinkering around, I finally managed to get it working. I'm not sure exactly but it may have been a permissions issue on /var/spool/postfix/etc/tokens. Thanks for the help.

soreau commented 1 year ago

For what it's worth, the bug was this. I was still having trouble after reboot until I changed pem to crt in /usr/lib/postfix/configure-instance.sh.