[X2Go-Commits] x2gobroker.git - uccsoutput (branch) updated: 0.0.1.0-72-g85ffd94

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


The branch, uccsoutput has been updated
       via  85ffd94dae231162d20c38c9c7a2c7dab99b6e0c (commit)
       via  ad71a6de92eb31ef0f3a3aae4aec16067573c35b (commit)
       via  81642aaf1a9a448bb00906fc6d57d2a324ae5a59 (commit)
       via  31a93ead8a1fada72e134a8f9e48e6f8c30beb05 (commit)
       via  87e42dc92a6aa376c672c903ccaa59284718d0e9 (commit)
       via  9472cbc3b80ab0349feb5a020756c8bce9489be1 (commit)
       via  2a8a92b9a806b0bddee8893db10871941d0d3827 (commit)
       via  c03f569500958547e14dc7f17b3fed546be79777 (commit)
       via  4595a5dc63ae5a80d2c210ba4469390acb11fd2f (commit)
      from  23c88c33da8d3294bb74e854bc6f883ea63b7c9a (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 85ffd94dae231162d20c38c9c7a2c7dab99b6e0c
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 ad71a6de92eb31ef0f3a3aae4aec16067573c35b
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 81642aaf1a9a448bb00906fc6d57d2a324ae5a59
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 31a93ead8a1fada72e134a8f9e48e6f8c30beb05
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 87e42dc92a6aa376c672c903ccaa59284718d0e9
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 9472cbc3b80ab0349feb5a020756c8bce9489be1
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 2a8a92b9a806b0bddee8893db10871941d0d3827
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 c03f569500958547e14dc7f17b3fed546be79777
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Apr 19 14:31:47 2013 +0200

    fix comment text

commit 4595a5dc63ae5a80d2c210ba4469390acb11fd2f
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 365ce0b..43e4d79 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
@@ -850,7 +851,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 d734cc6..f46e1b8 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