Skip to content

Commit

Permalink
Merge pull request #2846 from shehzaman/feature/missing-identity-file
Browse files Browse the repository at this point in the history
Put back identityfile parameter from .ssh/config
  • Loading branch information
aiordache committed Aug 31, 2021
2 parents 5705d12 + 8da03e0 commit 62af2bb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docker/transport/sshconn.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,18 @@ def _create_paramiko_client(self, base_url):
with open(ssh_config_file) as f:
conf.parse(f)
host_config = conf.lookup(base_url.hostname)
self.ssh_conf = host_config
if 'proxycommand' in host_config:
self.ssh_params["sock"] = paramiko.ProxyCommand(
self.ssh_conf['proxycommand']
)
if 'hostname' in host_config:
self.ssh_params['hostname'] = host_config['hostname']
if base_url.port is None and 'port' in host_config:
self.ssh_params['port'] = self.ssh_conf['port']
self.ssh_params['port'] = host_config['port']
if base_url.username is None and 'user' in host_config:
self.ssh_params['username'] = self.ssh_conf['user']
self.ssh_params['username'] = host_config['user']
if 'identityfile' in host_config:
self.ssh_params['key_filename'] = host_config['identityfile']

self.ssh_client.load_system_host_keys()
self.ssh_client.set_missing_host_key_policy(paramiko.WarningPolicy())
Expand Down

0 comments on commit 62af2bb

Please sign in to comment.