diff options
author | John Estabrook <jestabro@sentrium.io> | 2019-06-03 10:37:35 -0500 |
---|---|---|
committer | John Estabrook <jestabro@sentrium.io> | 2019-06-03 10:37:35 -0500 |
commit | 2d13d5741953a82ba1b232dd3e1c9efb98ec43a6 (patch) | |
tree | 463eb5a903933473c756ca97883b8403164ce5bb /python/vyos/remote.py | |
parent | 0b946bb9342d7784d9a271d02c05479419201dfb (diff) | |
download | vyos-1x-2d13d5741953a82ba1b232dd3e1c9efb98ec43a6.tar.gz vyos-1x-2d13d5741953a82ba1b232dd3e1c9efb98ec43a6.zip |
T1423: Create known_hosts file if not present
In the recent rewrite of the config merge script, support for merging
remote config files checks and adds the host key in known_hosts;
however, this function fails if known_hosts is not present. Fix.
Diffstat (limited to 'python/vyos/remote.py')
-rw-r--r-- | python/vyos/remote.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/python/vyos/remote.py b/python/vyos/remote.py index 372780c91..49936ec08 100644 --- a/python/vyos/remote.py +++ b/python/vyos/remote.py @@ -26,6 +26,9 @@ def check_and_add_host_key(host_name): needed. """ known_hosts = '{}/.ssh/known_hosts'.format(os.getenv('HOME')) + if not os.path.exists(known_hosts): + mode = 0o600 + os.mknod(known_hosts, 0o600) keyscan_cmd = 'ssh-keyscan -t rsa {} 2>/dev/null'.format(host_name) |