Add an option to disable/enable the use of ssh-agent with paramiko. On servers 
running large numbers of jobs it's possible for autoserv to DoS the ssh-agent 
with too many requests, so it's useful to be able to restrict the usage to 
keyfiles only in certain situations.

Signed-off-by: John Admanski <[email protected]>

--- autotest/global_config.ini  2010-03-12 12:43:52.000000000 -0800
+++ autotest/global_config.ini  2010-03-12 12:43:52.000000000 -0800
@@ -91,6 +91,9 @@
 # Autotest server operators *really should* set this to True, specially if
 # using ssh_engine 'paramiko'.
 require_atfork_module: False
+# Set to False to disable ssh-agent usage with paramiko
+use_sshagent_with_paramiko: True
+
 
 ###
 ### Site only fields go below
--- autotest/server/hosts/paramiko_host.py      2010-03-12 12:43:52.000000000 
-0800
+++ autotest/server/hosts/paramiko_host.py      2010-03-12 12:43:52.000000000 
-0800
@@ -1,7 +1,7 @@
 import os, sys, time, signal, socket, re, fnmatch, logging, threading
 import paramiko
 
-from autotest_lib.client.common_lib import utils, error
+from autotest_lib.client.common_lib import utils, error, global_config
 from autotest_lib.server import subcommand
 from autotest_lib.server.hosts import abstract_ssh
 
@@ -87,9 +87,12 @@
                 user_keys[path] = key
 
         # load up all the ssh agent keys
-        ssh_agent = paramiko.Agent()
-        for i, key in enumerate(ssh_agent.get_keys()):
-            user_keys['agent-key-%d' % i] = key
+        use_sshagent = global_config.global_config.get_config_value(
+            'AUTOSERV', 'use_sshagent_with_paramiko', type=bool)
+        if use_sshagent:
+            ssh_agent = paramiko.Agent()
+            for i, key in enumerate(ssh_agent.get_keys()):
+                user_keys['agent-key-%d' % i] = key
 
         return user_keys
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to