From: Zack Cerza Date: Tue, 24 Sep 2013 16:48:11 +0000 (-0500) Subject: Add config option 'verify_host_keys' X-Git-Tag: 1.1.0~1857 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3955666e8e8dca14bca29ced65adb1f936f3131e;p=teuthology.git Add config option 'verify_host_keys' Defaults to True, meaning no change in behavior. If False, don't have paramiko verify ssh host keys. --- diff --git a/teuthology/config.py b/teuthology/config.py index e11901a7ea..195ad69d52 100644 --- a/teuthology/config.py +++ b/teuthology/config.py @@ -46,6 +46,15 @@ class Config(object): base_url = base_url or "https://github.com/ceph/" return base_url + @property + def verify_host_keys(self): + """ + Whether or not we should verify ssh host keys. + + Defaults to True + """ + return self.__conf.get('verify_host_keys', True) + # This takes care of any and all of the rest. # If the parameter is defined, return it. Otherwise return None. def __getattr__(self, name): diff --git a/teuthology/orchestra/connection.py b/teuthology/orchestra/connection.py index 2473c19b14..b678833b07 100644 --- a/teuthology/orchestra/connection.py +++ b/teuthology/orchestra/connection.py @@ -1,5 +1,6 @@ import base64 import paramiko +from ..config import config def split_user(user_at_host): try: @@ -25,11 +26,11 @@ def connect(user_at_host, host_key=None, keep_alive=False, _SSHClient = paramiko.SSHClient ssh = _SSHClient() if host_key is None: - ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) if _create_key is None: _create_key = create_key - if host_key is None: + if host_key is None and config.verify_host_keys is True: ssh.load_system_host_keys() else: keytype, key = host_key.split(' ', 1) @@ -38,7 +39,7 @@ def connect(user_at_host, host_key=None, keep_alive=False, keytype=keytype, key=_create_key(keytype, key) ) - + # just let the exceptions bubble up to caller ssh.connect( hostname=host,