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
@@ -3188,7 +3188,8 @@ resolve_pve_trust() {
|
||||
local addr="${PVE_API_ADDR:-127.0.0.1:8006}" fp why=""
|
||||
PVE_CA_FILE=""; PVE_TLS_FP=""
|
||||
# the SERVED leaf cert fingerprint (not pvesh node info — may differ): the fallback
|
||||
fp=$(echo | openssl s_client -connect "$addr" 2>/dev/null | openssl x509 -noout -fingerprint -sha256 2>/dev/null | sed 's/.*=//')
|
||||
# `|| fp=""`: under `set -euo pipefail` a failed pipeline inside the substitution would END the installer here.
|
||||
fp=$(echo | openssl s_client -connect "$addr" 2>/dev/null | openssl x509 -noout -fingerprint -sha256 2>/dev/null | sed 's/.*=//') || fp=""
|
||||
if [[ ! -r "$src" ]]; then
|
||||
why="$src is not readable"
|
||||
elif [[ "$(grep -c 'BEGIN CERTIFICATE' "$src")" != "1" ]] || grep -q 'PRIVATE KEY' "$src"; then
|
||||
@@ -3207,8 +3208,12 @@ resolve_pve_trust() {
|
||||
if install -m 0644 "$src" "$dst.felhom-new" && mv -f "$dst.felhom-new" "$dst"; then
|
||||
# THE PROOF, before the config names the copy: verified by the copy ALONE (no system roots), for the address
|
||||
# the agent calls (the IP must be in the certificate, as the agent's own check demands)
|
||||
if echo | openssl s_client -connect "$addr" -CAfile "$dst" -no-CApath -verify_return_error \
|
||||
-verify_ip "${addr%%:*}" 2>&1 | grep -q 'Verify return code: 0 (ok)'; then
|
||||
# The answer is read WHOLE into a variable and searched after: `… | grep -q` leaves at its first match while
|
||||
# s_client still writes, and under `pipefail` that broken pipe would read as "did not verify" for a good copy.
|
||||
local proof
|
||||
proof=$(echo | openssl s_client -connect "$addr" -CAfile "$dst" -no-CApath -verify_return_error \
|
||||
-verify_ip "${addr%%:*}" 2>&1) || true
|
||||
if grep -q 'Verify return code: 0 (ok)' <<<"$proof"; then
|
||||
PVE_CA_FILE="$dst"
|
||||
log_info " Proxmox trust: the box's own root CA ($dst; a handshake to $addr verified with it alone) — no pinned certificate"
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user