summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@sentrium.io>2019-06-03 10:37:35 -0500
committerJohn Estabrook <jestabro@sentrium.io>2019-06-03 10:37:35 -0500
commit2d13d5741953a82ba1b232dd3e1c9efb98ec43a6 (patch)
tree463eb5a903933473c756ca97883b8403164ce5bb
parent0b946bb9342d7784d9a271d02c05479419201dfb (diff)
downloadvyos-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.
-rw-r--r--python/vyos/remote.py3
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)