102 lines
2.6 KiB
Markdown
102 lines
2.6 KiB
Markdown
# RMM Updater
|
|
|
|
Separater Update-Daemon für RMM-Agents. Läuft neben dem Agent und übernimmt
|
|
OTA-Updates (Over-the-Air) ohne manuelle Eingriffe.
|
|
|
|
**Cross-Platform:** Ein Quellcode, zwei Build-Targets — FreeBSD (OPNsense) und Linux.
|
|
Die Plattform wird zur Laufzeit per `runtime.GOOS` erkannt.
|
|
|
|
---
|
|
|
|
## Wie es funktioniert
|
|
|
|
1. Backend setzt `update_requested = true` für einen Agent (manuell oder via Frontend)
|
|
2. Updater pollt alle 60s: `GET /api/v1/firmware?platform=<freebsd|linux>`
|
|
3. Wenn neue Version verfügbar: ZIP-Bundle herunterladen + SHA256 prüfen
|
|
4. Agent stoppen → Binary ersetzen → Agent starten
|
|
5. Bei Fehler: automatischer Rollback auf `.bak`-Backup
|
|
6. `update_requested` wird zurückgesetzt
|
|
|
|
---
|
|
|
|
## Plattform-spezifische Pfade
|
|
|
|
| | FreeBSD (OPNsense) | Linux |
|
|
|--|--|--|
|
|
| Agent-Binary | `/usr/local/rmm/rmm-agent` | `/usr/local/bin/rmm-agent` |
|
|
| Updater-Binary | `/usr/local/rmm/rmm-updater` | `/usr/local/bin/rmm-updater` |
|
|
| Config | `/usr/local/etc/rmm-agent/config.yaml` | `/etc/rmm/config.yaml` |
|
|
| Service stoppen | `service rmm-agent stop` | `systemctl stop rmm-agent` |
|
|
| Service starten | `service rmm-agent start` | `systemctl start rmm-agent` |
|
|
| Logs | `/var/log/rmm-updater.log` | `journalctl -u rmm-updater` |
|
|
| ZIP-Name Agent | `rmm-agent` | `rmm-agent-linux` |
|
|
| ZIP-Name Updater | `rmm-updater-freebsd` | `rmm-updater-linux` |
|
|
|
|
---
|
|
|
|
## Konfiguration
|
|
|
|
Liest dieselbe `config.yaml` wie der Agent — keine eigene Konfigurationsdatei nötig.
|
|
|
|
```yaml
|
|
backend_url: "https://BACKEND_IP:8443"
|
|
api_key: "DEIN_API_KEY"
|
|
insecure: true
|
|
```
|
|
|
|
---
|
|
|
|
## Bauen
|
|
|
|
```bash
|
|
# Auf dem Build-Server
|
|
cd /opt/rmm
|
|
|
|
# FreeBSD
|
|
make updater-freebsd VERSION=1.0.3
|
|
# → build/rmm-updater-freebsd
|
|
|
|
# Linux
|
|
make updater-linux VERSION=1.0.3
|
|
# → build/rmm-updater-linux
|
|
|
|
# Beides + Agent in einem ZIP (empfohlen)
|
|
make release VERSION=1.0.3
|
|
# → build/release/rmm-freebsd-1.0.3.zip (rmm-agent + rmm-updater-freebsd + install.sh)
|
|
# → build/release/rmm-linux-1.0.3.zip (rmm-agent-linux + rmm-updater-linux + install.sh)
|
|
```
|
|
|
|
---
|
|
|
|
## Service-Management
|
|
|
|
### FreeBSD (OPNsense)
|
|
|
|
```bash
|
|
service rmm_updater status
|
|
service rmm_updater start | stop | restart
|
|
tail -f /var/log/rmm-updater.log
|
|
```
|
|
|
|
### Linux
|
|
|
|
```bash
|
|
systemctl status rmm-updater
|
|
systemctl start | stop | restart rmm-updater
|
|
journalctl -u rmm-updater -f
|
|
```
|
|
|
|
---
|
|
|
|
## Update manuell auslösen (API)
|
|
|
|
```bash
|
|
# Einzelnen Agent updaten
|
|
curl -sk -X POST "https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/request-update" \
|
|
-H "X-API-Key: DEIN_API_KEY"
|
|
|
|
# Alle Agents updaten
|
|
curl -sk -X POST "https://BACKEND_IP:8443/api/v1/agents/request-update-all" \
|
|
-H "X-API-Key: DEIN_API_KEY"
|
|
```
|