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