|
|
|
@@ -6,12 +6,12 @@ React + Vite + TailwindCSS Web-Frontend fuer das OPNsense RMM System.
|
|
|
|
|
|
|
|
|
|
| | |
|
|
|
|
|
|---|---|
|
|
|
|
|
| **Server** | 192.168.85.20 (Debian 13, Nginx) |
|
|
|
|
|
| **Server** | your-backend (Debian 13, Nginx) |
|
|
|
|
|
| **Tech** | React 18, Vite, TailwindCSS, Recharts, Zustand, lucide-react |
|
|
|
|
|
| **Theme** | Dark mit Orange-Akzent, komplett deutsch |
|
|
|
|
|
| **Auth** | JWT Login (8h Token) |
|
|
|
|
|
| **Default-Login** | `admin` / `Start!123` |
|
|
|
|
|
| **Backend** | https://192.168.85.13:8443 |
|
|
|
|
|
| **Default-Login** | `admin` / `YOUR_PASSWORD` |
|
|
|
|
|
| **Backend** | https://your-backend:8443 |
|
|
|
|
|
|
|
|
|
|
## Seiten
|
|
|
|
|
|
|
|
|
@@ -61,13 +61,13 @@ GET /api/v1/auth/me Eigene Benutzerdaten
|
|
|
|
|
**Beispiel:**
|
|
|
|
|
```bash
|
|
|
|
|
# Login
|
|
|
|
|
curl -sk -X POST https://192.168.85.13:8443/api/v1/auth/login \
|
|
|
|
|
-d '{"username":"admin","password":"Start!123"}'
|
|
|
|
|
curl -sk -X POST https://your-backend:8443/api/v1/auth/login \
|
|
|
|
|
-d '{"username":"admin","password":"YOUR_PASSWORD"}'
|
|
|
|
|
# → {"token":"eyJhbG...","user":{"id":1,"username":"admin"}}
|
|
|
|
|
|
|
|
|
|
# Eigene Daten
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/auth/me
|
|
|
|
|
https://your-backend:8443/api/v1/auth/me
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Agents (Firewalls)
|
|
|
|
@@ -86,28 +86,28 @@ DELETE /api/v1/agents/{id}/customer Kundenzuordnung entfernen
|
|
|
|
|
```bash
|
|
|
|
|
# Alle Agents
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents
|
|
|
|
|
https://your-backend:8443/api/v1/agents
|
|
|
|
|
|
|
|
|
|
# Agent-Details mit Systemdaten
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee
|
|
|
|
|
|
|
|
|
|
# Firewall pre-registrieren
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents \
|
|
|
|
|
https://your-backend:8443/api/v1/agents \
|
|
|
|
|
-d '{"name":"OPN.intra.kunde.de","customer_id":1}'
|
|
|
|
|
|
|
|
|
|
# Agent loeschen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X DELETE \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a684b20db15d8d2344583c5887
|
|
|
|
|
|
|
|
|
|
# Events (letzte 50)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee/events?limit=50"
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee/events?limit=50"
|
|
|
|
|
|
|
|
|
|
# Kunden zuordnen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X PUT \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee/customer \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd38ecf03eab6c0f21b4ac7bee/customer \
|
|
|
|
|
-d '{"customer_id":1}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@@ -125,17 +125,17 @@ GET /api/v1/customers/{id}/agents Agents eines Kunden
|
|
|
|
|
```bash
|
|
|
|
|
# Kunden anlegen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/customers \
|
|
|
|
|
https://your-backend:8443/api/v1/customers \
|
|
|
|
|
-d '{"number":"K05001","name":"Beispiel GmbH"}'
|
|
|
|
|
|
|
|
|
|
# Kunden aktualisieren
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X PUT \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/customers/1 \
|
|
|
|
|
https://your-backend:8443/api/v1/customers/1 \
|
|
|
|
|
-d '{"number":"K05001","name":"Beispiel AG"}'
|
|
|
|
|
|
|
|
|
|
# Agents eines Kunden
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/customers/1/agents
|
|
|
|
|
https://your-backend:8443/api/v1/customers/1/agents
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Benutzer (Users)
|
|
|
|
@@ -151,12 +151,12 @@ DELETE /api/v1/users/{id} Benutzer loeschen
|
|
|
|
|
```bash
|
|
|
|
|
# Benutzer anlegen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/users \
|
|
|
|
|
https://your-backend:8443/api/v1/users \
|
|
|
|
|
-d '{"username":"operator","password":"Sicher!123"}'
|
|
|
|
|
|
|
|
|
|
# Passwort aendern
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X PUT \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/users/1/password \
|
|
|
|
|
https://your-backend:8443/api/v1/users/1/password \
|
|
|
|
|
-d '{"password":"NeuesPasswort!123"}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@@ -173,15 +173,15 @@ Verfuegbare Metriken: `cpu_usage`, `memory_used_percent`, `memory_used_bytes`, `
|
|
|
|
|
```bash
|
|
|
|
|
# CPU letzte 24h
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../metrics?metric=cpu_usage"
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd.../metrics?metric=cpu_usage"
|
|
|
|
|
|
|
|
|
|
# RAM mit Zeitraum
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../metrics?metric=memory_used_percent&from=2026-03-01T00:00:00Z&to=2026-03-01T23:59:59Z"
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd.../metrics?metric=memory_used_percent&from=2026-03-01T00:00:00Z&to=2026-03-01T23:59:59Z"
|
|
|
|
|
|
|
|
|
|
# 5-Minuten-Durchschnitte
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../metrics/summary?metric=cpu_usage&bucket=5+minutes"
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd.../metrics/summary?metric=cpu_usage&bucket=5+minutes"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Config-Backups
|
|
|
|
@@ -199,20 +199,20 @@ GET /api/v1/agents/{id}/backups/diff Diff (?a=ID&b=ID)
|
|
|
|
|
```bash
|
|
|
|
|
# Backup ausloesen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../backup
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd.../backup
|
|
|
|
|
|
|
|
|
|
# Backups auflisten
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../backups
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd.../backups
|
|
|
|
|
|
|
|
|
|
# Als XML herunterladen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../backups/latest?format=xml" \
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd.../backups/latest?format=xml" \
|
|
|
|
|
-o config-backup.xml
|
|
|
|
|
|
|
|
|
|
# Diff zwischen zwei Backups
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../backups/diff?a=1&b=3"
|
|
|
|
|
"https://your-backend:8443/api/v1/agents/6beb8dfd.../backups/diff?a=1&b=3"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Tunnel
|
|
|
|
@@ -227,29 +227,29 @@ DELETE /api/v1/agents/{id}/tunnel/{tid} Tunnel schliessen
|
|
|
|
|
```bash
|
|
|
|
|
# SSH-Tunnel
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../tunnel \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../tunnel \
|
|
|
|
|
-d '{"target_host":"127.0.0.1","target_port":22}'
|
|
|
|
|
# → {"tunnel_id":"abc123","proxy_port":10000,...}
|
|
|
|
|
# Dann: ssh -p 10000 root@192.168.85.13
|
|
|
|
|
# Dann: ssh -p 10000 root@your-backend
|
|
|
|
|
|
|
|
|
|
# WebGUI-Tunnel (OPNsense Port 4444)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../tunnel \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../tunnel \
|
|
|
|
|
-d '{"target_host":"127.0.0.1","target_port":4444}'
|
|
|
|
|
# Im Browser: https://192.168.85.13:10001/
|
|
|
|
|
# Im Browser: https://your-backend:10001/
|
|
|
|
|
|
|
|
|
|
# PVE WebGUI-Tunnel (Proxmox Port 8006)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/3f0a83a2.../tunnel \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/3f0a83a2.../tunnel \
|
|
|
|
|
-d '{"target_host":"127.0.0.1","target_port":8006}'
|
|
|
|
|
|
|
|
|
|
# Aktive Tunnel
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../tunnels
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../tunnels
|
|
|
|
|
|
|
|
|
|
# Tunnel schliessen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X DELETE \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../tunnel/abc123
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../tunnel/abc123
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### WireGuard Peer-Management
|
|
|
|
@@ -264,17 +264,17 @@ DELETE /api/v1/agents/{id}/wireguard/peers/{uuid} Peer loeschen
|
|
|
|
|
```bash
|
|
|
|
|
# Peer anlegen (Auto: Keypair, naechste freie IP, Endpoint)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../wireguard/peers \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd.../wireguard/peers \
|
|
|
|
|
-d '{"name":"VPN_MUELLER","allowed_ips":"0.0.0.0/0","dns":"10.172.100.210"}'
|
|
|
|
|
# → {peer_config: "[Interface]\nPrivateKey=...\n[Peer]\n...", ...}
|
|
|
|
|
|
|
|
|
|
# Alle Peers
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../wireguard/peers
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd.../wireguard/peers
|
|
|
|
|
|
|
|
|
|
# Peer loeschen
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X DELETE \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/6beb8dfd.../wireguard/peers/89c10e2d-148e-11f1-a7af-7c5a1c6c7b73
|
|
|
|
|
https://your-backend:8443/api/v1/agents/6beb8dfd.../wireguard/peers/89c10e2d-148e-11f1-a7af-7c5a1c6c7b73
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Remote-Befehle (Exec)
|
|
|
|
@@ -286,7 +286,7 @@ POST /api/v1/agents/{id}/exec Befehl ausfuehren
|
|
|
|
|
**Beispiel:**
|
|
|
|
|
```bash
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../exec \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../exec \
|
|
|
|
|
-d '{"command":"uptime","timeout":30}'
|
|
|
|
|
# → {"data":{"output":"10:30AM up 45 days, ..."}, "status":"ok"}
|
|
|
|
|
```
|
|
|
|
@@ -304,16 +304,16 @@ POST /api/v1/agents/{id}/reboot Reboot
|
|
|
|
|
```bash
|
|
|
|
|
# Update-Check
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../update-check
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../update-check
|
|
|
|
|
|
|
|
|
|
# Update mit Reboot
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../update \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../update \
|
|
|
|
|
-d '{"reboot":true}'
|
|
|
|
|
|
|
|
|
|
# Major-Update Phase 1
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../major-update \
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../major-update \
|
|
|
|
|
-d '{"version":"26.1","reboot":true}'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@@ -332,25 +332,25 @@ POST /api/v1/agents/request-update-all Alle Agents updaten
|
|
|
|
|
```bash
|
|
|
|
|
# Firmware-Info
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/firmware
|
|
|
|
|
https://your-backend:8443/api/v1/firmware
|
|
|
|
|
|
|
|
|
|
# Firmware hochladen (FreeBSD)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/firmware/upload?version=1.0.3&platform=freebsd" \
|
|
|
|
|
"https://your-backend:8443/api/v1/firmware/upload?version=1.0.3&platform=freebsd" \
|
|
|
|
|
--data-binary @build/rmm-agent
|
|
|
|
|
|
|
|
|
|
# Firmware hochladen (Linux)
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
"https://192.168.85.13:8443/api/v1/firmware/upload?version=1.0.1&platform=linux" \
|
|
|
|
|
"https://your-backend:8443/api/v1/firmware/upload?version=1.0.1&platform=linux" \
|
|
|
|
|
--data-binary @build/rmm-agent-linux
|
|
|
|
|
|
|
|
|
|
# Update fuer einzelnen Agent anfordern
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/e92e87a6.../request-update
|
|
|
|
|
https://your-backend:8443/api/v1/agents/e92e87a6.../request-update
|
|
|
|
|
|
|
|
|
|
# Update fuer alle Agents
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" -X POST \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/agents/request-update-all
|
|
|
|
|
https://your-backend:8443/api/v1/agents/request-update-all
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Hub-Status
|
|
|
|
@@ -362,7 +362,7 @@ GET /api/v1/hub/status WebSocket Hub Status
|
|
|
|
|
**Beispiel:**
|
|
|
|
|
```bash
|
|
|
|
|
curl -sk -H "Authorization: Bearer <TOKEN>" \
|
|
|
|
|
https://192.168.85.13:8443/api/v1/hub/status
|
|
|
|
|
https://your-backend:8443/api/v1/hub/status
|
|
|
|
|
# → {"connected_agents":3,"active_tunnels":1}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@@ -376,8 +376,8 @@ npm install
|
|
|
|
|
npm run build # ~330 KB JS, ~32 KB CSS
|
|
|
|
|
|
|
|
|
|
# Deploy
|
|
|
|
|
ssh root@192.168.85.20 'rm -rf /var/www/html/assets/*' # Alte Hashes loeschen!
|
|
|
|
|
scp -r dist/* root@192.168.85.20:/var/www/html/
|
|
|
|
|
ssh root@your-backend 'rm -rf /var/www/html/assets/*' # Alte Hashes loeschen!
|
|
|
|
|
scp -r dist/* root@your-backend:/var/www/html/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Wichtig:** Vor Deploy immer `assets/` loeschen — Vite generiert Hash-basierte Dateinamen, alte Dateien bleiben sonst auf dem Server.
|
|
|
|
@@ -389,7 +389,7 @@ cd frontend
|
|
|
|
|
npm run dev # Startet Vite Dev-Server mit Proxy zu Backend
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Vite Proxy-Config (`vite.config.js`): `/api/` wird auf `https://192.168.85.13:8443` weitergeleitet.
|
|
|
|
|
Vite Proxy-Config (`vite.config.js`): `/api/` wird auf `https://your-backend:8443` weitergeleitet.
|
|
|
|
|
|
|
|
|
|
## Dateistruktur
|
|
|
|
|
|
|
|
|
|