[X2Go-Commits] [x2gobroker] 01/04: x2gobroker/agent.py: Assure that remote_agent['host_key_policy'] is always the name of the Parmiko MissingHostKeyPolicy, not the class object itself.

git-admin at x2go.org git-admin at x2go.org
Sun Apr 21 16:16:09 CEST 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit a6b59c22062ff3584bb2a5434bb08d5a0f10e6d1
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sun Apr 21 16:10:24 2019 +0200

    x2gobroker/agent.py: Assure that remote_agent['host_key_policy'] is always the name of the Parmiko MissingHostKeyPolicy, not the class object itself.
---
 x2gobroker/agent.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 3530323..797ec44 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
@@ -196,14 +196,14 @@ def _call_remote_broker_agent(username, task, cmdline_args=[], remote_agent=None
     if remote_agent is None:
         logger_error.error('With the SSH agent-query-mode a remote agent host (hostname, hostaddr, port) has to be specified!')
     elif 'host_key_policy' not in remote_agent or remote_agent['host_key_policy'] == 'WarningPolicy':
-        remote_agent['host_key_policy'] = paramiko.WarningPolicy()
+        _hostkey_policy = paramiko.WarningPolicy()
     elif remote_agent['host_key_policy'] == 'RejectPolicy':
-        remote_agent['host_key_policy'] = paramiko.RejectPolicy()
+        _hostkey_policy = paramiko.RejectPolicy()
     elif remote_agent['host_key_policy'] == 'AutoAddPolicy':
-        remote_agent['host_key_policy'] = paramiko.AutoAddPolicy()
+        _hostkey_policy = paramiko.AutoAddPolicy()
     else:
         logger_error.error('Invalid SSH HostKey Policy: "{policy}", falling back to "RejectPolicy"!'.format(policy=remote_agent['host_key_policy']))
-        remote_agent['host_key_policy'] = paramiko.RejectPolicy()
+        _hostkey_policy = paramiko.RejectPolicy()
 
     remote_hostaddr = None
     remote_hostname = None
@@ -244,7 +244,7 @@ def _call_remote_broker_agent(username, task, cmdline_args=[], remote_agent=None
             client.load_system_host_keys()
             if os.path.exists(os.path.expanduser("~/.ssh/known_hosts")):
                 client.load_host_keys(os.path.expanduser("~/.ssh/known_hosts"))
-            client.set_missing_host_key_policy(remote_agent['host_key_policy'])
+            client.set_missing_host_key_policy(_hostkey_policy)
             client.connect(_remote_sshserver, remote_port, remote_username, look_for_keys=True, allow_agent=True)
 
             result = []

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git


More information about the x2go-commits mailing list