The branch, build-main has been updated via 27257d282bf6be8bc7d511824283725df634e045 (commit) from ace673b6219a685077cc15370395190190ba94c1 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: bin/x2gobroker-testauth | 110 +++++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 1 + debian/x2gobroker.install | 3 +- 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100755 bin/x2gobroker-testauth The diff of changes is: diff --git a/bin/x2gobroker-testauth b/bin/x2gobroker-testauth new file mode 100755 index 0000000..12db7da --- /dev/null +++ b/bin/x2gobroker-testauth @@ -0,0 +1,110 @@ +#!/usr/bin/env python + +# This file is part of the X2Go Project - http://www.x2go.org +# Copyright (C) 2011-2012 by Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de> +# Copyright (C) 2011-2012 by Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> +# Copyright (C) 2012 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> +# +# X2Go Session Broker is free software; you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# X2Go Session Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +import os +import sys +import setproctitle +import argparse + +# perform an authentication against the authentication mechanism configured for WSGI +try: + import x2gobroker.defaults +except ImportError: + sys.path.insert(0, os.path.join(os.getcwd(), '..')) + import x2gobroker.defaults + +PROG_NAME = os.path.basename(sys.argv[0]) +PROG_OPTIONS = sys.argv[1:] +try: + _password_index = PROG_OPTIONS.index('--password')+1 + PROG_OPTIONS[_password_index] = "XXXXXXXX" +except ValueError: + # ignore if --password option is not specified + pass +setproctitle.setproctitle("%s %s" % (PROG_NAME, " ".join(PROG_OPTIONS))) + +if __name__ == "__main__": + + auth_options = [ + {'args':['-u','--username', '--user'], 'default': None, 'metavar': 'USERNAME', 'help': 'Test authentication for the account with this username', }, + {'args':['-p', '--password'], 'default': None, 'metavar': 'PASSWORD', 'help': 'Test authentication using this password', }, + ] + misc_options = [ + {'args':['-C','--config-file'], 'default': None, 'metavar': 'CONFIG_FILE', 'help': 'Specify a special configuration file name, default is: {default}'.format(default=x2gobroker.defaults.X2GOBROKER_CONFIG), }, + {'args':['-b','--backend'], 'default': 'zeroconf', 'metavar': 'BACKEND', 'help': 'Use this specific backend for testing authentication, see x2gobroker.conf for a list of configured backends', }, + {'args':['-d','--debug'], 'default': False, 'action': 'store_true', 'help': 'enable debugging code', }, + ] + p = argparse.ArgumentParser(description='X2Go Session Broker (Authservice Test Utility)',\ + epilog="WARNING: Using this utility from the command line is not recommended!!!\nYour credentials will get revealed in your shells history file.",\ + formatter_class=argparse.RawDescriptionHelpFormatter, \ + add_help=True, argument_default=None) + p_auth = p.add_argument_group('authentication parameters') + p_misc = p.add_argument_group('miscellaneous parameters') + + for (p_group, opts) in ( (p_auth, auth_options), (p_misc, misc_options), ): + for opt in opts: + args = opt['args'] + del opt['args'] + p_group.add_argument(*args, **opt) + + cmdline_args = p.parse_args() + + if cmdline_args.username is None or cmdline_args.password is None: + p.print_help() + print + print "*** Cannot continue without username and password... ***" + print + sys.exit(-1) + + if cmdline_args.config_file is not None: + x2gobroker.defaults.X2GOBROKER_CONFIG = cmdline_args.config_file + + x2gobroker.defaults.X2GOBROKER_DEBUG = cmdline_args.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 + +try: + exec("import x2gobroker.brokers.{backend}_broker as _backend".format(backend=cmdline_args.backend)) +except ImportError: + p.print_help() + print + print "*** No such backend: {backend} or backend not enabled... ***".format(backend=cmdline_args.backend) + print + sys.exit(-1) + + +def check_password(environ, username, password): + return _backend.X2GoBroker(config_file=config_file, config_defaults=config_defaults)._do_authenticate(username=username, password=password) + +if __name__ == "__main__": + + if check_password(os.environ, username, password): + print "authentication succeeded" + sys.exit(0) + else: + print "authentication failed" + sys.exit(-1) diff --git a/debian/changelog b/debian/changelog index b988850..79326c5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,7 @@ x2gobroker (0.0.1.1-0~x2go1) UNRELEASED; urgency=low - Move AuthService server code fully into x2gobroker-authservice daemon script. - Add forgotten file: x2gobroker-authservice-logger.conf. (Fixes: #180). + - Add script: x2gobroker-testauth. * /debian/control: + Fix --root parameter in DEB_PYTHON_INSTALL_ARGS. + Let bin:package x2gobroker-authservice depend on python-x2gobroker (of the diff --git a/debian/x2gobroker.install b/debian/x2gobroker.install index 693dad3..adad505 100644 --- a/debian/x2gobroker.install +++ b/debian/x2gobroker.install @@ -1,2 +1,3 @@ +bin/x2gobroker-testauth usr/bin/ sbin/x2gobroker usr/sbin/ -sbin/x2gobroker-keygen usr/sbin/ \ No newline at end of file +sbin/x2gobroker-keygen usr/sbin/ 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).