1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00: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:
Metin Kaya 2024-01-15 16:51:00 +00:00 committed by Marc Bonnici
parent e334f8816c
commit be7e73db16

View File

@ -397,6 +397,7 @@ class SshConnection(SshConnectionBase):
with _handle_paramiko_exceptions():
client = SSHClient()
if self.strict_host_check:
client.load_system_host_keys()
client.set_missing_host_key_policy(policy)
client.connect(