[X2Go-Commits] [x2gobroker] 15/17: Improve debugging messages during authentication phase.

git-admin at x2go.org git-admin at x2go.org
Mon Oct 9 10:40:06 CEST 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit 2a477a007bb99bca502e5dab3685325973f4d1ff
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sun Sep 24 16:40:05 2017 +0200

    Improve debugging messages during authentication phase.
---
 x2gobroker/authmechs/pam_authmech.py | 4 ++--
 x2gobroker/authservice.py            | 8 ++++----
 x2gobroker/brokers/base_broker.py    | 6 ++++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/x2gobroker/authmechs/pam_authmech.py b/x2gobroker/authmechs/pam_authmech.py
index 3486d65..44b140a 100644
--- a/x2gobroker/authmechs/pam_authmech.py
+++ b/x2gobroker/authmechs/pam_authmech.py
@@ -37,8 +37,8 @@ class X2GoBrokerAuthMech(object):
                     return True
 
             except error:
-                logger_error.error('Authentication against authentication service failed, trying direct PAM authentication (which is likely to fail on most PAM setups).')
-                logger_error.error('Make sure the current user ({user}) is allowed to use the PAM authentication mechanism.'.format(user=getpass.getuser()))
+                logger_error.error('pam_authmech.X2GoBrokerAuthmech.authenticate(): Authentication against authentication service failed, trying direct PAM authentication (which is likely to fail on most PAM setups).')
+                logger_error.error('pam_authmech.X2GoBrokerAuthmech.authenticate(): Make sure the current user ({user}) is allowed to use the PAM authentication mechanism.'.format(user=getpass.getuser()))
                 # fallback to direct PAM authentication against the PAM service ,,x2gobroker''
                 opam = pam
                 if hasattr(pam, "pam"):
diff --git a/x2gobroker/authservice.py b/x2gobroker/authservice.py
index a512dc7..4df5187 100644
--- a/x2gobroker/authservice.py
+++ b/x2gobroker/authservice.py
@@ -27,15 +27,15 @@ from x2gobroker.loggers import logger_broker
 
 def authenticate(username, password, service="x2gobroker"):
     s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
-    logger_broker.debug('connecting to authentication service socket {socket}'.format(socket=x2gobroker.defaults.X2GOBROKER_AUTHSERVICE_SOCKET))
+    logger_broker.debug('authservice.authenticate(): connecting to authentication service socket {socket}'.format(socket=x2gobroker.defaults.X2GOBROKER_AUTHSERVICE_SOCKET))
     s.connect(x2gobroker.defaults.X2GOBROKER_AUTHSERVICE_SOCKET)
     # FIXME: somehow logging output disappears after we have connected to the socket file...
-    logger_broker.debug('sending username={username}, password=<hidden>, service={service} to authentication service'.format(username=username, service=service))
+    logger_broker.debug('authservice.authenticate(): sending username={username}, password=<hidden>, service={service} to authentication service'.format(username=username, service=service))
     s.send('{username}\r{password}\r{service}\n'.format(username=username, password=password, service=service).encode())
     result = s.recv(1024).decode()
     s.close()
     if result.startswith('ok'):
-        logger_broker.info('authentication against PAM service »{service}« succeeded for user »{username}«'.format(username=username, service=service))
+        logger_broker.info('authservice.authenticate(): authentication against PAM service »{service}« succeeded for user »{username}«'.format(username=username, service=service))
         return True
-    logger_broker.info('authentication against service »{service}« failed for user »{username}«'.format(username=username, service=service))
+    logger_broker.info('authservice.authenticate(): authentication against service »{service}« failed for user »{username}«'.format(username=username, service=service))
     return False
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index bed645c..95b6cc4 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -489,8 +489,10 @@ class X2GoBroker(object):
 
     def _do_authenticate(self, username='', password=''):
 
-        if self._import_authmech_module(mech=self.get_authentication_mechanism()):
-            logger_broker.debug('base_broker.X2GoBroker._do_authenticate(): authenticating user={username} with password=<hidden> against backend={backend}.'.format(username=username, backend=self.backend_name))
+        mech = self.get_authentication_mechanism()
+        logger_broker.debug('base_broker.X2GoBroker._do_authenticate(): attempting authentication, will try "{mech}" mechanism for authenticating the user.'.format(mech=mech))
+        if self._import_authmech_module(mech=mech):
+            logger_broker.debug('base_broker.X2GoBroker._do_authenticate(): authenticating user={username} with password=<hidden> against mechanism "{mech}".'.format(username=username, mech=mech))
             return self.authmech_module.X2GoBrokerAuthMech().authenticate(username, password, config=self.config)
         else:
             return False

--
Alioth's /srv/git/code.x2go.org/x2gobroker.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git


More information about the x2go-commits mailing list