docs: FIRMWARE.md in agent-bsd/README.md zusammengeführt und gelöscht
This commit is contained in:
+119
-19
@@ -7,33 +7,28 @@ Systemdaten via Heartbeat sowie Remote-Commands über WebSocket.
|
||||
|
||||
- OPNsense (FreeBSD, amd64)
|
||||
|
||||
## Installation via OPNsense Plugin
|
||||
---
|
||||
|
||||
### 1. Repo klonen und Plugin bauen (auf dem Backend-Server)
|
||||
## Installation (Erstinstallation)
|
||||
|
||||
### 1. Repo klonen und Release bauen (auf dem Build-Server)
|
||||
|
||||
```bash
|
||||
git clone https://git.cynfo.net/christian/rmm2.git /opt/rmm
|
||||
cd /opt/rmm
|
||||
make agent # Baut das FreeBSD-Binary
|
||||
make plugin # Paketiert das OPNsense-Plugin (.pkg)
|
||||
make release VERSION=1.0.3
|
||||
# → build/release/rmm-freebsd-1.0.3.zip
|
||||
# enthält: rmm-agent + rmm-updater-freebsd + install.sh
|
||||
```
|
||||
|
||||
### 2. Installer-ZIP im Frontend hochladen
|
||||
|
||||
**Frontend → Firmware → Installer-Pakete → freebsd → ZIP hochladen**
|
||||
|
||||
Das ZIP enthält: `rmm-agent` + `rmm-updater-freebsd` + `install.sh`
|
||||
|
||||
```bash
|
||||
# ZIP bauen (auf dem Build-Server)
|
||||
cd /opt/rmm
|
||||
make release VERSION=1.0.3
|
||||
# → build/release/rmm-freebsd-1.0.3.zip
|
||||
```
|
||||
Das Frontend zeigt nach dem Upload den fertigen Installationsbefehl mit Copy-Button.
|
||||
|
||||
### 3. Installer auf der Firewall ausführen
|
||||
|
||||
Das Frontend zeigt nach dem Upload den fertigen Befehl mit Copy-Button.
|
||||
Auf der OPNsense-Firewall (SSH als root):
|
||||
|
||||
```bash
|
||||
@@ -43,7 +38,7 @@ fetch --no-verify-peer --no-verify-hostname \
|
||||
&& cd /tmp && unzip -o installer.zip && sh /tmp/install.sh
|
||||
```
|
||||
|
||||
### 3. Im WebGUI konfigurieren
|
||||
### 4. Im WebGUI konfigurieren
|
||||
|
||||
**Services → RMM Agent** öffnen und eintragen:
|
||||
|
||||
@@ -53,6 +48,102 @@ fetch --no-verify-peer --no-verify-hostname \
|
||||
| API Key | API-Key aus `backend/config.yaml` |
|
||||
| Agent Name | Anzeigename im RMM-Frontend |
|
||||
|
||||
---
|
||||
|
||||
## Agent-Binary aktualisieren (OTA)
|
||||
|
||||
Für Updates auf bereits installierten Agents übernimmt der `rmm-updater` Daemon die Verteilung automatisch.
|
||||
|
||||
### Ablauf
|
||||
|
||||
1. Neues Binary im Frontend hochladen (nur das Binary, kein ZIP)
|
||||
2. Update-Flag bei einzelnem Agent oder "Alle updaten" setzen
|
||||
3. Updater auf der Firewall erkennt den Flag (pollt alle 60s)
|
||||
4. Binary wird heruntergeladen und SHA256-verifiziert
|
||||
5. Agent wird gestoppt, Binary ersetzt, Agent gestartet
|
||||
6. Flag wird automatisch zurückgesetzt
|
||||
|
||||
### Binary bauen und hochladen
|
||||
|
||||
```bash
|
||||
cd /opt/rmm
|
||||
make agent VERSION=1.0.4
|
||||
# → build/rmm-agent
|
||||
```
|
||||
|
||||
**Frontend → Firmware → Agent-Binary → Version + freebsd → Binary hochladen**
|
||||
|
||||
Oder per API:
|
||||
|
||||
```bash
|
||||
curl -sk -X POST "https://BACKEND_IP:8443/api/v1/firmware/upload?version=1.0.4&platform=freebsd" \
|
||||
-H "X-API-Key: DEIN_API_KEY" \
|
||||
--data-binary @build/rmm-agent
|
||||
```
|
||||
|
||||
### Update auslösen
|
||||
|
||||
```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"
|
||||
```
|
||||
|
||||
### Updater-Details
|
||||
|
||||
- Binary: `rmm-updater-freebsd`, läuft als `rmm_updater` rc.d Service
|
||||
- Liest dieselbe `config.yaml` wie der Agent
|
||||
- SHA256-Verifizierung vor Ersetzung
|
||||
- Automatisches Rollback bei fehlgeschlagenem Agent-Start
|
||||
- Backup der alten Binary als `.bak`
|
||||
- Logs: `/var/log/rmm-updater.log`
|
||||
|
||||
---
|
||||
|
||||
## OPNsense-Updates (Core + Packages)
|
||||
|
||||
### Normales Update (Patches innerhalb der gleichen Version)
|
||||
|
||||
Über **Frontend → Firewall → Agent-Tab → Update** oder per API:
|
||||
|
||||
```bash
|
||||
curl -sk -H "X-API-Key: DEIN_API_KEY" -X POST \
|
||||
https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/update \
|
||||
-d '{"reboot":true}'
|
||||
```
|
||||
|
||||
Ablauf im Agent:
|
||||
1. `opnsense-update` — Core-Update herunterladen
|
||||
2. `pkg upgrade -y` — Paket-Updates installieren
|
||||
3. Prüfung ob Reboot nötig (`opnsense-update -c`)
|
||||
|
||||
### Major-Upgrade (z.B. 25.7 → 26.1)
|
||||
|
||||
```bash
|
||||
# Phase 1: Base + Kernel + Packages herunterladen, dann Reboot
|
||||
curl -sk -H "X-API-Key: DEIN_API_KEY" -X POST \
|
||||
https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/major-update \
|
||||
-d '{"version":"26.1","reboot":true}'
|
||||
|
||||
# Phase 2: nach Reboot — Pakete finalisieren
|
||||
curl -sk -H "X-API-Key: DEIN_API_KEY" -X POST \
|
||||
https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/major-update \
|
||||
-d '{"version":"26.1","phase":"2"}'
|
||||
```
|
||||
|
||||
### Update-Check
|
||||
|
||||
```bash
|
||||
curl -sk -H "X-API-Key: DEIN_API_KEY" -X POST \
|
||||
https://BACKEND_IP:8443/api/v1/agents/AGENT_ID/update-check
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Konfigurationsdatei
|
||||
|
||||
```yaml
|
||||
@@ -63,21 +154,26 @@ agent_name: "OPN.intra.kunde.de"
|
||||
insecure: true # false wenn gültiges TLS-Zertifikat vorhanden
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Service-Management (FreeBSD)
|
||||
|
||||
```bash
|
||||
# Status
|
||||
# Agent
|
||||
service rmm-agent status
|
||||
service rmm-agent start | stop | restart
|
||||
|
||||
# Start / Stop / Restart
|
||||
service rmm-agent start
|
||||
service rmm-agent stop
|
||||
service rmm-agent restart
|
||||
# Updater
|
||||
service rmm_updater status
|
||||
service rmm_updater start | stop | restart
|
||||
|
||||
# Logs
|
||||
tail -f /var/log/rmm-agent.log
|
||||
tail -f /var/log/rmm-updater.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Gesammelte Daten (Heartbeat alle 60s)
|
||||
|
||||
| Collector | Daten |
|
||||
@@ -97,6 +193,8 @@ tail -f /var/log/rmm-agent.log
|
||||
| Updates | Verfügbare Core + Package Updates |
|
||||
| Cron | System-Crontab + OPNsense Jobs |
|
||||
|
||||
---
|
||||
|
||||
## Remote-Commands (via WebSocket)
|
||||
|
||||
| Command | Beschreibung |
|
||||
@@ -110,6 +208,8 @@ tail -f /var/log/rmm-agent.log
|
||||
| `wg_add_peer` | WireGuard-Peer anlegen |
|
||||
| `wg_delete_peer` | WireGuard-Peer löschen |
|
||||
|
||||
---
|
||||
|
||||
## Hinweise (FreeBSD)
|
||||
|
||||
- Volle Pfade verwenden: `/usr/local/sbin/pluginctl`, `/usr/bin/netstat`
|
||||
|
||||
Reference in New Issue
Block a user