From 265daf6c6f263a0d29ff05edd894fea1a9035618 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 13 Aug 2023 11:19:45 +0300 Subject: fix(configure-installer): handle host id or user ca not configured Sponsored-by: author --- configure-installer | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/configure-installer b/configure-installer index 2e97354..269816b 100755 --- a/configure-installer +++ b/configure-installer @@ -50,7 +50,8 @@ class Config: log(f"reading configuration from {filename}") with open(filename) as f: obj = yaml.safe_load(f) - self.config.update(obj) + if obj is not None: + self.config.update(obj) for key in self.exandable: if self.config[key] is not None: self.config[key] = os.path.expanduser(self.config[key]) @@ -77,6 +78,8 @@ class Config: return cat(filename) cmd = self.config.get(f"{prefix}_cmd") + if cmd is None: + return None if hostname is not None: cmd = hostname.join(cmd.split("$HOST")) if cmd is not None: @@ -138,8 +141,8 @@ def dir_exists(mp, path): def host_id(config, mp, installer_hostname): key = config.host_key(installer_hostname) cert = config.host_cert(installer_hostname) - if key is None: - sys.exit("could not find host key for installer") + if key is None or cert is None: + return config_d = "/etc/ssh/sshd_config.d" host_key = "/etc/ssh/ssh_host_key" @@ -176,6 +179,8 @@ def authorized_keys(config, mp): def user_ca(config, mp): ca_key = config.user_ca_pub() + if ca_key is None: + return include = f"{mp}/etc/ssh/sshd_config.d/user_ca.conf" write(include, "TrustedUserCAKeys /etc/ssh/user_ca_pubs\n", 0, 0, 0o644) -- cgit v1.2.1