hub + installer (unreleased): fixes after an independent review of the night's code — per-thing mail cooldown, a box's input bounded and checked, both off-site account types on a reset, a quiet first run, strict-mode installer
Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
1 parent
a044eb8c16
commit
f618c591eb
31 files changed
+796
-88
No files matched your search
@@ -763,8 +763,10 @@ class _PVE:
|
||||
self.proc.kill(); self.proc.wait()
|
||||
|
||||
|
||||
def _trust_run(source, dry=False):
|
||||
"""Run resolve_pve_trust against a real TLS server. Returns (ca_file, fp, copy bytes or None, source bytes, output, leaf fp, dst)."""
|
||||
def _trust_run(source, dry=False, dead_port=False):
|
||||
"""Run resolve_pve_trust against a real TLS server — under `set -euo pipefail`, as the installer itself runs (line
|
||||
195 of the script): a function that only works without strict mode proves nothing about the installer.
|
||||
Returns (ca_file, fp, copy bytes or None, source bytes, output, leaf fp, dst)."""
|
||||
if not shutil.which("openssl"):
|
||||
return None
|
||||
sb = Sandbox()
|
||||
@@ -772,9 +774,10 @@ def _trust_run(source, dry=False):
|
||||
try:
|
||||
dst = sb.path("etc-felhom-agent", "pve-root-ca.pem")
|
||||
src = os.path.join(pve.dir, source)
|
||||
rc, out = sb.run(prelude(dry) + func("resolve_pve_trust") +
|
||||
port = 1 if dead_port else pve.port # port 1: nothing listens → the handshake cannot even start
|
||||
rc, out = sb.run(prelude(dry) + func("resolve_pve_trust") + 'set -euo pipefail\n'
|
||||
'PVE_CA_SOURCE="%s" PVE_CA_COPY="%s" PVE_API_ADDR=127.0.0.1:%d\nresolve_pve_trust\n'
|
||||
'echo "RESULT ca=[$PVE_CA_FILE] fp=[$PVE_TLS_FP]"\n' % (src, dst, pve.port))
|
||||
'echo "RESULT ca=[$PVE_CA_FILE] fp=[$PVE_TLS_FP]"\n' % (src, dst, port))
|
||||
assert rc == 0, out
|
||||
m = re.search(r"RESULT ca=\[(.*?)\] fp=\[(.*?)\]", out)
|
||||
assert m, out
|
||||
@@ -814,6 +817,18 @@ def test_pve_trust_a_source_that_is_not_a_ca_is_never_copied():
|
||||
assert why in out, "%s: the reason is not named:\n%s" % (source, out)
|
||||
|
||||
|
||||
def test_pve_trust_no_answer_from_proxmox_does_not_end_the_installer():
|
||||
"""Found by review 2026-11-14: under `set -euo pipefail` a failed pipeline inside `fp=$(…)` ended the whole installer at
|
||||
that line. Proxmox not answering (it restarts) must leave the function running to its end: no CA file (no proof), no
|
||||
fingerprint, and the two warnings — the run reaches RESULT."""
|
||||
r = _trust_run("ca.pem", dead_port=True)
|
||||
if r is None:
|
||||
print(" (skipped: no openssl here)"); return
|
||||
ca, fp, _, _, out, _, _ = r
|
||||
assert ca == "" and fp == "", "nothing answered, so nothing can be proven or pinned. Got ca=%r fp=%r\n%s" % (ca, fp, out)
|
||||
assert "did not verify" in out and "could not compute TLS fingerprint" in out, out
|
||||
|
||||
|
||||
def test_pve_trust_dry_run_writes_nothing():
|
||||
r = _trust_run("ca.pem", dry=True)
|
||||
if r is None:
|
||||
|
||||
Reference in new issue
Block a user