[X2Go-Commits] x2gobroker.git - master (branch) updated: 0.0.1.0-40-g18a92d3

X2Go dev team git-admin at x2go.org
Fri Apr 19 14:47:47 CEST 2013


The branch, master has been updated
       via  18a92d3014e5060b7fc959518ad822f572e89691 (commit)
       via  112ebe4f0f5494b18ebda527d6920aa5e1440fae (commit)
       via  041db4bb343d596e5861c54d80db45ab622cbf9d (commit)
       via  e6a7f9f6dec729233e9aa9f1c9ea4978f06f14e0 (commit)
       via  26d9b1918943c437fbe3e88f651c66fcb2fc7443 (commit)
       via  1eedf8bc5e22bf396159d00c6dfd18837e29b941 (commit)
       via  6d488f01366743827558f8cb208b687207d19de7 (commit)
       via  77c3a2cea7defd21f3af1edc17f29095b3329ef3 (commit)
       via  bc41924e2929edfe733ba6d9c9646bfeafa7e511 (commit)
      from  d9edb503e4b28793fb7b7a3848d24bd6df97fa7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 18a92d3014e5060b7fc959518ad822f572e89691
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:45:18 2013 +0200

    make --debug cmdline option work in x2gobroker-testauth

commit 112ebe4f0f5494b18ebda527d6920aa5e1440fae
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:44:04 2013 +0200

    fix exception call, add debug message when authentication is requested

commit 041db4bb343d596e5861c54d80db45ab622cbf9d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:43:19 2013 +0200

    return 405 instead of 404 if method is not allowed (plaintext webui)

commit e6a7f9f6dec729233e9aa9f1c9ea4978f06f14e0
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:42:59 2013 +0200

    return 405 instead of 404 if method is not allowed (html webui)

commit 26d9b1918943c437fbe3e88f651c66fcb2fc7443
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:42:17 2013 +0200

    mark missing log output with a FIXME in authservice.py

commit 1eedf8bc5e22bf396159d00c6dfd18837e29b941
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:41:51 2013 +0200

    import pwd and grp classes in x2gobroker-authservice

commit 6d488f01366743827558f8cb208b687207d19de7
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:40:57 2013 +0200

    add man page for x2gobroker-testauth

commit 77c3a2cea7defd21f3af1edc17f29095b3329ef3
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:31:47 2013 +0200

    fix comment text

commit bc41924e2929edfe733ba6d9c9646bfeafa7e511
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:01:03 2013 +0200

    mention Tornado instead of Web.py in x2gobroker man page

-----------------------------------------------------------------------

Summary of changes:
 bin/x2gobroker-testauth           |   12 +++++--
 debian/x2gobroker.manpages        |    1 +
 man/man8/x2gobroker-testauth.8    |   64 +++++++++++++++++++++++++++++++++++++
 man/man8/x2gobroker.8             |    2 +-
 sbin/x2gobroker-authservice       |    3 ++
 x2gobroker/authservice.py         |    1 +
 x2gobroker/brokers/base_broker.py |    3 +-
 x2gobroker/defaults.py            |    2 +-
 x2gobroker/web/html.py            |    5 +--
 x2gobroker/web/plain.py           |    5 +--
 10 files changed, 88 insertions(+), 10 deletions(-)
 create mode 100644 man/man8/x2gobroker-testauth.8

The diff of changes is:
diff --git a/bin/x2gobroker-testauth b/bin/x2gobroker-testauth
index fd8a5a7..d8ef295 100755
--- a/bin/x2gobroker-testauth
+++ b/bin/x2gobroker-testauth
@@ -24,6 +24,7 @@ import os
 import sys
 import setproctitle
 import argparse
+import logging
 
 # perform an authentication against the authentication mechanism configured for WSGI
 try:
@@ -31,6 +32,7 @@ try:
 except ImportError:
     sys.path.insert(0, os.path.join(os.getcwd(), '..'))
     import x2gobroker.defaults
+import x2gobroker.loggers
 
 PROG_NAME = os.path.basename(sys.argv[0])
 PROG_OPTIONS = sys.argv[1:]
@@ -78,12 +80,16 @@ if __name__ == "__main__":
     if cmdline_args.config_file is not None:
         x2gobroker.defaults.X2GOBROKER_CONFIG = cmdline_args.config_file
 
