This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2gobroker. from b20add1 Fix privilege check for the broker daemon's log directory. new c54d671 fix evoking x2gobroker-daemon-debug new 5002147 fix too-long-lines in changelog new 2d00253 debian/control: Bump Standards: to 3.9.6. No changes needed. new b4b694e debian/x2gobroker-wsgi.*inst: Pass $@ to our apacheconf_configure, apacheconf_remove functions to not break apache2-maintscript-helper. new bae0d29 Enable basic/random load-balancing for UCCS broker frontend. Make UCCS frontend aware of host session profile options of the form "host=<fqdn> (<ipaddr>:<port>). The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: bin/x2gobroker | 4 +- bin/x2gobroker-ssh | Bin 10461 -> 10328 bytes debian/changelog | 20 ++++-- debian/control | 2 +- debian/x2gobroker-wsgi.postinst | 2 +- debian/x2gobroker-wsgi.postrm | 2 +- x2gobroker/brokers/base_broker.py | 123 +++++++++++++++++++++++++------------ x2gobroker/web/uccs.py | 27 +++++--- 8 files changed, 120 insertions(+), 60 deletions(-) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit c54d6711f52e82079ac51bddac2fe43cf903642f Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Nov 28 09:11:21 2014 +0100 fix evoking x2gobroker-daemon-debug --- bin/x2gobroker | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/x2gobroker b/bin/x2gobroker index af7aaf9..1f9d4be 100755 --- a/bin/x2gobroker +++ b/bin/x2gobroker @@ -94,7 +94,7 @@ except ImportError: from x2gobroker import __VERSION__ from x2gobroker import __AUTHOR__ -from x2gobroker.loggers import logger_broker, logger_access, logger_error, tornado_log_request +from x2gobroker.loggers import logger_broker, logger_access, logger_error, tornado_log_request, PROG_NAME from x2gobroker.utils import drop_privileges, split_host_address interactive_mode_warning = False @@ -176,7 +176,7 @@ if __name__ == "__main__": sys.exit(-1) ### SSH broker - elif cmdline_args.mode.upper() == 'SSH': + elif cmdline_args.mode.upper() == 'SSH' and not PROG_NAME == 'x2gobroker-daemon': if cmdline_args.bind: logger_broker.warn('ignoring non-valid option --bind for broker mode SSH...') if cmdline_args.daemonize: logger_broker.warn('ignoring non-valid option --daemonize for broker mode SSH...') if cmdline_args.profile_id and cmdline_args.task != 'selectsession': -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 2d00253c97284a1a3ea0d4b9ff16f02dc73a9bb9 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Nov 28 14:38:45 2014 +0100 debian/control: Bump Standards: to 3.9.6. No changes needed. --- debian/changelog | 1 + debian/control | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7552042..81890ad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -209,6 +209,7 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low breaks, so that we now have lines that are close to 80 chars long. + Make x2gobroker-daemon a symlink and recognize HTTP mode by the executable's name. + + Bump Standards: to 3.9.6. No changes needed. * debian/x2gobroker-agent.dirs: + Provide empty log file directory. * x2gobroker-wsgi postinst/postrm: diff --git a/debian/control b/debian/control index 772f36e..fcbc4f0 100644 --- a/debian/control +++ b/debian/control @@ -14,7 +14,7 @@ Build-Depends: python-setuptools, python-nose, python-paste, -Standards-Version: 3.9.4 +Standards-Version: 3.9.6 XS-Python-Version: >= 2.6 Package: python-x2gobroker -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 5002147d54bfd27dca66d0fd36413243d2a8426b Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Nov 28 14:37:20 2014 +0100 fix too-long-lines in changelog --- debian/changelog | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index ca36b19..7552042 100644 --- a/debian/changelog +++ b/debian/changelog @@ -163,7 +163,8 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low - Update copyright holders. Copyright is held only by people who actually contributed to the current code base. - logrotate configs: Rotated logs via "su x2gobroker adm". - - Use hostname as hard-coded in server_list (from session profile configuration), + - Use hostname as hard-coded in server_list (from session profile + configuration), don't try to strip off the domain name. - Consolidate x2gobroker.utils.split_host_address() with a test and rewrite completely. @@ -257,11 +258,12 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low (Fixes: #469). - Add ability to have script run in select session after server is selected. - - Add basic support for pulling https_get authmech config from configuration - file. (Fixes: #470). - - Fix typos and host/port mixups in the remote_sshproxy logic. (Fixes: #544). - - Make sure find_busy_servers in agent.py returns a tuple (recent API change) - to not break profiles with multiple servers. (Fixes: #545). + - Add basic support for pulling https_get authmech config from + configuration file. (Fixes: #470). + - Fix typos and host/port mixups in the remote_sshproxy logic. (Fixes: + #544). + - Make sure find_busy_servers in agent.py returns a tuple (recent API + change) to not break profiles with multiple servers. (Fixes: #545). - On session resumption take profile's host list into account. Don't resume sessions the profile has not been configured for. (Fixes: #553). -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit b4b694e31087801cb815c6616968822ed6f8f217 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Nov 28 14:48:28 2014 +0100 debian/x2gobroker-wsgi.*inst: Pass $@ to our apacheconf_configure, apacheconf_remove functions to not break apache2-maintscript-helper. --- debian/changelog | 2 ++ debian/x2gobroker-wsgi.postinst | 2 +- debian/x2gobroker-wsgi.postrm | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 81890ad..4659fe8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -217,6 +217,8 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low Apache2.4 / Apache2.2. + On package purgal: Disable Apache2 config first and then attempt the removal of the x2gobroker user/group. + + Pass $@ to our apacheconf_configure, apacheconf_remove functions to not + break apache2-maintscript-helper. * debian/*.postinst: + Assure that the log directory always exists (no matter what combination of packages got installed). diff --git a/debian/x2gobroker-wsgi.postinst b/debian/x2gobroker-wsgi.postinst index c0b0c8a..e7f49f3 100755 --- a/debian/x2gobroker-wsgi.postinst +++ b/debian/x2gobroker-wsgi.postinst @@ -77,7 +77,7 @@ case "$1" in touch /var/log/x2gobroker/error.log && chown x2gobroker:adm /var/log/x2gobroker/error.log touch /var/log/x2gobroker/wsgi.log && chown x2gobroker:adm /var/log/x2gobroker/wsgi.log - apacheconf_configure + apacheconf_configure $@ ;; diff --git a/debian/x2gobroker-wsgi.postrm b/debian/x2gobroker-wsgi.postrm index 7269db7..4c7c120 100755 --- a/debian/x2gobroker-wsgi.postrm +++ b/debian/x2gobroker-wsgi.postrm @@ -53,7 +53,7 @@ case "$1" in ;; remove) - apacheconf_remove + apacheconf_remove $@ ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit bae0d29c2fd7cb317f39271590aa5f82619a21b9 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Nov 28 15:00:39 2014 +0100 Enable basic/random load-balancing for UCCS broker frontend. Make UCCS frontend aware of host session profile options of the form "host=<fqdn> (<ipaddr>:<port>). --- bin/x2gobroker-ssh | Bin 10461 -> 10328 bytes debian/changelog | 3 + x2gobroker/brokers/base_broker.py | 123 +++++++++++++++++++++++++------------ x2gobroker/web/uccs.py | 27 +++++--- 4 files changed, 104 insertions(+), 49 deletions(-) diff --git a/bin/x2gobroker-ssh b/bin/x2gobroker-ssh index 03444ca..10f24a3 100755 Binary files a/bin/x2gobroker-ssh and b/bin/x2gobroker-ssh differ diff --git a/debian/changelog b/debian/changelog index 4659fe8..edd9382 100644 --- a/debian/changelog +++ b/debian/changelog @@ -199,6 +199,9 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low - Properly set (/var)/run/x2gobroker directory permissions when started via systemd. - Fix privilege check for the broker daemon's log directory. + - Enable basic/random load-balancing for UCCS broker frontend. Make UCCS + frontend aware of host session profile options of the form + "host=<fqdn> (<ipaddr>:<port>). * debian/control: + Provide separate bin:package for SSH brokerage: x2gobroker-ssh. + Replace LDAP support with session brokerage support in LONG_DESCRIPTION. diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py index fc5082c..880e1d7 100644 --- a/x2gobroker/brokers/base_broker.py +++ b/x2gobroker/brokers/base_broker.py @@ -243,6 +243,19 @@ class X2GoBroker(object): """ return [] + def get_profile_ids_for_user(self, username): + """\ + Retrieve the list of session profile IDs for a given user. + + @param username: query profile id list for this user + @type username: C{unicode} + + @return: list of profile IDs + @rtype: C{list} + + """ + return [ id for id in self.get_profile_ids() if self.check_profile_acls(username, self.get_profile_acls(id)) ] + def get_profile_defaults(self): """\ Get the session profile defaults, i.e. profile options that all @@ -992,23 +1005,41 @@ class X2GoBroker(object): return remote_agent - def list_profiles(self, username): + def get_profile_for_user(self, profile_id, username, broker_frontend=None): """\ - Retrieve a list of available session profiles for the authenticated user. - - @param username: query session list for this user + Expect a profile id and perform some checks and preparations to + make it ready for exporting to a broker client: + + - drop internal host=<hostname> and sshport=<port> keys from the + profile, broker clients cannot handle those + - replace BROKER_USER by the name of the authenticated user + - test if autologin is possible + - fix rootless session profile option for non-desktop sessions + - perform an ACL check (return C{None} if it fails) + - query a remote agent (if configured) to check if we have + running / suspended sessions on the remote X2Go Server + + @param profile_id: ID of a valid session profile + @type profile_id: C{unicode} + @param username: prepare session profile for this (authenticated) user @type username: C{unicode} + @param broker_frontend: some broker frontend (e.g. UCCS) require special treatment + by this method + @type broker_frontend: C{unicode} - return: list of profile dictionaries + return: session profile as a dictionary (ready for sending out to a broker client) rtype: C{dict} """ - list_of_profiles = {} - for profile_id in self.get_profile_ids(): - profile = self.get_profile(profile_id) + profile = self.get_profile(profile_id) + + acls = self.get_profile_acls(profile_id) + if self.check_profile_acls(username, acls): for key in profile.keys(): - if key.startswith('host='): + if key.startswith('host=') and broker_frontend != 'uccs': + del profile[key] + if key.startswith('sshport=') and broker_frontend != 'uccs': del profile[key] if key == 'user' and profile[key] == 'BROKER_USER': profile[key] = unicode(username) @@ -1021,40 +1052,54 @@ class X2GoBroker(object): if profile['command'] in x2gobroker.defaults.X2GO_DESKTOP_SESSIONS: profile['rootless'] = False - acls = self.get_profile_acls(profile_id) + remote_agent = self.get_remote_agent(profile_id) + agent_query_mode = ( remote_agent == u'LOCAL') and u'LOCAL' or u'SSH' + if remote_agent: + success, running_sessions, suspended_sessions = x2gobroker.agent.has_sessions(username, remote_agent=remote_agent) + try: + success, running_sessions, suspended_sessions = x2gobroker.agent.has_sessions(username, remote_agent=remote_agent) + if running_sessions: + logger_broker.debug('base_broker.X2GoBroker.list_profiles(): found running sessions on host(s): {hosts}'.format(hosts=', '.join(running_sessions))) + if suspended_sessions: + logger_broker.debug('base_broker.X2GoBroker.list_profiles(): found running sessions on host(s): {hosts}'.format(hosts=', '.join(suspended_sessions))) + suspended_matching_hostnames = x2gobroker.utils.matching_hostnames(profile['host'], suspended_sessions) + running_matching_hostnames = x2gobroker.utils.matching_hostnames(profile['host'], running_sessions) + if suspended_matching_hostnames: + profile['status'] = u'S' + profile['host'] = [suspended_matching_hostnames[0]] + elif running_matching_hostnames: + profile['status'] = u'R' + profile['host'] = [running_matching_hostnames[0]] + else: + profile['host'] = [profile['host'][0]] + + if profile.has_key('status') and profile['status']: + logger_broker.debug('base_broker.X2GoBroker.list_profiles(): marking session profile {name} as {status}'.format(name=profile['name'], status=profile['status'])) - if self.check_profile_acls(username, acls): + except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException: + pass + else: + profile['host'] = [profile['host'][0]] - remote_agent = self.get_remote_agent(profile_id) - agent_query_mode = ( remote_agent == u'LOCAL') and u'LOCAL' or u'SSH' - if remote_agent: + return profile + else: + return None - success, running_sessions, suspended_sessions = x2gobroker.agent.has_sessions(username, remote_agent=remote_agent) - try: - success, running_sessions, suspended_sessions = x2gobroker.agent.has_sessions(username, remote_agent=remote_agent) - if running_sessions: - logger_broker.debug('base_broker.X2GoBroker.list_profiles(): found running sessions on host(s): {hosts}'.format(hosts=', '.join(running_sessions))) - if suspended_sessions: - logger_broker.debug('base_broker.X2GoBroker.list_profiles(): found running sessions on host(s): {hosts}'.format(hosts=', '.join(suspended_sessions))) - suspended_matching_hostnames = x2gobroker.utils.matching_hostnames(profile['host'], suspended_sessions) - running_matching_hostnames = x2gobroker.utils.matching_hostnames(profile['host'], running_sessions) - if suspended_matching_hostnames: - profile['status'] = u'S' - profile['host'] = [suspended_matching_hostnames[0]] - elif running_matching_hostnames: - profile['status'] = u'R' - profile['host'] = [running_matching_hostnames[0]] - else: - profile['host'] = [profile['host'][0]] - - if profile.has_key('status') and profile['status']: - logger_broker.debug('base_broker.X2GoBroker.list_profiles(): marking session profile {name} as {status}'.format(name=profile['name'], status=profile['status'])) - - except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException: - pass - else: - profile['host'] = [profile['host'][0]] + def list_profiles(self, username): + """\ + Retrieve a list of available session profiles for the authenticated user. + + @param username: query session profile list for this user + @type username: C{unicode} + return: list of profile dictionaries + rtype: C{dict} + + """ + list_of_profiles = {} + for profile_id in self.get_profile_ids_for_user(username): + profile = self.get_profile_for_user(profile_id, username) + if profile: list_of_profiles.update({profile_id: profile, }) return list_of_profiles diff --git a/x2gobroker/web/uccs.py b/x2gobroker/web/uccs.py index dd138e1..deea684 100644 --- a/x2gobroker/web/uccs.py +++ b/x2gobroker/web/uccs.py @@ -21,6 +21,7 @@ import re import base64 import datetime import types +import random import tornado.web # Python X2Go Broker modules @@ -141,33 +142,39 @@ class X2GoBrokerWebAPI(tornado.web.RequestHandler): output = '' - profiles = self.broker_backend.list_profiles(username) + profile_ids = self.broker_backend.get_profile_ids_for_user(username) urlbase = self.broker_backend.get_global_value('my-uccs-url-base').rstrip('/') ms = x2gobroker.uccsjson.ManagementServer('{urlbase}/uccs/{backend}/'.format(urlbase=urlbase, backend=backend), 'X2Go Session Broker') - profile_ids = profiles.keys() profile_ids.sort() for profile_id in profile_ids: - hosts = profiles[profile_id][u'host'] + profile = self.broker_backend.get_profile_for_user(profile_id, username, broker_frontend='uccs') + hosts = profile[u'host'] if type(hosts) == types.UnicodeType: hosts = [hosts] - if profiles[profile_id][u'directrdp']: + if profile[u'directrdp']: ts = x2gobroker.uccsjson.RDPServer( host='{hostname}'.format(hostname=hosts[0]), - name=profiles[profile_id][u'name'], - username=profiles[profile_id][u'user'], + name=profile[u'name'], + username=profile[u'user'], ) ts.set_domain('LOCAL') else: + _hostname = random.choice(hosts) + _port = profile[u'sshport'] + if profile.has_key('sshport={hostname}'.format(hostname=_hostname)): + _port = profile['sshport={hostname}'.format(hostname=_hostname)] + if profile.has_key('host={hostname}'.format(hostname=_hostname)): + _hostname = profile['host={hostname}'.format(hostname=_hostname)] ts = x2gobroker.uccsjson.X2GoServer( - host='{hostname}:{port}'.format(hostname=hosts[0], port=profiles[profile_id][u'sshport']), - name=profiles[profile_id][u'name'], - username=profiles[profile_id][u'user'], + host='{hostname}:{port}'.format(hostname=_hostname, port=_port), + name=profile[u'name'], + username=profile[u'user'], ) - ts.set_session_type(profiles[profile_id]['command']) + ts.set_session_type(profile['command']) ms.add_terminalserver(ts) ms.set_default(ts.Name) -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git