Fingerprint-Datei nur für root, Bootstrap mit Fingerprint als Nachweis
Credentials und Fingerprint mit umask 077 angelegt (kein kurzes Lesefenster vor dem chmod). platform-docs roadmap/agent-zugang-haertung.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eaa6bce003
commit
fbfc394747
1 file changed
+17
-15
@@ -22,11 +22,9 @@ ANODE_URL="${TUXFLOTTE_ANODE_URL}"
|
||||
# Geraets festlegt. Gitea bleibt Rueckfall, bis es geschlossen wird.
|
||||
AGENT_REPO_RAW="https://git.tuxflotte.de/admin/provisioning-agent/raw/branch/main"
|
||||
|
||||
# 0755 statt 0700: /etc/tuxflotte muss fuer alle Nutzer durchsuchbar sein,
|
||||
# damit device_fingerprint (siehe unten) ohne sudo lesbar ist - einzelne
|
||||
# Dateien darin bleiben trotzdem individuell geschuetzt (agent.credentials
|
||||
# unten explizit chmod 0600, genau wie /etc/shadow trotz durchsuchbarem
|
||||
# /etc selbst geschuetzt bleibt).
|
||||
# 0755: agent.env liest auch der Agent-Dienst-Rahmen; die schutzwuerdigen
|
||||
# Dateien darin (agent.credentials, device_fingerprint) bekommen unten
|
||||
# einzeln 0600, wie /etc/shadow in einem durchsuchbaren /etc.
|
||||
install -d -m 0755 /etc/tuxflotte ||
|
||||
tuxflotte_agent_fatal "Verzeichnis /etc/tuxflotte konnte nicht angelegt werden."
|
||||
|
||||
@@ -35,14 +33,13 @@ install -d -m 0755 /etc/tuxflotte ||
|
||||
# gab es auf dem installierten Geraet selbst keine Datei, um ihn mit einem
|
||||
# einfachen "cat" gegenzupruefen - build_device_fingerprint() (10_hardware.sh)
|
||||
# berechnet ihn nur einmalig waehrend des Live-Boots und haelt ihn sonst
|
||||
# nirgends fest. Absichtlich Klartext, kein Secret - reiner Hardware-Hash.
|
||||
# Live gefunden (01.09.2026, echter Hardware-Test): trotz dieser Absicht
|
||||
# war die Datei vorher nicht ohne sudo lesbar, weil das umschliessende
|
||||
# Verzeichnis 0700 war (siehe oben) - explizites chmod 0644 hier, damit
|
||||
# sich das nicht auf einen zufaelligen umask verlaesst.
|
||||
echo "${TUXFLOTTE_DEVICE_FINGERPRINT}" > /etc/tuxflotte/device_fingerprint ||
|
||||
# nirgends fest. Seit 27.10.2026 nur fuer root lesbar: der Agent weist sich
|
||||
# damit beim Bootstrap aus (platform-docs roadmap/agent-zugang-haertung.md).
|
||||
# Die Bestandteile (DMI-UUID, Seriennummern) kann ohnehin nur root lesen;
|
||||
# eine fuer alle lesbare Datei machte den Nachweis wertlos.
|
||||
( umask 077 && echo "${TUXFLOTTE_DEVICE_FINGERPRINT}" > /etc/tuxflotte/device_fingerprint ) ||
|
||||
tuxflotte_agent_fatal "device_fingerprint konnte nicht abgelegt werden."
|
||||
chmod 0644 /etc/tuxflotte/device_fingerprint ||
|
||||
chmod 0600 /etc/tuxflotte/device_fingerprint ||
|
||||
tuxflotte_agent_fatal "Rechte fuer device_fingerprint konnten nicht gesetzt werden."
|
||||
|
||||
cat > /etc/tuxflotte/runtime_blueprint.json <<'RUNTIME_BLUEPRINT_EOF'
|
||||
@@ -52,10 +49,15 @@ RUNTIME_BLUEPRINT_EOF
|
||||
install -d /opt/tuxflotte/agent ||
|
||||
tuxflotte_agent_fatal "Verzeichnis /opt/tuxflotte/agent konnte nicht angelegt werden."
|
||||
|
||||
# Fingerprint als Nachweis (27.10.2026), an curl per stdin.
|
||||
AGENT_BOOTSTRAP_RESPONSE="$(
|
||||
jq --null-input \
|
||||
--arg device_id "${TUXFLOTTE_DEVICE_ID}" \
|
||||
--arg device_fingerprint "${TUXFLOTTE_DEVICE_FINGERPRINT}" \
|
||||
'{device_id: $device_id, device_fingerprint: $device_fingerprint}' |
|
||||
curl --silent --show-error --fail --location \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-binary "{\"device_id\": \"${TUXFLOTTE_DEVICE_ID}\"}" \
|
||||
--data-binary @- \
|
||||
"${ANODE_URL}/api/v1/agent/bootstrap"
|
||||
)" ||
|
||||
tuxflotte_agent_fatal "Bootstrap-Aufruf gegen ${ANODE_URL} ist fehlgeschlagen."
|
||||
@@ -63,11 +65,11 @@ AGENT_BOOTSTRAP_RESPONSE="$(
|
||||
jq --exit-status '.success == true' <<<"${AGENT_BOOTSTRAP_RESPONSE}" >/dev/null ||
|
||||
tuxflotte_agent_fatal "Server hat den Bootstrap abgelehnt: ${AGENT_BOOTSTRAP_RESPONSE}"
|
||||
|
||||
jq --null-input \
|
||||
( umask 077 && jq --null-input \
|
||||
--arg device_id "${TUXFLOTTE_DEVICE_ID}" \
|
||||
--argjson response "${AGENT_BOOTSTRAP_RESPONSE}" \
|
||||
'{device_id: $device_id, agent_secret: $response.agent_secret}' \
|
||||
> /etc/tuxflotte/agent.credentials ||
|
||||
> /etc/tuxflotte/agent.credentials ) ||
|
||||
tuxflotte_agent_fatal "Credentials-Datei konnte nicht erzeugt werden."
|
||||
chmod 0600 /etc/tuxflotte/agent.credentials
|
||||
|
||||
|
||||
Reference in new issue
Block a user