-    x2gobroker.defaults.X2GOBROKER_DEBUG = cmdline_args.debug
+    if cmdline_args.debug:
+        x2gobroker.defaults.X2GOBROKER_DEBUG = cmdline_args.debug
+        # raise log level to DEBUG if requested...
+        if x2gobroker.defaults.X2GOBROKER_DEBUG and not x2gobroker.defaults.X2GOBROKER_TESTSUITE:
+            x2gobroker.loggers.logger_broker.setLevel(logging.DEBUG)
+            x2gobroker.loggers.logger_error.setLevel(logging.DEBUG)
+
     username = cmdline_args.username
     password = cmdline_args.password
 
-import x2gobroker.config
-
 config_file = x2gobroker.defaults.X2GOBROKER_CONFIG
 config_defaults = x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS
 
diff --git a/debian/x2gobroker.manpages b/debian/x2gobroker.manpages
index 569dc33..71c3e08 100644
--- a/debian/x2gobroker.manpages
+++ b/debian/x2gobroker.manpages
@@ -1,2 +1,3 @@
 man/man8/x2gobroker.8
 man/man8/x2gobroker-keygen.8
+man/man8/x2gobroker-testauth.8
diff --git a/man/man8/x2gobroker-testauth.8 b/man/man8/x2gobroker-testauth.8
new file mode 100644
index 0000000..b7e2278
--- /dev/null
+++ b/man/man8/x2gobroker-testauth.8
@@ -0,0 +1,64 @@
+'\" -*- coding: utf-8 -*-
+.if \n(.g .ds T< \\FC
+.if \n(.g .ds T> \\F[\n[.fam]]
+.de URL
+\\$2 \(la\\$1\(ra\\$3
+..
+.if \n(.g .mso www.tmac
+.TH x2gobroker-testauth 8 "April 2013" "Version 0.0.1.y" "X2Go Session Broker"
+.SH NAME
+x2gobroker-testauth \- Session Broker for X2Go (Authentication Test Utility)
+.SH SYNOPSIS
+'nh
+.fi
+.ad l
+\fBx2gobroker-testauth\fR \kx
+.if (\nx>(\n(.l/2)) .nr x (\n(.l/5)
+'in \n(.iu+\nxu
+[
+\fIoptions\fR
+]
+'in \n(.iu-\nxu
+.ad b
+'hy
+.SH DESCRIPTION
+\fBx2gobroker-testauth\fR is an authentication test utility for X2Go Session Broker.
+.PP
+WARNING: please know that the credentials you use for testing broker authentication will
+get revealed in your shell's history file (e.g. ~/.bash_history).
+.SH COMMON OPTIONS
+\fBx2gobroker-testauth\fR displays some help on command line options:
+.TP
+\*(T<\fB\-h, \-\-help\fR\*(T>
+Display a help with all available command line options and exit.
+.SH REQUIRED OPTIONS
+For any other operation than the help text, the two options below are required.
+.TP
+\*(T<\fB\-u, \-\-user, \-\-username\fR\*(T>
+Username part of the credentials you want to test.
+.TP
+\*(T<\fB\-p, \-\-password\fR\*(T>
+Password part of the credentials (be sure you want to reveal those on the command line before doing it!!!)
+.SH MISC OPTIONS
+\fBx2gobroker-testauth\fR also accepts the following miscellaneous options:
+.TP
+\*(T<\fB\-d, \-\-debug\fR\*(T>
+Enable debugging code.
+.TP
+\*(T<\fB\-C, \-\-config FILENAME\fR\*(T>
+Specify an alternative configuration file name, default is: \fI/etc/x2go/x2gobroker.conf\fR.
+.TP
+\*(T<\fB\-b, \-\-backend BACKEND\fR\*(T>
+Specify another configured/enabled backend configuration to test authentication against, default is: the \fIzeroconf\fR backend.
+.SH "FILES"
+/etc/x2go/x2gobroker.conf, /etc/x2go/broker/* (configuration files)
+.PP
+/etc/default/x2gobroker-daemon (environment for X2Go Session Broker when run
+as standalone daemon)
+.PP
+/var/log/x2gobroker/* (log files of X2Go Session Broker)
+.SH "SEE ALSO"
+\fB/usr/share/doc/x2gobroker\fR
+.SH AUTHOR
+This manual has been written for the X2Go project by
+Mike Gabriel <mike.gabriel at das-netzwerkteam.de>.
diff --git a/man/man8/x2gobroker.8 b/man/man8/x2gobroker.8
index 8811c2b..ec5ac10 100644
--- a/man/man8/x2gobroker.8
+++ b/man/man8/x2gobroker.8
@@ -22,7 +22,7 @@ x2gobroker \- Session Broker for X2Go
 .ad b
 'hy
 .SH DESCRIPTION
-\fBx2gobroker\fR is a Web.py based implementation of the X2Go Session Broker API.
+\fBx2gobroker\fR is a Python Tornado based implementation of the X2Go Session Broker API.
 .PP
 This command is normally executed either through an init script or via the WSGI module in your httpd server.
 .PP
diff --git a/sbin/x2gobroker-authservice b/sbin/x2gobroker-authservice
index 534a532..28084fd 100755
--- a/sbin/x2gobroker-authservice
+++ b/sbin/x2gobroker-authservice
@@ -31,6 +31,9 @@ import socket
 import getpass
 import logging.config
 
+from pwd import getpwnam
+from grp import getgrnam
+
 PROG_NAME = os.path.basename(sys.argv[0])
 PROG_OPTIONS = sys.argv[1:]
 setproctitle.setproctitle("%s %s" % (PROG_NAME, " ".join(PROG_OPTIONS)))
diff --git a/x2gobroker/authservice.py b/x2gobroker/authservice.py
index ae1518a..26c841e 100644
--- a/x2gobroker/authservice.py
+++ b/x2gobroker/authservice.py
@@ -62,6 +62,7 @@ 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))
     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))
     s.send('{username} {password} {service}\n'.format(username=username, password=password, service=service))
     result = s.recv(1024)
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index 76ed8ef..b9038c3 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -417,6 +417,7 @@ 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))
             return self.authmech_module.X2GoBrokerAuthMech().authenticate(username, password)
         else:
             return False
@@ -847,7 +848,7 @@ class X2GoBroker(object):
 
                 try:
                     busy_servers = x2gobroker.agent.find_busy_servers(username=username, query_mode=agent_query_mode, remote_agent=remote_agent)
-                except x2gobroker.X2GoBrokerAgentException:
+                except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException:
                     logger_broker.warning('base_broker.X2GoBroker.select_session(): failed to query broker agent (quey-mode: {query_mode}, remote_agent: {remote_agent})'.format(query_mode=agent_query_mode, remote_agent=remote_agent))
 
                     if agent_query_mode.upper() == u'SSH':
diff --git a/x2gobroker/defaults.py b/x2gobroker/defaults.py
index ee5d7f8..0c7c2c5 100644
--- a/x2gobroker/defaults.py
+++ b/x2gobroker/defaults.py
@@ -56,7 +56,7 @@ else:
 if X2GOBROKER_USER != X2GOBROKER_DAEMON_USER:
     X2GOBROKER_DEBUG = True
 
-# drop og level to CRITICAL if we are running the unittests...
+# raise log levels to CRITICAL if we are running the unittests...
 if X2GOBROKER_TESTSUITE:
     logger_broker.setLevel(logging.CRITICAL)
     logger_access.setLevel(logging.CRITICAL)
diff --git a/x2gobroker/web/html.py b/x2gobroker/web/html.py
index 0e1988f..0cfb97e 100644
--- a/x2gobroker/web/html.py
+++ b/x2gobroker/web/html.py
@@ -65,11 +65,12 @@ $output
             self.set_header(http_header_item, self.http_header_items[http_header_item])
 
     def get(self, backend):
-        self._gen_http_header()
         return self.post(backend)
 
     def post(self, backend):
 
+        self._gen_http_header()
+
         if not backend:
             backend = _X2GOBROKER_DEFAULT_BACKEND
         else:
@@ -83,7 +84,7 @@ $output
             exec("broker_backend = x2gobroker.brokers.{backend}_broker.X2GoBroker()".format(backend=backend))
         except ImportError:
             # throw a 404 if the backend does not exist
-            raise tornado.web.HTTPError(404)
+            raise tornado.web.HTTPError(405)
 
         global_config = broker_backend.get_global_config()
         backend_config = broker_backend.get_backend_config(backend)
diff --git a/x2gobroker/web/plain.py b/x2gobroker/web/plain.py
index 8487e43..ca041df 100644
--- a/x2gobroker/web/plain.py
+++ b/x2gobroker/web/plain.py
@@ -44,13 +44,14 @@ class X2GoBrokerWeb(tornado.web.RequestHandler):
 
     def get(self, backend):
         if x2gobroker.defaults.X2GOBROKER_DEBUG:
-            self._gen_http_header()
             logger_broker.warn('GET http request detected, if unwanted: disable X2GOBROKER_DEBUG')
             return self.post(backend)
-        raise tornado.web.HTTPError(404)
+        raise tornado.web.HTTPError(405)
 
     def post(self, backend):
 
+        self._gen_http_header()
+
         if not backend:
             backend = x2gobroker.defaults.X2GOBROKER_DEFAULT_BACKEND
         else:


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2gobroker.git" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list