This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2gobroker. from b972d96 more work/testing on x2gobroker-testagent new 14ac0d8 update man page x2gobroker-testauth new d85a879 broker agent: avoid one option system() calls in Perl. new 7cfda4d x2gobroker-testauth: handle extra arguments The 3 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: debian/changelog | 1 + lib/x2gobroker-agent.pl | 20 ++++++++++---------- man/man1/x2gobroker-testauth.1 | 7 ++++--- sbin/x2gobroker-testagent | 15 +++++++++++---- x2gobroker/agent.py | 16 ++++++++-------- 5 files changed, 34 insertions(+), 25 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 7cfda4d1acb114419bf8ea647955febaffe15dc7 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Mar 19 01:14:47 2014 +0100 x2gobroker-testauth: handle extra arguments --- debian/changelog | 1 + sbin/x2gobroker-testagent | 15 +++++++++++---- x2gobroker/agent.py | 16 ++++++++-------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/debian/changelog b/debian/changelog index 45b89b8..a9b3ccb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -101,6 +101,7 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low - Provide tool: x2gobroker-testagent. - Allow for broker clients to send in public SSH keys that the client may use for authentication to X2Go Servers. + - broker agent: avoid one option system() calls in Perl. * debian/control: + Replace LDAP support with session brokerage support in LONG_DESCRIPTION. + Fix SYNOPSIS texts. diff --git a/sbin/x2gobroker-testagent b/sbin/x2gobroker-testagent index eef96a8..e09c81f 100755 --- a/sbin/x2gobroker-testagent +++ b/sbin/x2gobroker-testagent @@ -111,8 +111,8 @@ query_mode = local_agent and 'LOCAL' or 'SSH' if local_agent: remote_agent = None else: remote_agent = {'hostname': hostname, 'port': port, } -def call_agent(task): - return agent_client_tasks[task](username=username, query_mode=query_mode, remote_agent=remote_agent) +def call_agent(task, **kwargs): + return agent_client_tasks[task](username=username, query_mode=query_mode, remote_agent=remote_agent, **kwargs) if __name__ == "__main__": @@ -149,6 +149,13 @@ if __name__ == "__main__": except KeyError: print " {task_name}: not supported by this broker version".format(task_name=task) print - sys.exit(0) + sys.exit(0); - call_agent(task) + kwargs = {} + if task == 'addauthkey': + pubkey, privvkey = x2gobroker.agent.genkeypair(local_username=username, client_address="localhost") + kwargs.update({ + 'pubkey_hash': pubkey, + }) + + print "\n".join(call_agent(task, **kwargs)) diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py index 7d0baca..0840023 100644 --- a/x2gobroker/agent.py +++ b/x2gobroker/agent.py @@ -200,7 +200,7 @@ def icmp_ping(hostname): return True -def ping(query_mode='LOCAL', remote_agent=None): +def ping(query_mode='LOCAL', remote_agent=None, **kwargs): """\ Ping X2Go Broker Agent. @@ -239,7 +239,7 @@ def list_sessions(username, query_mode='LOCAL', remote_agent=None): tasks['listsessions'] = list_sessions -def suspend_session(username, session_name, query_mode='LOCAL', remote_agent=None): +def suspend_session(username, session_name, query_mode='LOCAL', remote_agent=None, **kwargs): """\ Trigger a session suspensions via the X2Go Broker Agent. @@ -258,7 +258,7 @@ def suspend_session(username, session_name, query_mode='LOCAL', remote_agent=Non tasks['suspendsession'] = suspend_session -def terminate_session(username, session_name, query_mode='LOCAL', remote_agent=None): +def terminate_session(username, session_name, query_mode='LOCAL', remote_agent=None, **kwargs): """\ Trigger a session termination via the X2Go Broker Agent. @@ -297,7 +297,7 @@ def has_sessions(username, query_mode='LOCAL', remote_agent=None): return ([ s.split('|')[3] for s in _session_list if s.split('|')[4] == 'R' ], [ s.split('|')[3] for s in _session_list if s.split('|')[4] == 'S' ]) -def find_busy_servers(username, query_mode='LOCAL', remote_agent=None): +def find_busy_servers(username, query_mode='LOCAL', remote_agent=None, **kwargs): """\ Query X2Go Broker Agent for a list of servers with running and/or suspended sessions and a percentage that tells about @@ -330,7 +330,7 @@ def find_busy_servers(username, query_mode='LOCAL', remote_agent=None): tasks['findbusyservers'] = find_busy_servers -def add_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/authorized_keys', query_mode='LOCAL', remote_agent=None): +def add_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/authorized_keys', query_mode='LOCAL', remote_agent=None, **kwargs): """\ Add a public key hash to the user's authorized_keys file. @@ -353,7 +353,7 @@ def add_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/aut tasks['addauthkey'] = add_authorized_key -def delete_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/authorized_keys', query_mode='LOCAL', remote_agent=None, delay_deletion=0): +def delete_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/authorized_keys', query_mode='LOCAL', remote_agent=None, delay_deletion=0, **kwargs): """\ Remove a public key hash from the user's authorized_keys file. @@ -386,7 +386,7 @@ def delete_authorized_key(username, pubkey_hash, authorized_keys_file='%h/.x2go/ tasks['delauthkey'] = delete_authorized_key -def get_servers(username, query_mode='LOCAL', remote_agent=None): +def get_servers(username, query_mode='LOCAL', remote_agent=None, **kwargs): """\ Query X2Go Broker Agent for the list of currently used servers. @@ -407,7 +407,7 @@ def get_servers(username, query_mode='LOCAL', remote_agent=None): tasks['getservers'] = get_servers -def tasks_available(username, query_mode='LOCAL', remote_agent=None): +def tasks_available(username, query_mode='LOCAL', remote_agent=None, **kwargs): """\ Query X2Go Broker Agent for the list of available tasks. -- 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 d85a8799817c6ba5c8c58a488c9f53eb72c8a60c Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Mar 19 01:14:27 2014 +0100 broker agent: avoid one option system() calls in Perl. --- lib/x2gobroker-agent.pl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl index ee359bf..02a4b33 100755 --- a/lib/x2gobroker-agent.pl +++ b/lib/x2gobroker-agent.pl @@ -80,12 +80,12 @@ sub AddAuthKey } # make sure dir and file for authorized_keys do exist - system ("su - $uid -c \"mkdir -p $authkeydir\""); - system ("su - $uid -c \"touch $authkeyfile\""); - my $authorized_keys = `su - $uid -c \"cat $authkeyfile\"`; + system ("sudo", "-u", "$uid", "--", "mkdir", "-p", "$authkeydir"); + system ("sudo", "-u", "$uid", "--", "touch", "$authkeyfile"); + my $authorized_keys = `sudo -u $uid -- "cat $authkeyfile"`; if ( ! ( $authorized_keys =~ m/$pubkey/ ) ) { - system("su - $uid -c \"echo $pubkey >> $authkeyfile\""); + system("sudo", "-u", "$uid", "--", "echo $pubkey >> $authkeyfile"); } } @@ -101,7 +101,7 @@ sub DelAuthKey { $authkeyfile = "$home/$authkeyfile"; } - system("su - $uid -c \"sed -e s\!'$pubkey'\!''\! -e '/^\$/d' -i $authkeyfile\" 1>/dev/null 2>/dev/null"); + system("sudo", "-u", "$uid", "--", "sed -e s\!'$pubkey'\!''\! -e '/^\$/d' -i $authkeyfile 1>/dev/null 2>/dev/null"); } $< = $>; @@ -138,7 +138,7 @@ if($mode eq 'listsessions') { InitX2GoUser($uid, $uidNumber, $gidNumber, $home); print "OK\n"; - exec ("/bin/su - $uid -c \"x2golistsessions --all-servers\""); + system("sudo", "-u", "$uid", "--", "x2golistsessions", "--all-servers"); } if( ($mode eq 'findbusyservers_by_sessionstats') || ($mode eq 'findbusyservers')) @@ -164,7 +164,7 @@ if( ($mode eq 'findbusyservers_by_sessionstats') || ($mode eq 'findbusyservers') InitX2GoUser($uid, $uidNumber, $gidNumber, $home); print "OK\n"; - my $busy_servers = `/bin/su - $uid -c \"x2gogetservers\"`; + my $busy_servers = `sudo -u $uid -c \"x2gogetservers\"`; my %server_load = (); my $num_sessions = 0; @@ -190,7 +190,7 @@ if($mode eq 'getservers') { InitX2GoUser($uid, $uidNumber, $gidNumber, $home); print "OK\n"; - exec ("/bin/su - $uid -c \"x2gogetservers\""); + exec ("sudo", "-u", "$uid", "--", "x2gogetservers"); } if($mode eq 'addauthkey') @@ -216,7 +216,7 @@ if($mode eq 'suspendsession') InitX2GoUser($uid, $uidNumber, $gidNumber, $home); print "OK\n"; my $sid=shift; - exec ("/bin/su - $uid -c \"\$(x2gopath lib)/x2gochangestatus S $sid\""); + exec ("sudo", "-u", "$uid", "--", "$(x2gopath lib)/x2gochangestatus", "S", "$sid"); } if($mode eq 'terminatesession') @@ -224,6 +224,6 @@ if($mode eq 'terminatesession') InitX2GoUser($uid, $uidNumber, $gidNumber, $home); print "OK\n"; my $sid=shift; - exec ("/bin/su - $uid -c \"\$(x2gopath lib)/x2gochangestatus T $sid\""); + exec ("sudo", "-u", "$uid", "--", "$(x2gopath lib)/x2gochangestatus", "T", "$sid"); } -- 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 14ac0d820218d2a8190897e932429003d43cf35d Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Mar 19 00:48:13 2014 +0100 update man page x2gobroker-testauth --- man/man1/x2gobroker-testauth.1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/man/man1/x2gobroker-testauth.1 b/man/man1/x2gobroker-testauth.1 index 24ba87b..a4a6404 100644 --- a/man/man1/x2gobroker-testauth.1 +++ b/man/man1/x2gobroker-testauth.1 @@ -5,7 +5,7 @@ \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac -.TH x2gobroker-testauth 1 "Feb 2014" "Version 0.0.3.x" "X2Go Session Broker" +.TH x2gobroker-testauth 1 "Mar 2014" "Version 0.0.3.x" "X2Go Session Broker" .SH NAME x2gobroker-testauth \- Session Broker for X2Go (Authentication Test Utility) .SH SYNOPSIS @@ -24,7 +24,7 @@ x2gobroker-testauth \- Session Broker for X2Go (Authentication Test Utility) .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 +WARNING: please know that the credentials you use for testing the broker authentication will get revealed in your shell's history file (e.g. \fI~/.bash_history\fR). .SH COMMON OPTIONS \fBx2gobroker-testauth\fR displays some help on command line options: @@ -32,7 +32,8 @@ get revealed in your shell's history file (e.g. \fI~/.bash_history\fR). \*(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. +At least the username is required. The password option can be omitted, you will +be queried interactively, if no password is specified on the command line. .TP \*(T<\fB\-u, \-\-user, \-\-username\fR\*(T> Username part of the credentials you want to test. -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git