From 2d13d5741953a82ba1b232dd3e1c9efb98ec43a6 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Mon, 3 Jun 2019 10:37:35 -0500 Subject: 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. --- python/vyos/remote.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'python/vyos') 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) -- cgit v1.2.3