Files
felhom.eu/documentation/audits/certpin-spike-2026-11-11/tools/setpin-wrongca.sh
T
admin d4c7e84c22
gates / gates (push) Successful in 3m34s
Golden 0.352.0 vouched; token fix finished; why the N100 keeps no time; certificate pin spike on demo-hp
- Golden 0.352.0: bake, publish, one fresh install, the operator's vouch (R-468).
- No clone holds a login in its address; the credential helper script is in the repository (R-925, R-1390).
- N100 clock: a stale cached AppArmor profile stops chrony (R-1301, new R-1388). Read only.
- Certificate pin spike on demo-hp (R-1380): the break, the proven hand repair (runbook), the CA-file test,
  03-host-agent.md 12a, decision D80.
- Rulings of 13:17 written down (09 decisions 297-302). Register 245 -> 248 (R-1388, R-1389, R-1390).
- Docs, evidence and one helper script. No release, no floor change, no hub deploy.

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
2026-11-11 15:15:20 +01:00

20 lines
1.5 KiB
Bash

# usage: setpin.sh fp | setpin.sh ca — writes the agent's proxmox.tls block, restarts the agent
main() {
mode=$1; t0=$(date +%s.%N); echo "== setpin $mode start $(date -u +%FT%TZ)"
FP=$(echo | openssl s_client -connect 127.0.0.1:8006 2>/dev/null | openssl x509 -noout -fingerprint -sha256 | cut -d= -f2)
MODE=$mode FP=$FP python3 - <<'PY'
import json,os
f='/etc/felhom-agent/agent.json'; c=json.load(open(f)); st=os.stat(f)
if os.environ['MODE']=='fp': c['proxmox']['tls']={'fingerprint':os.environ['FP'],'insecure_skip_verify':False}
else: c['proxmox']['tls']={'ca_file':'/etc/ssl/certs/ISRG_Root_X1.pem','fingerprint':'','insecure_skip_verify':False}
tmp=f+'.tmp'; fd=os.open(tmp,os.O_WRONLY|os.O_CREAT|os.O_TRUNC,0o600)
with os.fdopen(fd,'w') as o: json.dump(c,o,indent=2); o.write('\n')
os.chown(tmp,st.st_uid,st.st_gid); os.rename(tmp,f); print('written tls:',c['proxmox']['tls'])
PY
systemctl restart felhom-agent
n=0; mark=$(date '+%d/%m/%Y:%H:%M:%S'); until [ $n -ge 60 ]; do l=$(grep 'felhom-agent@pve' /var/log/pveproxy/access.log | tail -1); ts=$(echo "$l" | awk '{print $4}' | tr -d '[');
if [ "$(date -d "$(echo $ts | sed 's#\([0-9]*\)/\([0-9]*\)/\([0-9]*\):#\3-\2-\1 #')" +%s 2>/dev/null || echo 0)" -ge "${t0%.*}" ]; then echo "first agent call after restart: $(echo "$l" | awk '{print $4,$6,$7,$9}')"; break; fi; n=$((n+1)); sleep 1; done
t1=$(date +%s.%N); echo "seconds from start to a working call: $(echo "$t1 - $t0" | bc) (loops: $n; 60 = no call seen)"
echo "agent: $(systemctl is-active felhom-agent)"
}; main "$@" </dev/null