This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 8a1c4c54cc83ee136b59f91f04607adf047d74e0 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Mar 19 13:25:33 2014 +0100 Support adding remote broker agent's host keys via the x2gobroker-testagent tool. --- debian/changelog | 2 ++ sbin/x2gobroker-testagent | 8 ++++++++ x2gobroker/agent.py | 4 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e1e4fa1..c3e10ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -105,6 +105,8 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low - For user context changes: set the HOME dir of the new user correctly. - Reduce Paramiko/SSH verbosity (logging.ERROR) when connecting to remote broker agents. + - Support adding remote broker agent's host keys via the x2gobroker-testagent + tool. * 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 3d6b825..f73bb0b 100755 --- a/sbin/x2gobroker-testagent +++ b/sbin/x2gobroker-testagent @@ -26,6 +26,7 @@ import types import setproctitle import argparse import logging +from paramiko import AutoAddPolicy # perform an authentication against the authentication mechanism configured for WSGI try: @@ -58,6 +59,7 @@ if __name__ == "__main__": {'args':['-p','--port'], 'default': 22, 'metavar': 'PORT', 'help': 'For remote agent calls (via SSH) use this port as SSH port (default: 22)', }, ] supplementary_options = [ + {'args':['-A', '--add-to-known-hosts'], 'default': False, 'action': 'store_true', 'help': 'For SSH connections to a remote broker agent: permanently add the remote system\'s host key to the list of known hosts', }, {'args':['--session-id'], 'default': None, 'help': 'when testing the \'suspendsession\' or the \'terminatesession\' task, you have to additionally give a session ID to test the tasks on', }, {'args':['--pubkey'], 'default': None, 'help': 'use this public key when testing the \'addauthkey\' and the \'delauthkey\' task', }, ] @@ -124,6 +126,12 @@ query_mode = local_agent and 'LOCAL' or 'SSH' if local_agent: remote_agent = None else: remote_agent = {'hostname': hostname, 'port': port, } +if remote_agent and cmdline_args.add_to_known_hosts: + remote_agent.update({ + 'host_key_policy': AutoAddPolicy(), + }) + + def call_agent(task, **kwargs): try: _result = agent_client_tasks[task](username=username, query_mode=query_mode, remote_agent=remote_agent, **kwargs) diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py index 2bb92da..169f62e 100644 --- a/x2gobroker/agent.py +++ b/x2gobroker/agent.py @@ -132,6 +132,8 @@ def call_remote_broker_agent(username, mode, cmdline_args=[], remote_agent=None) """ if remote_agent is None: logger_error.error('With the SSH agent-query-mode a remote agent host (hostname, port) has to be specified!') + elif not remote_agent.has_key('host_key_policy'): + remote_agent['host_key_policy'] = paramiko.WarningPolicy() cmd_line = [ '{x2gobroker_agent_binary}'.format(x2gobroker_agent_binary=x2gobroker.defaults.X2GOBROKER_AGENT_CMD), @@ -153,7 +155,7 @@ def call_remote_broker_agent(username, mode, cmdline_args=[], remote_agent=None) try: client = paramiko.SSHClient() client.load_system_host_keys() - client.set_missing_host_key_policy(paramiko.WarningPolicy()) + client.set_missing_host_key_policy(remote_agent['host_key_policy']) client.connect(remote_hostname, remote_port, remote_username, look_for_keys=True, allow_agent=True) result = [] -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git