fix: the root CA is created by the server, an offline CA or a Simple CA service, chosen at setup; the shell can stay open in a tab of its own, the Docker page is offered only with Docker, and the test scripts are in bin/.
Release / release (push) Failing after 14m20s

This commit is contained in:
slawek committed 2026-11-23 06:45:23 +01:00
1 parent ff0c93ed73
commit a649331aa2
49 files changed
+1597 -637

No files matched your search

@@ -20,20 +20,26 @@ def ca(method, path, body):
ones, the extended key usages, each {oid, builtin}, the root, the
issuing CAs, the retired CAs and the warnings (linuxmanager_pki.status),
and the certificates issued, newest first
PUT /ca change any of the settings of the pki section
PUT /ca change any of the settings of the pki section; pki.root, once the
root exists, only to the source it has
POST /ca/certificates issue a certificate: {"ca", "template", "csr"} answers {"serial",
"certificate", "chain"}; {"ca", "template", "subject", "sans",
"password"} answers {"serial", "pfx"}, a PKCS#12 file in base64
POST /ca/certificates/<serial>/revoke revoke a certificate: {"reason"?}
GET /ca/bundle/<name> the PEM certificates a client trusts the CA with: {"name", "pem"}; for
root the root alone, for an issuing CA the issuing CA and the root
root the root alone, for an issuing CA the issuing CA, the upstream
CA when there is one, and the root
GET /ca/issuing/<name>/csr the CSR of an issuing CA that waits for the offline root, with the
openssl extensions to sign it with: {"name", "csr", "extensions"}
PUT /ca/issuing/<name>/certificate take its certificate signed by the root: {"certificate"}
PUT /ca/root/certificate take the certificate of the offline root: {"certificate"}
PUT /ca/root/crl take a root CRL signed offline: {"crl"}
PUT /ca/root/setup-code exchange a setup code of a Simple CA token for the token: {"code"}
answers {"upstream", "expires"}
A change of the settings is made as /site-to-site makes one; it, a revoked router certificate and an imported
issuing CA certificate are applied by restarting linux-manager-setup without waiting for it.
A change of the settings is made as /site-to-site makes one; it, a revoked router certificate, an imported root
or issuing CA certificate and a new Simple CA token are applied by restarting linux-manager-setup without waiting
for it.
"""
if body == 'invalid' or (body is not None and not isinstance(body, dict)):
return 400, {'error': 'the body must be a JSON object'}
@@ -57,6 +63,8 @@ def ca(method, path, body):
data['pki'] = {**(current if isinstance(current, dict) else {}), **settings}
cfg = linuxmanager.with_defaults(data)
linuxmanager.validate(cfg)
with linuxmanager_pki.directory() as connection:
linuxmanager_pki.check_source(cfg, linuxmanager_pki.authority(connection, 'root'))
linuxmanager.save_config(data)
run('systemctl', 'restart', '--no-block', 'linux-manager-setup.service')
return 200, {'settings': cfg['pki'], 'templates': linuxmanager.pki_templates(cfg)}
@@ -71,8 +79,12 @@ def ca(method, path, body):
return 200, linuxmanager_pki.csr(cfg, route[2])
elif len(route) == 4 and route[:2] == ('PUT', 'issuing') and route[3] == 'certificate':
document = linuxmanager_pki.import_ca(cfg, route[2], body.get('certificate'))
elif route == ('PUT', 'root', 'certificate'):
document = linuxmanager_pki.import_ca(cfg, 'root', body.get('certificate'))
elif route == ('PUT', 'root', 'crl'):
return 200, linuxmanager_pki.import_root_crl(body.get('crl'))
return 200, linuxmanager_pki.import_root_crl(cfg, body.get('crl'))
elif route == ('PUT', 'root', 'setup-code'):
document = linuxmanager_pki.exchange_code(cfg, body.get('code'))
else:
return 404, {'error': f'no route {method} {path}'}
except linuxmanager.ConfigError as exc:
@@ -85,6 +97,6 @@ def ca(method, path, body):
return 500, {'error': f'the PKI cannot be changed: {exc}'}
except SystemExit as exc:
return 500, {'error': str(exc.code)}
if route[1] == 'issuing' or document.get('reissue'):
if route[1] in ('issuing', 'root') or document.get('reissue'):
run('systemctl', 'restart', '--no-block', 'linux-manager-setup.service')
return 200, document
@@ -233,7 +233,8 @@ def postgresql_databases():
def details(state):
"""What /config shows: the configuration without its secrets, and what the server resolved and runs; caddy is the
installed Caddy, {version, source, service}, service the state of caddy.service, null when it is not installed; oidc
is {enabled, issuer} of the OpenID Provider, issuer null while it is disabled."""
is {enabled, issuer} of the OpenID Provider, issuer null while it is disabled; docker.installed is whether
docker.service is installed, as docker_status finds it."""
configuration = state.get('configuration', {})
caddy = package_version('caddy')
oidc = configuration.get('oidc', {}).get('enabled') is True
@@ -246,6 +247,7 @@ def details(state):
},
'wireguard': wireguard_details(),
'docker': {
'installed': docker_status()['installed'],
'exposed_ports': configuration.get('docker', {}).get('exposed_ports', []),
'rules': lines_of('iptables', '-S', 'LINUX-MANAGER-DOCKER'),
},