4.5 KiB
4.5 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:
- Neue Agent-Binary im Frontend hochladen (Firmware-Seite) oder per API
- Update-Flag bei einzelnem Agent oder "Alle updaten" setzen
- Updater auf der Firewall erkennt den Flag (pollt alle 60s)
- Binary wird vom Backend heruntergeladen und SHA256-verifiziert
- Agent wird gestoppt, Binary ersetzt, Agent gestartet
- 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://your-backend:8443/api/v1/firmware/upload?version=1.0.3&platform=freebsd" \
-H "X-API-Key: YOUR_API_KEY" \
--data-binary @build/rmm-agent
# Linux Agent hochladen
curl -sk -X POST "https://your-backend:8443/api/v1/firmware/upload?version=1.0.3&platform=linux" \
-H "X-API-Key: YOUR_API_KEY" \
--data-binary @build/rmm-agent-linux
# Update fuer einzelnen Agent anfordern
curl -sk -X POST "https://your-backend:8443/api/v1/agents/e92e87a6.../request-update" \
-H "X-API-Key: YOUR_API_KEY"
# Update fuer alle Agents anfordern
curl -sk -X POST "https://your-backend:8443/api/v1/agents/request-update-all" \
-H "X-API-Key: YOUR_API_KEY"
Updater — Technische Details
- Separates Go-Binary (
rmm-updater), laeuft alsrmm_updaterrc.d Service - Liest die gleiche
config.yamlwie 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
.bakwaehrend des Updates - Logs:
/var/log/rmm-updater.log
OPNsense-Updates (Core + Packages)
Normales Update
Patches innerhalb der gleichen Version:
opnsense-update— Core-Update herunterladenpkg upgrade -y— Paket-Updates installieren- 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:
opnsense-update -r <version> -bkp— Repository wechseln + Base + Kernel + Packages herunterladenpkg-static update -f— Repository-Katalog forciert aktualisierenpkg-static upgrade -y— Alle Pakete auf neue Version installieren- 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: YOUR_API_KEY" -X POST \
https://your-backend:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/update-check
# Normales Update mit Reboot
curl -sk -H "X-API-Key: YOUR_API_KEY" -X POST \
https://your-backend:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/update \
-d '{"reboot":true}'
# Major-Upgrade auf Version 26.7
curl -sk -H "X-API-Key: YOUR_API_KEY" -X POST \
https://your-backend:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/major-update \
-d '{"version":"26.7","reboot":true}'
# Reboot (5s Verzoegerung default)
curl -sk -H "X-API-Key: YOUR_API_KEY" -X POST \
https://your-backend:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887/reboot