Files
felhom.eu/documentation/audits/end-dates-list-2026-11-11/tools/host-dates.sh
T
admin 978666dde3
gates / gates (push) Successful in 2m2s
lists: the Clock list (70 jobs) and the End-dates list (39 things), 9 register rows, 4 decisions
Read-only review of every job on a timer and of everything that ends on a date,
with measurements from the three test boxes. Nothing ends in the next 14 days.
Register 236 -> 245 (R-1379..R-1387), pointer lines on twelve rows, D76-D79 in
STATUS.md. Part C: felhom-agent's clone address holds no token now; the other
clones wait for the operator's yes. R-1035's 4-week check moved to 2026-11-18
(operator read needed).

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

32 lines
4.6 KiB
Bash

#!/bin/bash
# End-dates list 2026-11-11 — host. READ-ONLY: openssl x509 -noout (public fields only), a TLS handshake to the box's
# own listening ports, pveum/pvenode/pvesubscription reads, ls, cat of apt source lists, dpkg -l. It prints NO key,
# NO token value and NO certificate body: for a certificate only subject, issuer, the two dates and the fingerprint.
set -u
h() { echo; echo "=== $* ==="; }
U() { sed -E 's#(https?://)[^/@ ]+@#\1***@#g'; }
cert() { openssl x509 -noout -subject -issuer -startdate -enddate -fingerprint -sha256 2>/dev/null | tr '\n' ' '; echo; }
h "now"; date -u +%FT%TZ
h "certificate files"; for f in $(/usr/bin/grep -rlIs 'BEGIN CERTIFICATE' /etc/pve/local /etc/pve/pve-root-ca.pem /etc/pve/nodes /etc/felhom /etc/felhom-agent /var/lib/felhom-agent /var/lib/felhom-install /etc/ssl/private /usr/local/share/ca-certificates /etc/proxmox-backup 2>/dev/null | sort -u); do n=$(/usr/bin/grep -c 'BEGIN CERTIFICATE' "$f"); printf '%s [certs=%s mtime=%s] ' "$f" "$n" "$(date -u -r "$f" +%F)"; cert < "$f"; done
h "system CA store"; ls /etc/ssl/certs/*.pem 2>/dev/null | wc -l; dpkg -l ca-certificates 2>/dev/null | tail -1 | awk '{print $2,$3}'
h "served certificates (TLS handshake to own listeners)"; ss -H -tln | awk '{print $4}' | sort -u | while read a; do p=${a##*:}; ip=${a%:*}; ip=${ip#[}; ip=${ip%]}; case "$ip" in '*'|'0.0.0.0'|'::') ip=127.0.0.1;; esac; out=$(echo | timeout 4 openssl s_client -connect "$ip:$p" 2>/dev/null | cert); [ -n "${out// /}" ] && echo "$a -> $out" || echo "$a -> no TLS"; done
h "listeners (port, process)"; ss -H -tlnp | awk '{print $4, $6}' | sed -E 's/pid=[0-9]+,fd=[0-9]+//g' | sort -u
h "pve users and tokens (expire: 0 = never)"; pveum user list --output-format json 2>/dev/null | python3 -c '
import json,sys,time
for u in json.load(sys.stdin):
print("user", u.get("userid"), "enable", u.get("enable"), "expire", u.get("expire"), "tokens", [(t.get("tokenid"), "expire", t.get("expire")) for t in (u.get("tokens") or [])])'
h "acme / subscription"; pvenode acme account list 2>&1 | head -5; pvenode config get 2>&1 | head -10; pvesubscription get 2>&1 | /usr/bin/grep -E 'status|message|nextduedate' | head
h "os"; . /etc/os-release; echo "$PRETTY_NAME / $VERSION_CODENAME"; cat /etc/debian_version; pveversion 2>&1; uname -r; proxmox-boot-tool kernel list 2>&1 | head -12; dpkg -l 'proxmox-kernel-*-signed' 'pve-kernel-*' 2>/dev/null | awk '/^ii/{print $2,$3}' | head -12
h "apt sources"; for f in /etc/apt/sources.list /etc/apt/sources.list.d/*; do [ -f "$f" ] && { echo "--- $f"; /usr/bin/grep -v -E '^\s*(#|$)' "$f" | U; }; done; echo "--- auth files (names only): $(ls /etc/apt/auth.conf /etc/apt/auth.conf.d 2>/dev/null | tr '\n' ' ')"
h "apt keyring files"; ls -l --time-style=long-iso /etc/apt/trusted.gpg /etc/apt/trusted.gpg.d/ /etc/apt/keyrings/ /usr/share/keyrings/ 2>/dev/null | awk '{print $5,$6,$8}'
h "apt release files: Valid-Until"; for f in /var/lib/apt/lists/*Release; do [ -f "$f" ] && printf '%s | Date: %s | Valid-Until: %s\n' "$(basename "$f")" "$(/usr/bin/grep -m1 '^Date:' "$f" | cut -c7-)" "$(/usr/bin/grep -m1 '^Valid-Until:' "$f" | cut -c14-)"; done
h "templates and golden"; for d in $(awk '/^dir:/{f=1;next} /^[a-z]+:/{f=0} f&&$1=="path"{print $2}' /etc/pve/storage.cfg 2>/dev/null) /var/lib/vz; do ls -l --time-style=long-iso "$d/template/cache" 2>/dev/null | awk -v d="$d" 'NR>1{print d, $5,$6,$8}'; done | sort -u
h "agent files (names and dates only)"; ls -l --time-style=long-iso /etc/felhom-agent /etc/felhom /var/lib/felhom-agent 2>/dev/null | awk '{print $1,$3,$5,$6,$7,$8}'
h "agent"; /usr/local/bin/felhom-agent --version 2>&1 | head -1
h "wireguard (interface and latest handshake time only)"; wg show all latest-handshakes 2>/dev/null | awk '{print $1, "peer", substr($2,1,6) "…", strftime("%FT%TZ",$3,1)}'
h "tailscale"; command -v tailscale >/dev/null && tailscale status --json 2>/dev/null | python3 -c '
import json,sys
d=json.load(sys.stdin); s=d.get("Self",{}); print("self key expiry:", s.get("KeyExpiry"), "online:", s.get("Online"))' || echo "no tailscale"
h "ssh host keys / authorized keys (counts only)"; ls /etc/ssh/ssh_host_*_key.pub 2>/dev/null | wc -l; for f in /root/.ssh/authorized_keys /home/*/.ssh/authorized_keys; do [ -f "$f" ] && echo "$f lines=$(/usr/bin/grep -c -v -E '^\s*(#|$)' "$f")"; done
h "smart: power-on hours and wear (no serials)"; for d in $(lsblk -dno NAME,TYPE | awk '$2=="disk"{print $1}'); do printf '%s: ' $d; smartctl -A /dev/$d 2>/dev/null | /usr/bin/grep -i -E 'Power_On_Hours|Percentage Used|Power On Hours|Wear_Leveling|Media_Wearout|Available Spare:' | awk '{$1=$1;print}' | tr '\n' ';'; echo; done