summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorTatiana Kholkina <holkina@selectel.ru>2018-02-01 18:08:15 +0300
committerTatiana Kholkina <holkina@selectel.ru>2018-02-02 10:12:27 +0300
commit45289a00bf8c043c5783c527c4ea720e67e0524b (patch)
tree3a9d5504012cfd6851089be1f9eeac29490c6758 /cloudinit
parentf7deaf15acf382d62554e2b1d70daa9a9109d542 (diff)
downloadvyos-cloud-init-45289a00bf8c043c5783c527c4ea720e67e0524b.tar.gz
vyos-cloud-init-45289a00bf8c043c5783c527c4ea720e67e0524b.zip
Fix ssh keys validation in ssh_util
This fixes a bug where invalid keys would sneak into authorized_keys.
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/ssh_util.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/cloudinit/ssh_util.py b/cloudinit/ssh_util.py
index b95b956f..882517f5 100644
--- a/cloudinit/ssh_util.py
+++ b/cloudinit/ssh_util.py
@@ -171,16 +171,13 @@ def parse_authorized_keys(fname):
def update_authorized_keys(old_entries, keys):
- to_add = list(keys)
-
+ to_add = list([k for k in keys if k.valid()])
for i in range(0, len(old_entries)):
ent = old_entries[i]
if not ent.valid():
continue
# Replace those with the same base64
for k in keys:
- if not ent.valid():
- continue
if k.base64 == ent.base64:
# Replace it with our better one
ent = k