bb836b
From abf1adeae8211f5acd87dc63b03b2ed995047efd Mon Sep 17 00:00:00 2001
bb836b
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
bb836b
Date: Thu, 20 May 2021 08:53:55 +0200
bb836b
Subject: [PATCH 1/2] rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and
bb836b
 set in cloud.cfg
bb836b
bb836b
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
bb836b
RH-MergeRequest: 10: rhel/cloud.cfg: remove ssh_genkeytypes in settings.py and set in cloud.cfg
bb836b
RH-Commit: [1/1] 6da989423b9b6e017afbac2f1af3649b0487310f
bb836b
RH-Bugzilla: 1957532
bb836b
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
bb836b
RH-Acked-by: Cathy Avery <cavery@redhat.com>
bb836b
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
bb836b
RH-Acked-by: Mohamed Gamal Morsy <mmorsy@redhat.com>
bb836b
bb836b
Currently genkeytypes in cloud.cfg is set to None, so together with
bb836b
ssh_deletekeys=1 cloudinit on first boot it will just delete the existing
bb836b
keys and not generate new ones.
bb836b
bb836b
Just removing that property in cloud.cfg is not enough, because
bb836b
settings.py provides another empty default value that will be used
bb836b
instead, resulting to no key generated even when the property is not defined.
bb836b
bb836b
Removing genkeytypes also in settings.py will default to GENERATE_KEY_NAMES,
bb836b
but since we want only 'rsa', 'ecdsa' and 'ed25519', add back genkeytypes in
bb836b
cloud.cfg with the above defaults.
bb836b
bb836b
Also remove ssh_deletekeys in settings.py as we always need
bb836b
to 1 (and it also defaults to 1).
bb836b
bb836b
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
bb836b
---
bb836b
 cloudinit/settings.py | 2 --
bb836b
 rhel/cloud.cfg        | 2 +-
bb836b
 2 files changed, 1 insertion(+), 3 deletions(-)
bb836b
bb836b
diff --git a/cloudinit/settings.py b/cloudinit/settings.py
bb836b
index 43a1490c..2acf2615 100644
bb836b
--- a/cloudinit/settings.py
bb836b
+++ b/cloudinit/settings.py
bb836b
@@ -49,8 +49,6 @@ CFG_BUILTIN = {
bb836b
     'def_log_file_mode': 0o600,
bb836b
     'log_cfgs': [],
bb836b
     'mount_default_fields': [None, None, 'auto', 'defaults,nofail', '0', '2'],
bb836b
-    'ssh_deletekeys': False,
bb836b
-    'ssh_genkeytypes': [],
bb836b
     'syslog_fix_perms': [],
bb836b
     'system_info': {
bb836b
         'paths': {
bb836b
diff --git a/rhel/cloud.cfg b/rhel/cloud.cfg
bb836b
index 9ecba215..cbee197a 100644
bb836b
--- a/rhel/cloud.cfg
bb836b
+++ b/rhel/cloud.cfg
bb836b
@@ -7,7 +7,7 @@ ssh_pwauth:   0
bb836b
 mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
bb836b
 resize_rootfs_tmp: /dev
bb836b
 ssh_deletekeys:   1
bb836b
-ssh_genkeytypes:  ~
bb836b
+ssh_genkeytypes:  ['rsa', 'ecdsa', 'ed25519']
bb836b
 syslog_fix_perms: ~
bb836b
 disable_vmware_customization: false
bb836b
 
bb836b
-- 
bb836b
2.27.0
bb836b