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