summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-08-13 11:19:45 +0300
committerLars Wirzenius <liw@liw.fi>2023-08-13 12:24:47 +0300
commit265daf6c6f263a0d29ff05edd894fea1a9035618 (patch)
treec588840ed6c9c2dda436db5136b1181394951757
parentb62fca3ec660907d2c5517a06b1be4e5067261b8 (diff)
downloadv-i-265daf6c6f263a0d29ff05edd894fea1a9035618.tar.gz
fix(configure-installer): handle host id or user ca not configured
Sponsored-by: author
-rwxr-xr-xconfigure-installer11
1 files 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)