rmm2/docs/FIRMWARE.md

4.7 KiB

Firmware-Management & Update-Prozess

Multi-Plattform Firmware-Verwaltung fuer Agent-Binaries und OPNsense-Updates.

Agent-Firmware (Binary-Updates)

Ueberblick

Der Update-Prozess fuer Agent-Binaries nutzt den rmm-updater Daemon:

  1. Neue Agent-Binary im Frontend hochladen (Firmware-Seite) oder per API
  2. Update-Flag bei einzelnem Agent oder "Alle updaten" setzen
  3. Updater auf der Firewall erkennt den Flag (pollt alle 60s)
  4. Binary wird vom Backend heruntergeladen und SHA256-verifiziert
  5. Agent wird gestoppt, Binary ersetzt, Agent gestartet
  6. Flag wird automatisch zurueckgesetzt

Unterstuetzte Plattformen

Plattform Binary Ziel
freebsd rmm-agent OPNsense Firewalls (amd64)
linux rmm-agent-linux Linux-basierte Agents
windows rmm-agent.exe Windows-basierte Agents

API-Endpoints

Methode Endpoint Beschreibung
GET /api/v1/firmware Alle Firmware-Versionen (pro Plattform)
GET /api/v1/firmware?platform=freebsd Firmware einer Plattform
POST /api/v1/firmware/upload?version=X&platform=Y Binary hochladen (Body = Raw Binary)
GET /api/v1/firmware/download?platform=Y Binary herunterladen (fuer Updater)
POST /api/v1/agents/{id}/request-update Update-Flag setzen
DELETE /api/v1/agents/{id}/request-update Update-Flag zuruecksetzen
POST /api/v1/agents/request-update-all Update-Flag fuer alle Agents setzen
POST /api/v1/agents/{id}/agent-update Legacy: Binary direkt via WebSocket pushen

Beispiele

# FreeBSD Agent hochladen
curl -sk -X POST "https://192.168.85.13:8443/api/v1/firmware/upload?version=1.0.3&platform=freebsd" \
  -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" \
  --data-binary @build/rmm-agent

# Linux Agent hochladen
curl -sk -X POST "https://192.168.85.13:8443/api/v1/firmware/upload?version=1.0.3&platform=linux" \
  -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" \
  --data-binary @build/rmm-agent-linux

# Update fuer einzelnen Agent anfordern
curl -sk -X POST "https://192.168.85.13:8443/api/v1/agents/e92e87a6.../request-update" \
  -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9"

# Update fuer alle Agents anfordern
curl -sk -X POST "https://192.168.85.13:8443/api/v1/agents/request-update-all" \
  -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9"

Updater — Technische Details

  • Separates Go-Binary (rmm-updater), laeuft als rmm_updater rc.d Service
  • Liest die gleiche config.yaml wie der Agent (Backend-URL, API-Key)
  • Download ueber GET /api/v1/firmware/download?platform=freebsd
  • SHA256-Verifizierung vor Ersetzung
  • Automatisches Rollback bei fehlgeschlagenem Agent-Start
  • Backup der alten Binary als .bak waehrend des Updates
  • Logs: /var/log/rmm-updater.log

OPNsense-Updates (Core + Packages)

Normales Update

Patches innerhalb der gleichen Version:

  1. opnsense-update — Core-Update herunterladen
  2. pkg upgrade -y — Paket-Updates installieren
  3. Nachpruefung: opnsense-update -c — Exit 1 = Reboot noetig

Response enthaelt reboot_required: true/false fuer das Frontend.

Major-Upgrade

z.B. 25.7 → 26.1:

  1. opnsense-update -r <version> -bkp — Repository wechseln + Base + Kernel + Packages herunterladen
  2. pkg-static update -f — Repository-Katalog forciert aktualisieren
  3. pkg-static upgrade -y — Alle Pakete auf neue Version installieren
  4. Reboot erforderlich (immer bei Major-Upgrade)

API-Endpoints

Methode Endpoint Beschreibung
POST /api/v1/agents/{id}/update-check Verfuegbare Updates pruefen
POST /api/v1/agents/{id}/update Normales Update (Core + Packages)
POST /api/v1/agents/{id}/major-update Major-Upgrade auf Zielversion
POST /api/v1/agents/{id}/reboot Reboot ausfuehren

Beispiele

# Verfuegbare Updates pruefen
curl -sk -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" -X POST \
  https://192.168.85.13:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/update-check

# Normales Update mit Reboot
curl -sk -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" -X POST \
  https://192.168.85.13:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/update \
  -d '{"reboot":true}'

# Major-Upgrade auf Version 26.7
curl -sk -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" -X POST \
  https://192.168.85.13:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/major-update \
  -d '{"version":"26.7","reboot":true}'

# Reboot (5s Verzoegerung default)
curl -sk -H "X-API-Key: 01532e5a7c9e70bf2757df77a2f5b9b9" -X POST \
  https://192.168.85.13:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/reboot