From unknown Fri Apr 17 13:30:44 2026
X-Loop: owner@bugs.x2go.org
Subject: Bug#1057: x2gobroker-authservice broken in Ubuntu 16.04
Reply-To: Walid MOGHRABI <w.moghrabi@servicemagic.eu>, 1057@bugs.x2go.org
Resent-From: Walid MOGHRABI <w.moghrabi@servicemagic.eu>
Resent-To: x2go-dev@lists.x2go.org
Resent-CC: X2Go Developers <x2go-dev@lists.x2go.org>
X-Loop: owner@bugs.x2go.org
Resent-Date: Fri, 08 Jul 2016 13:25:02 +0000
Resent-Message-ID: <handler.1057.B.14679841826180@bugs.x2go.org>
Resent-Sender: owner@bugs.x2go.org
X-X2Go-PR-Message: report 1057
X-X2Go-PR-Package: x2gobroker-authservice
X-X2Go-PR-Keywords: patch stable
Received: via spool by submit@bugs.x2go.org id=B.14679841826180
          (code B); Fri, 08 Jul 2016 13:25:02 +0000
Received: (at submit) by bugs.x2go.org; 8 Jul 2016 13:23:02 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=3.0 tests=BAYES_20,URIBL_BLOCKED
	autolearn=ham version=3.3.2
Received: from localhost (localhost [127.0.0.1])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id B8C615DDF5
	for <submit@bugs.x2go.org>; Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at ymir.das-netzwerkteam.de
Received: from ymir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (ymir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id k0OcxkA01xiP for <submit@bugs.x2go.org>;
	Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
Received: from zm-01.servicemagic.eu (zm-01.servicemagic.eu [176.31.236.17])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id 7A3685DDD0
	for <submit@bugs.x2go.org>; Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
Received: from localhost (localhost.localdomain [127.0.0.1])
	by zm-01.servicemagic.eu (Postfix) with ESMTP id 61A8E8072A4C8
	for <submit@bugs.x2go.org>; Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
X-Amavis-Modified: Mail body modified (using disclaimer) -
	zm-01.servicemagic.eu
X-Virus-Scanned: amavisd-new at servicemagic.eu
Received: from zm-01.servicemagic.eu ([127.0.0.1])
	by localhost (zm-01.servicemagic.eu [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 6cdcoTvweQdv for <submit@bugs.x2go.org>;
	Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
Received: from zm-01.servicemagic.eu (localhost.localdomain [127.0.0.1])
	by zm-01.servicemagic.eu (Postfix) with ESMTP id 4B554806E61EB
	for <submit@bugs.x2go.org>; Fri,  8 Jul 2016 15:23:00 +0200 (CEST)
Date: Fri, 8 Jul 2016 15:23:00 +0200 (CEST)
From: Walid MOGHRABI <w.moghrabi@servicemagic.eu>
To: submit@bugs.x2go.org
Message-ID: <730138804.2940363.1467984180276.JavaMail.root@servicemagic.eu>
In-Reply-To: <436836937.2940303.1467984152461.JavaMail.root@servicemagic.eu>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Originating-IP: [10.33.100.18]
X-Mailer: Zimbra 7.2.0_GA_2669 (ZimbraWebClient - GC51 (Linux)/7.2.0_GA_2669)

Package: x2gobroker-authservice 
Version: 0.0.3.0 
Severity: grave
Tags: stable,patch

For days I was struggling with x2gobroker-authservice not working when authenticating against PAM.
I eventualy discovered it was the pam class instanciation in /usr/sbin/x2gobroker-authservice that was not working with the following error : 

error: uncaptured python exception, closing channel <__main__.AuthClient connected '' at 0x7f0aa5c11f80> (<type 'exceptions.AttributeError'>:'module' object has no attribute 'authenticate' [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|449] [/usr/sbin/x2gobroker-authservice|handle_read|81])

It seems the pam.py module has probably been refaktored in this Ubuntu making the authservice failing.

Here is a patch for the fix :

-----------------------------------------------------------------------------------------
--- /usr/sbin/x2gobroker-authservice.dist	2016-07-08 15:07:40.387403000 +0200
+++ /usr/sbin/x2gobroker-authservice	2016-07-08 15:07:00.219403000 +0200
@@ -78,7 +78,11 @@
                 self.send('bad\n')
                 self.logger.warning('bad authentication data received')
             else:
-                if pam.authenticate(user, passwd, service):
+                if pam.pam:
+                    opam = pam.pam()
+                else:
+                    opam = pam
+                if opam.authenticate(user, passwd, service):
                     self.send('ok\n')
                     self.logger.info('successful authentication for \'{user}\' with password \'<hidden>\' against PAM service \'{service}\''.format(user=user, service=service))
                 else:
-----------------------------------------------------------------------------------------


Test conditions :
===============
    * Ubuntu Server 16.04 LTS up to date (2016-07-08)
    * python-pampy : 1.8.2
    * x2gobroker-authservice : 0.0.3.0 (from x2go/stable ppa)



Best regards,

Walid Moghrabi
	
---
DISCLAIMER: This e-mail is private and confidential and may contain proprietary or legally privileged information. It is for the intended recipient only. If you have received this email in error, please notify the author by replying to it and then destroy it. If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this e-mail or any attachment. Thank you
