mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-04 11:01:53 +01:00
utils/ssh: Load host keys only if strict_host_check is true
Loading host keys breaks setting up SSH connection (paramiko throws BadHostKeyException exception) if issuer does not want/need strict key matching. One use case for ignoring strict_host_check is automating virtual guests (i.e., over QEMU). Issuer may want to skip loading host keys and start with a blank list of known host keys for sure. Signed-off-by: Metin Kaya <metin.kaya@arm.com>
This commit is contained in:
@@ -397,6 +397,7 @@ class SshConnection(SshConnectionBase):
|
|||||||
|
|
||||||
with _handle_paramiko_exceptions():
|
with _handle_paramiko_exceptions():
|
||||||
client = SSHClient()
|
client = SSHClient()
|
||||||
|
if self.strict_host_check:
|
||||||
client.load_system_host_keys()
|
client.load_system_host_keys()
|
||||||
client.set_missing_host_key_policy(policy)
|
client.set_missing_host_key_policy(policy)
|
||||||
client.connect(
|
client.connect(
|
||||||
|
Reference in New Issue
Block a user