The branch, master has been updated via 428601765689aafc634b6be05b4619e7583cf2e6 (commit) via fd53c4a42a79daf8dd3dc209dea8a475599beed6 (commit) via f23bc42116e94fc7893668f247363d753cc9fd77 (commit) from 679f5a07c67afada94887db1c009458107e00209 (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 428601765689aafc634b6be05b4619e7583cf2e6 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Mar 2 15:35:05 2013 +0100 rename session autostart to session autologin, use same terminology as in X2Go Client commit fd53c4a42a79daf8dd3dc209dea8a475599beed6 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Mar 2 15:30:59 2013 +0100 more testing on the session autostart feature commit f23bc42116e94fc7893668f247363d753cc9fd77 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Mar 2 15:30:26 2013 +0100 fixup for failing tests, related to earlier class renamings ----------------------------------------------------------------------- Summary of changes: etc/broker/x2gobroker-sessionprofiles.conf | 8 +++--- etc/x2gobroker.conf | 8 +++--- x2gobroker/agent.py | 1 - x2gobroker/brokers/base_broker.py | 39 ++++++++++++++------------- x2gobroker/defaults.py | 2 +- x2gobroker/tests/test_web_plain_base.py | 14 +++++++--- x2gobroker/tests/test_web_plain_inifile.py | 6 ++--- x2gobroker/tests/test_web_plain_zeroconf.py | 6 ++--- x2gobroker/web/plain.py | 1 - 9 files changed, 46 insertions(+), 39 deletions(-) The diff of changes is: diff --git a/etc/broker/x2gobroker-sessionprofiles.conf b/etc/broker/x2gobroker-sessionprofiles.conf index af3dfc2..dc79a6b 100644 --- a/etc/broker/x2gobroker-sessionprofiles.conf +++ b/etc/broker/x2gobroker-sessionprofiles.conf @@ -92,7 +92,7 @@ acl-groups-deny=ALL acl-clients-deny=ALL acl-clients-allow=10.1.0.0/16 acl-any-order=deny-allow -broker-session-autostart=true +broker-session-autologin=true [pool-A-server-B] user= @@ -104,7 +104,7 @@ acl-groups-deny=ALL acl-clients-deny=ALL acl-clients-allow=10.2.0.0/16 acl-any-order=deny-allow -broker-session-autostart=true +broker-session-autologin=true [pool-A-server-C] user= @@ -114,7 +114,7 @@ command=KDE acl-groups-allow=kde-users,admins acl-groups-deny=ALL acl-any-order=deny-allow -broker-session-autostart=true +broker-session-autologin=true ## ## EXAMPLE: pool-B (e.g. webserver in the DMZ or on the internet) @@ -174,5 +174,5 @@ acl-groups-allow=students,admins acl-groups-deny=ALL acl-any-order=deny-allow # this server pool has a special broker setup for SSH authorized_keys -broker-session-autostart=true +broker-session-autologin=true broker-authorized-keys=/var/lib/x2gobroker/ssh/%u/authorized_keys diff --git a/etc/x2gobroker.conf b/etc/x2gobroker.conf index 6ccb3d3..24a530f 100644 --- a/etc/x2gobroker.conf +++ b/etc/x2gobroker.conf @@ -90,7 +90,7 @@ # detection can be quite CPU intensive on the X2Go Broker server. #ignore-primary-group-memberships = true -# X2Go auto-start sessions via X2Go Session Broker +# X2Go session autologin via X2Go Session Broker # # Once authenticated against the session # broker, the user becomes a trusted user. That is, the X2Go session login can @@ -99,11 +99,11 @@ # immediately. # # This option can be overridden by the session profile parameter -# broker-session-autostart=<file-location> +# broker-session-autologin=<file-location> -#default-session-autostart=false +#default-session-autologin=false -# X2Go's authorized_keys file for broker mediated auto-starting sessions +# X2Go's authorized_keys file for broker mediated autologin sessions # # For the X2Go auto-login via X2Go Session Broker feature to work thoroughly, # the X2Go Session Broker has to place the temporary public SSH key into the diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py index 1b19170..ad2a989 100644 --- a/x2gobroker/agent.py +++ b/x2gobroker/agent.py @@ -101,7 +101,6 @@ def call_remote_broker_agent(username, mode, cmdline_args=[], remote_agent=None) if ssh_transport.is_authenticated(): cmd = ' '.join(cmd_line) cmd = 'sh -c \"{cmd}\"'.format(cmd=cmd) - print cmd (stdin, stdout, stderr) = client.exec_command(cmd) result = stdout.read().split('\n') client.close() diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py index 8426bd1..4bfd39f 100644 --- a/x2gobroker/brokers/base_broker.py +++ b/x2gobroker/brokers/base_broker.py @@ -464,27 +464,27 @@ class X2GoBroker(object): return unicode(_agent_query_mode) or unicode(_default_agent_query_mode) - def use_session_autostart(self, profile_id): + def use_session_autologin(self, profile_id): """\ - Detect if the given profile is configured to try session - auto-starting. + Detect if the given profile is configured to try automatic session + logons. - @return: C{True} to denote that session auto-starting should be attempted + @return: C{True} to denote that automatic session login should be attempted @rtype: C{bool} """ - _default_session_autostart = False - _session_autostart = False + _default_session_autologin = False + _session_autologin = False _profile = self.get_profile_broker(profile_id) - if _profile and _profile.has_key(u'broker-session-autostart') and _profile['broker-session-autostart']: - _session_autostart = _profile[u'broker-session-autostart'] - logger_broker.debug('base_broker.X2GoBroker.get_session_autostart(): found broker-session-autostart in session profile with ID {id}: {value}. This one has precendence over the default value.'.format(id=profile_id, value=_session_autostart)) + if _profile and _profile.has_key(u'broker-session-autologin') and _profile['broker-session-autologin']: + _session_autologin = _profile[u'broker-session-autologin'] + logger_broker.debug('base_broker.X2GoBroker.get_session_autologin(): found broker-session-autologin in session profile with ID {id}: {value}. This one has precendence over the default value.'.format(id=profile_id, value=_session_autologin)) - elif self.config.has_value('global', 'default-session-autostart'): - _default_session_autostart = self.config.get_value('global', 'default-session-autostart') - logger_broker.debug('base_broker.X2GoBroker.get_session_autostart(): found default-session-autostart in global config section: {value}'.format(value=_default_session_autostart)) + elif self.config.has_value('global', 'default-session-autologin'): + _default_session_autologin = self.config.get_value('global', 'default-session-autologin') + logger_broker.debug('base_broker.X2GoBroker.get_session_autologin(): found default-session-autologin in global config section: {value}'.format(value=_default_session_autologin)) - return _session_autostart or _default_session_autostart + return _session_autologin or _default_session_autologin def get_authorized_keys_file(self, profile_id): """\ @@ -776,6 +776,10 @@ class X2GoBroker(object): list_of_profiles = {} for profile_id in self.get_profile_ids(): profile = self.get_profile(profile_id) + + if self.use_session_autologin(profile_id): + profile['autologin'] = True + acls = self.get_profile_acls(profile_id) if self.check_profile_acls(username, acls): @@ -783,7 +787,7 @@ class X2GoBroker(object): return list_of_profiles - def select_session(self, profile_id, username): + def select_session(self, profile_id, username=None): """\ Start/resume a session by selecting a profile name offered by the X2Go client. @@ -809,7 +813,7 @@ class X2GoBroker(object): remote_agent_port = profile[u'sshport'] remote_agent = {u'hostname': remote_agent_server, u'port': remote_agent_port, } - if len(server_list) >= 2: + if len(server_list) >= 2 and username: busy_servers = x2gobroker.agent.find_busy_servers(username=username, query_mode=agent_query_mode, remote_agent = remote_agent) @@ -819,7 +823,6 @@ class X2GoBroker(object): busy_server_list = [ (load, server) for server, load in busy_servers.items() ] busy_server_list.sort() - print busy_server_list best_server = busy_server_list[0][1] @@ -846,8 +849,8 @@ class X2GoBroker(object): 'session_info': session_info, }) - # session auto-start feature - if self.use_session_autostart(profile_id): + # session autologin feature + if self.use_session_autologin(profile_id): # FIXME: we somehow have to find out about the username of the person at the broker client-side... # using the username used for broker login for now... diff --git a/x2gobroker/defaults.py b/x2gobroker/defaults.py index 4e52156..cfc7372 100644 --- a/x2gobroker/defaults.py +++ b/x2gobroker/defaults.py @@ -124,7 +124,7 @@ X2GOBROKER_CONFIG_DEFAULTS = { u'default-user-db': u'libnss', u'default-group-db': u'libnss', u'ignore-primary-group-memberships': True, - u'default-session-autostart': False, + u'default-session-autologin': False, u'default-authorized-keys': u'%h/.x2go/authorized_keys', u'default-agent-query-mode': u'LOCAL', }, diff --git a/x2gobroker/tests/test_web_plain_base.py b/x2gobroker/tests/test_web_plain_base.py index a31850f..74953ff 100644 --- a/x2gobroker/tests/test_web_plain_base.py +++ b/x2gobroker/tests/test_web_plain_base.py @@ -21,13 +21,13 @@ import unittest import tempfile from paste.fixture import TestApp from nose.tools import * +import web # Python X2GoBroker modules import x2gobroker.defaults +import x2gobroker.web.plain -from x2gobroker.web.plain import * - -urls = ( '/plain/(.*)', 'X2GoBrokerWebPlain',) +urls = ( '/plain/(.*)', 'x2gobroker.web.plain.X2GoBrokerWeb',) app = web.application(urls, globals()) class TestX2GoBrokerWebPlainBase(unittest.TestCase): @@ -43,6 +43,7 @@ enable = false tf = tempfile.NamedTemporaryFile() print >> tf, _config tf.seek(0) + _cf_bak = x2gobroker.defaults.X2GOBROKER_CONFIG x2gobroker.defaults.X2GOBROKER_CONFIG = tf.name testApp = TestApp(app.wsgifunc(*middleware)) r = testApp.get('/plain/base/', expect_errors=True) @@ -60,7 +61,7 @@ enable = true r = testApp.get('/plain/base/', expect_errors=True) assert_equal(r.status, 401) tf.close() - + x2gobroker.defaults.X2GOBROKER_CONFIG = _cf_bak ### TEST RESPONSE: simple authentication (check_access) @@ -77,10 +78,12 @@ auth-mech = testsuite tf = tempfile.NamedTemporaryFile() print >> tf, _config tf.seek(0) + _cf_bak = x2gobroker.defaults.X2GOBROKER_CONFIG x2gobroker.defaults.X2GOBROKER_CONFIG = tf.name r = testApp.get('/plain/base/', params={'user': 'test', 'password': 'sweet', }, expect_errors=True) assert_equal(r.status, 200) r.mustcontain('Access granted') + x2gobroker.defaults.X2GOBROKER_CONFIG = _cf_bak ### TEST TASK: listsessions (nothing should be returned for the base backend) @@ -94,6 +97,7 @@ auth-mech = testsuite tf = tempfile.NamedTemporaryFile() print >> tf, _config tf.seek(0) + _cf_bak = x2gobroker.defaults.X2GOBROKER_CONFIG x2gobroker.defaults.X2GOBROKER_CONFIG = tf.name testApp = TestApp(app.wsgifunc(*middleware)) r = testApp.get('/plain/base/', params={'user': 'test', 'password': 'sweet', 'task': 'listsessions', }, expect_errors=True) @@ -105,6 +109,8 @@ auth-mech = testsuite r.mustcontain(no='<br>',) r.mustcontain(no='<BR />', ) r.mustcontain(no='<br />', ) + x2gobroker.defaults.X2GOBROKER_CONFIG = _cf_bak + def test_suite(): diff --git a/x2gobroker/tests/test_web_plain_inifile.py b/x2gobroker/tests/test_web_plain_inifile.py index e957ed7..114e73f 100644 --- a/x2gobroker/tests/test_web_plain_inifile.py +++ b/x2gobroker/tests/test_web_plain_inifile.py @@ -21,13 +21,13 @@ import unittest import tempfile from paste.fixture import TestApp from nose.tools import * +import web # Python X2GoBroker modules import x2gobroker.defaults +import x2gobroker.web.plain -from x2gobroker.web.plain import * - -urls = ( '/plain/(.*)', 'X2GoBrokerWebPlain',) +urls = ( '/plain/(.*)', 'x2gobroker.web.plain.X2GoBrokerWeb',) app = web.application(urls, globals()) x2gobroker.defaults.X2GOBROKER_CONFIG_DEFAULTS.update({'base': {'enable': True, },}) diff --git a/x2gobroker/tests/test_web_plain_zeroconf.py b/x2gobroker/tests/test_web_plain_zeroconf.py index 53fe01e..c258646 100644 --- a/x2gobroker/tests/test_web_plain_zeroconf.py +++ b/x2gobroker/tests/test_web_plain_zeroconf.py @@ -21,13 +21,13 @@ import unittest import tempfile from paste.fixture import TestApp from nose.tools import * +import web # Python X2GoBroker modules import x2gobroker.defaults +import x2gobroker.web.plain -from x2gobroker.web.plain import * - -urls = ( '/plain/(.*)', 'X2GoBrokerWebPlain',) +urls = ( '/plain/(.*)', 'x2gobroker.web.plain.X2GoBrokerWeb',) app = web.application(urls, globals()) class TestX2GoBrokerWebPlainZeroconf(unittest.TestCase): diff --git a/x2gobroker/web/plain.py b/x2gobroker/web/plain.py index 9ec4321..c9fd55b 100644 --- a/x2gobroker/web/plain.py +++ b/x2gobroker/web/plain.py @@ -143,7 +143,6 @@ class X2GoBrokerWeb: output += "END_USER_SESSIONS\n" - elif task == 'selectsession': if profile_id: 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).