LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-26-2024, 10:42 AM   #1
gattocarlo
Member
 
Registered: Jan 2020
Posts: 63

Rep: Reputation: Disabled
postfix and xoauth2 (for gmail authentication)


Hi,

I'm facing what I think is a weird problem with postfix and xoauth2 and I'm not able to debug it.

I have two machines, my laptop and my home server, both running updated slackware 15.

Since I use different email accounts, personal ones with my domain (hosted on my home server) and some gmail accounts for work, on my laptop I set up postfix to relay messages sent from my gmail accounts through gmail and messages sent from my personal accounts through my home server. Since the authentication on gmail requires xoauth2, while my server requires a normal login (over TLS), my laptop postfix configuration uses two different transports, one with

Code:
smtp_sasl_mechanism_filter = xoauth2
and one with

Code:
smtp_sasl_mechanism_filter = login

I then use:
Code:
smtp_sender_dependent_authentication
sender_dependent_default_transport_maps
sender_dependent_relayhost_maps
The XOAUTH2 SASL mechanism is provided by the cyrus-sasl-xoauth plugin for cyrus-sasl.

I wrote a small deamon which periodically updates the access tokens of my gmail accounts and everything works perfectly fine.

I wanted to replicate this setup on my home server but postfix here is not working. When using gmail to relay the messages everything seems to be working fine: the correct SASL mechanism is used, the appropriate username is sent to the gmail stmp server, but the response it gets form gmail causes a segfault.

This is (the edited) /var/log/maillog
Code:
postfix/smtp[40578]: smtp_sasl_authenticate: smtp.gmail.com[142.250.102.109]:587: SASL mechanisms XOAUTH2
postfix/smtp[40578]: xsasl_cyrus_client_get_user: my_email_account@gmai.com
postfix/qmgr[40576]: warning: private/gmail socket: malformed response
postfix/master[40574]: warning: process /usr/libexec/postfix/smtp pid 40578 killed by signal 11
postfix/master[40574]: warning: /usr/libexec/postfix/smtp: bad command startup -- throttling
(private/gmail is the name of the transport I use to select "smtp_sasl_mechanism_filter = xoauth2")

In /var/log/messages I get:
Code:
smtp[40578]: segfault at 4044 ip 00005653e92bbe20 sp 00007ffc7af69080 error 4 in smtp[5653e92ae000+f000]
kernel: Code: 89 28 8d 53 01 48 8d 78 08 4c 89 e6 48 63 d2 e8 d6 22 ff ff 31 c0 48 83 c4 08 5b 5d 41 5c 41 5d c3 66 0f 1f 84 00 00 00 00 00 <48> 8b 56 40 48 8d 3d 71 2c 00 00 31 c0 48 8d 35 ee 51 00 00 e8 37
I spent a few hours searching the web and found someone with similar issues, usually related to the SASL mechanism or smtp_tls_fingerprint_digest. But in my case I get a similar result when I unistall cyrus-sasl-xoauth2.

It seems like the xouth2 plugin is not working properly even though the plugin seems to be loaded and working:

Code:
pluginviewer -c:
...
Plugin "xoauth2" [loaded],      API version: 4
        SASL mechanism: XOAUTH2, best SSF: 0
        security flags: NO_ANONYMOUS|PASS_CREDENTIALS
        features: WANT_CLIENT_FIRST|PROXY_AUTHENTICATION
I do not know what to do and how to debug the postfix smtp client. Any help or direction would be greatly appreciated.

I tried using a different cyrus plugin (sasl-xoauth2) but I wasn't able to get sasl to load it...

Sorry for such a long post and thanks for your kind attention.

Best,
--
andrea
 
Old 03-27-2024, 09:19 AM   #2
gattocarlo
Member
 
Registered: Jan 2020
Posts: 63

Original Poster
Rep: Reputation: Disabled
I was eventually able to fix my problem, sort of... but I'm not marking this thread as solved because I believe I came to hit a slackware specific issue.

Now, the fact is that slackware already comes with a sasl plugin which provides the xoauth2 mechanism: libkgapi, a KDE library implementing APIs for various google services (gmail seems not to be included).

I do not know why, but while on my laptop that plugin is loaded after cyrus-sasl-xoauth2 plugin (which thus seems to take the precedence over libkdexoauth2.so) on my sever it is the other way around: libkdexoauth2.so is loaded before cyrus-sasl-xoauth2. So postfix, through cyrus-sasl, is using it and that is causing postfix to segfault with a SIGSEGV.

I do not use KDE, except for some minor services (basically kdeconnectd), so my sort of fix on my server was to get rid of libkdexoauth2.so, and that makes it possible to correctly relay email massages through smtp.gmail.com with xoauth2.

I'm far from being an sasl expert, and I was not able to find any documented way to select which plugin to use for each service. But I think that, for a distribution like slackware, being able to use postfix to relay messages with xoauth2 through gmail is something useful. Presently it seems like this is possible only if you are lucky... I believe that further investigation of this issue would be useful.

best,
andrea
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] XOAUTH2 with Alpine on slack142 pisti Slackware 3 07-19-2021 12:08 PM
Sending emails with postfix and gmail - SASL authentication failed NotionCommotion Linux - Newbie 1 05-26-2017 03:13 PM
gmail: A sort of gmail-notify for the console ? frenchn00b Linux - Software 1 05-13-2008 04:54 PM
SUSE Open 10.3. Gmail. PITA. (If you don't have Gmail, you will not understand) Lola Kews SUSE / openSUSE 6 03-19-2008 07:43 AM
LXer: Import mail into Gmail with the Gmail Loader LXer Syndicated Linux News 0 03-19-2007 06:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration