Compare commits

..

No commits in common. "18738be01d26c2892b4a7aec107bb6124711e8f8" and "d5010f5c7bace1a28a51d9a5ede66cb5de9cbe54" have entirely different histories.

4 changed files with 2 additions and 53 deletions

View File

@ -11,10 +11,6 @@ KICKSTART_TEMPLATE="${BACKEND_DIR}/kickstart.tpl"
RUNTIME_BLUEPRINT_FILE="/run/tuxflotte/runtime/runtime_blueprint.json" RUNTIME_BLUEPRINT_FILE="/run/tuxflotte/runtime/runtime_blueprint.json"
SERVER_RESPONSE_FILE="/run/tuxflotte/server/response.json" SERVER_RESPONSE_FILE="/run/tuxflotte/server/response.json"
# Von 10_hardware.sh im selben Live-Boot geschrieben (siehe dort) - Quelle
# fuer den Fingerprint, der jetzt auch auf dem installierten Geraet selbst
# hinterlegt wird (siehe backend_generate_config()/kickstart.tpl %post).
HARDWARE_FILE="/run/tuxflotte/hardware/hardware.json"
RUNTIME_DIR="/run/tuxflotte/backend" RUNTIME_DIR="/run/tuxflotte/backend"
CONFIG_FILE="${RUNTIME_DIR}/config" CONFIG_FILE="${RUNTIME_DIR}/config"
@ -89,17 +85,6 @@ backend_generate_config() {
[[ -n "${device_id}" ]] || [[ -n "${device_id}" ]] ||
{ backend_fatal "Keine Geräte-ID in der Serverantwort gefunden."; return 1; } { backend_fatal "Keine Geräte-ID in der Serverantwort gefunden."; return 1; }
# Fuer die beidseitige Identifikation (Geraeteliste <-> Geraet selbst,
# siehe kickstart.tpl %post) - aus der bereits waehrend des Live-Boots
# berechneten hardware.json, nicht aus der Serverantwort (die kennt nur
# die zugewiesene device_id, nicht den urspruenglichen Hardware-Hash).
local device_fingerprint
[[ -r "${HARDWARE_FILE}" ]] ||
{ backend_fatal "Hardware-Erfassung nicht gefunden: ${HARDWARE_FILE}"; return 1; }
device_fingerprint="$(jq --raw-output '.identity.device_fingerprint // empty' "${HARDWARE_FILE}")"
[[ -n "${device_fingerprint}" ]] ||
{ backend_fatal "Kein device_fingerprint in ${HARDWARE_FILE} gefunden."; return 1; }
disk_encryption="$(jq --raw-output '.runtime_blueprint.installation_directives.disk_encryption' "${RUNTIME_BLUEPRINT_FILE}")" disk_encryption="$(jq --raw-output '.runtime_blueprint.installation_directives.disk_encryption' "${RUNTIME_BLUEPRINT_FILE}")"
partitioning="$(jq --raw-output '.runtime_blueprint.installation_directives.partitioning' "${RUNTIME_BLUEPRINT_FILE}")" partitioning="$(jq --raw-output '.runtime_blueprint.installation_directives.partitioning' "${RUNTIME_BLUEPRINT_FILE}")"
secure_boot_required="$(jq --raw-output '.runtime_blueprint.installation_directives.secure_boot_required' "${RUNTIME_BLUEPRINT_FILE}")" secure_boot_required="$(jq --raw-output '.runtime_blueprint.installation_directives.secure_boot_required' "${RUNTIME_BLUEPRINT_FILE}")"
@ -128,8 +113,7 @@ backend_generate_config() {
TUXFLOTTE_DEVICE_ID="${device_id}" \ TUXFLOTTE_DEVICE_ID="${device_id}" \
TUXFLOTTE_PARTITIONING_COMMAND="${partitioning_command}" \ TUXFLOTTE_PARTITIONING_COMMAND="${partitioning_command}" \
TUXFLOTTE_BLUEPRINTS_JSON="${blueprints_json}" \ TUXFLOTTE_BLUEPRINTS_JSON="${blueprints_json}" \
TUXFLOTTE_DEVICE_FINGERPRINT="${device_fingerprint}" \ envsubst '${TUXFLOTTE_HOSTNAME} ${TUXFLOTTE_DEVICE_ID} ${TUXFLOTTE_PARTITIONING_COMMAND} ${TUXFLOTTE_BLUEPRINTS_JSON}' \
envsubst '${TUXFLOTTE_HOSTNAME} ${TUXFLOTTE_DEVICE_ID} ${TUXFLOTTE_PARTITIONING_COMMAND} ${TUXFLOTTE_BLUEPRINTS_JSON} ${TUXFLOTTE_DEVICE_FINGERPRINT}' \
<"${KICKSTART_TEMPLATE}" >"${CONFIG_FILE}" <"${KICKSTART_TEMPLATE}" >"${CONFIG_FILE}"
chmod 0600 "${CONFIG_FILE}" chmod 0600 "${CONFIG_FILE}"

View File

@ -45,15 +45,6 @@ localectl set-x11-keymap de
install -d -m 0700 /etc/tuxflotte install -d -m 0700 /etc/tuxflotte
# Identifikation soll in beide Richtungen moeglich sein: die Geraeteliste
# zeigt den Fingerprint bereits an (siehe geraete_liste.html), aber bislang
# 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,
# kein chmod 0600 noetig wie bei agent.credentials.
echo "${TUXFLOTTE_DEVICE_FINGERPRINT}" > /etc/tuxflotte/device_fingerprint
cat > /etc/tuxflotte/runtime_blueprint.json <<'RUNTIME_BLUEPRINT_EOF' cat > /etc/tuxflotte/runtime_blueprint.json <<'RUNTIME_BLUEPRINT_EOF'
${TUXFLOTTE_BLUEPRINTS_JSON} ${TUXFLOTTE_BLUEPRINTS_JSON}
RUNTIME_BLUEPRINT_EOF RUNTIME_BLUEPRINT_EOF

View File

@ -12,10 +12,6 @@ POSTINSTALL_SCRIPT="${BACKEND_DIR}/postinstall.sh"
RUNTIME_BLUEPRINT_FILE="/run/tuxflotte/runtime/runtime_blueprint.json" RUNTIME_BLUEPRINT_FILE="/run/tuxflotte/runtime/runtime_blueprint.json"
SERVER_RESPONSE_FILE="/run/tuxflotte/server/response.json" SERVER_RESPONSE_FILE="/run/tuxflotte/server/response.json"
# Von 10_hardware.sh im selben Live-Boot geschrieben (siehe dort) - Quelle
# fuer den Fingerprint, der jetzt auch auf dem installierten Geraet selbst
# hinterlegt wird (siehe backend_generate_config()/postinstall.sh).
HARDWARE_FILE="/run/tuxflotte/hardware/hardware.json"
RUNTIME_DIR="/run/tuxflotte/backend" RUNTIME_DIR="/run/tuxflotte/backend"
CONFIG_FILE="${RUNTIME_DIR}/config" CONFIG_FILE="${RUNTIME_DIR}/config"
@ -259,17 +255,6 @@ backend_generate_config() {
[[ -n "${device_id}" ]] || [[ -n "${device_id}" ]] ||
{ backend_fatal "Keine Geräte-ID in der Serverantwort gefunden."; return 1; } { backend_fatal "Keine Geräte-ID in der Serverantwort gefunden."; return 1; }
# Fuer die beidseitige Identifikation (Geraeteliste <-> Geraet selbst,
# siehe postinstall.sh) - aus der bereits waehrend des Live-Boots
# berechneten hardware.json, nicht aus der Serverantwort (die kennt nur
# die zugewiesene device_id, nicht den urspruenglichen Hardware-Hash).
local device_fingerprint
[[ -r "${HARDWARE_FILE}" ]] ||
{ backend_fatal "Hardware-Erfassung nicht gefunden: ${HARDWARE_FILE}"; return 1; }
device_fingerprint="$(jq --raw-output '.identity.device_fingerprint // empty' "${HARDWARE_FILE}")"
[[ -n "${device_fingerprint}" ]] ||
{ backend_fatal "Kein device_fingerprint in ${HARDWARE_FILE} gefunden."; return 1; }
partitioning_json="$(jq --compact-output '.runtime_blueprint.installation_directives.partitioning' "${RUNTIME_BLUEPRINT_FILE}")" partitioning_json="$(jq --compact-output '.runtime_blueprint.installation_directives.partitioning' "${RUNTIME_BLUEPRINT_FILE}")"
secure_boot_required="$(jq --raw-output '.runtime_blueprint.installation_directives.secure_boot_required' "${RUNTIME_BLUEPRINT_FILE}")" secure_boot_required="$(jq --raw-output '.runtime_blueprint.installation_directives.secure_boot_required' "${RUNTIME_BLUEPRINT_FILE}")"
@ -292,8 +277,7 @@ backend_generate_config() {
postinstall_rendered="$( postinstall_rendered="$(
TUXFLOTTE_DEVICE_ID="${device_id}" \ TUXFLOTTE_DEVICE_ID="${device_id}" \
TUXFLOTTE_BLUEPRINTS_JSON="${blueprints_json}" \ TUXFLOTTE_BLUEPRINTS_JSON="${blueprints_json}" \
TUXFLOTTE_DEVICE_FINGERPRINT="${device_fingerprint}" \ envsubst '${TUXFLOTTE_DEVICE_ID} ${TUXFLOTTE_BLUEPRINTS_JSON}' \
envsubst '${TUXFLOTTE_DEVICE_ID} ${TUXFLOTTE_BLUEPRINTS_JSON} ${TUXFLOTTE_DEVICE_FINGERPRINT}' \
<"${POSTINSTALL_SCRIPT}" <"${POSTINSTALL_SCRIPT}"
)" )"

View File

@ -19,16 +19,6 @@ AGENT_REPO_RAW="https://git.tuxflotte.de/admin/provisioning-agent/raw/branch/mai
install -d -m 0700 /etc/tuxflotte || install -d -m 0700 /etc/tuxflotte ||
tuxflotte_agent_fatal "Verzeichnis /etc/tuxflotte konnte nicht angelegt werden." tuxflotte_agent_fatal "Verzeichnis /etc/tuxflotte konnte nicht angelegt werden."
# Identifikation soll in beide Richtungen moeglich sein: die Geraeteliste
# zeigt den Fingerprint bereits an (siehe geraete_liste.html), aber bislang
# 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,
# kein chmod 0600 noetig wie bei agent.credentials.
echo "${TUXFLOTTE_DEVICE_FINGERPRINT}" > /etc/tuxflotte/device_fingerprint ||
tuxflotte_agent_fatal "device_fingerprint konnte nicht abgelegt werden."
cat > /etc/tuxflotte/runtime_blueprint.json <<'RUNTIME_BLUEPRINT_EOF' cat > /etc/tuxflotte/runtime_blueprint.json <<'RUNTIME_BLUEPRINT_EOF'
${TUXFLOTTE_BLUEPRINTS_JSON} ${TUXFLOTTE_BLUEPRINTS_JSON}
RUNTIME_BLUEPRINT_EOF RUNTIME_BLUEPRINT_EOF