Defaults to True, meaning no change in behavior. If False, don't have
paramiko verify ssh host keys.
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):
import base64
import paramiko
+from ..config import config
def split_user(user_at_host):
try:
_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)
keytype=keytype,
key=_create_key(keytype, key)
)
-
+
# just let the exceptions bubble up to caller
ssh.connect(
hostname=host,