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