refactor: agent/ → agent-bsd/, README.md für BSD-Agent erstellt, Referenzen aktualisiert

This commit is contained in:
cynfo3000 2026-03-06 09:48:05 +01:00
parent 39c168e946
commit f3b052e2c7
32 changed files with 111 additions and 3 deletions

4
.gitignore vendored
View File

@ -2,7 +2,7 @@
# Konfigurationen mit Passwörtern — NIEMALS einchecken # Konfigurationen mit Passwörtern — NIEMALS einchecken
# ======================== # ========================
config.yaml config.yaml
agent/config.yaml agent-bsd/config.yaml
backend/config.yaml backend/config.yaml
opnsense-plugin/src/opnsense/service/templates/OPNsense/RMMAgent/config.yaml opnsense-plugin/src/opnsense/service/templates/OPNsense/RMMAgent/config.yaml
@ -23,7 +23,7 @@ certs/
# Kompilierte Binaries # Kompilierte Binaries
# ======================== # ========================
backend/rmm-backend backend/rmm-backend
agent/rmm-agent agent-bsd/rmm-agent
agent-linux/rmm-agent agent-linux/rmm-agent
build/ build/
updater/rmm-updater updater/rmm-updater

View File

@ -136,7 +136,7 @@ rmm/
│ ├── BACKEND.md # Backend Installation + Konfiguration │ ├── BACKEND.md # Backend Installation + Konfiguration
│ ├── FRONTEND.md # Frontend Build + Deploy │ ├── FRONTEND.md # Frontend Build + Deploy
│ └── FIRMWARE.md # Firmware-Management + Update-Prozess │ └── FIRMWARE.md # Firmware-Management + Update-Prozess
├── agent/ # Agent-Quellcode (FreeBSD/OPNsense) ├── agent-bsd/ # Agent-Quellcode (FreeBSD/OPNsense)
│ ├── main.go │ ├── main.go
│ ├── config/config.go │ ├── config/config.go
│ ├── client/client.go │ ├── client/client.go

108
agent-bsd/README.md Normal file
View File

@ -0,0 +1,108 @@
# RMM Agent BSD (OPNsense)
FreeBSD/OPNsense Agent für das RMM-System. Läuft als OPNsense-Plugin und liefert
Systemdaten via Heartbeat sowie Remote-Commands über WebSocket.
## Unterstützte Systeme
- OPNsense (FreeBSD, amd64)
## Installation via OPNsense Plugin
Das Plugin (`os-rmm-agent-*.pkg`) wird über das OPNsense-Paketmanagement installiert:
```bash
# Auf der OPNsense-Firewall (SSH)
git clone https://git.cynfo.net/christian/rmm2.git /tmp/rmm
cd /tmp/rmm
scp opnsense-plugin/install.sh root@FIREWALL_IP:/tmp/
ssh root@FIREWALL_IP "/bin/sh /tmp/install.sh"
```
Anschliessend im OPNsense WebGUI unter **Services → RMM Agent** konfigurieren.
## Konfiguration (WebGUI)
| Feld | Beschreibung |
|------|-------------|
| Backend URL | `https://BACKEND_IP:8443` |
| API Key | API-Key aus `backend/config.yaml` |
| Agent Name | Anzeigename im RMM-Frontend |
## Manuell kompilieren & deployen
```bash
# Auf dem Entwicklungsrechner (mit Go 1.24+)
cd /opt/rmm
make agent
# Binary auf Firewall kopieren und installieren
scp build/rmm-agent root@FIREWALL_IP:/tmp/
scp agent-bsd/install.sh root@FIREWALL_IP:/tmp/
ssh root@FIREWALL_IP "/bin/sh /tmp/install.sh"
```
## Konfigurationsdatei
```yaml
# /usr/local/etc/rmm-agent/config.yaml
backend_url: "https://BACKEND_IP:8443"
api_key: "DEIN_API_KEY"
agent_name: "OPN.intra.kunde.de"
insecure: true # false wenn gültiges TLS-Zertifikat vorhanden
```
## Service-Management (FreeBSD)
```bash
# Status
service rmm-agent status
# Start / Stop / Restart
service rmm-agent start
service rmm-agent stop
service rmm-agent restart
# Logs
tail -f /var/log/rmm-agent.log
```
## Gesammelte Daten (Heartbeat alle 60s)
| Collector | Daten |
|-----------|-------|
| Hardware | Hersteller, Modell, Seriennummer, BIOS |
| CPU | Modell, Cores, Threads, Auslastung |
| Memory | Total, Used, Free |
| Disks | ZFS Datasets, Belegung, Mountpoints |
| Network | Interfaces, IPs, Status, MAC, Statistiken |
| Services | Laufende OPNsense-Dienste |
| WireGuard | Tunnel, Peers, Transfer, Handshake |
| DHCP | Aktive Leases (KEA/ISC/dnsmasq) |
| Routing | Routing-Tabelle |
| Gateways | Status, RTT, Loss |
| Zertifikate | Ablaufdatum, Aussteller |
| Plugins | Installierte OPNsense-Plugins |
| Updates | Verfügbare Core + Package Updates |
| Cron | System-Crontab + OPNsense Jobs |
## Remote-Commands (via WebSocket)
| Command | Beschreibung |
|---------|-------------|
| `exec` | Beliebigen Shell-Befehl ausführen |
| `backup` | config.xml sichern |
| `update` | OPNsense Update (Core + Packages) |
| `major_update` | Major-Upgrade (2-Phasen) |
| `reboot` | Neustart |
| `tunnel_connect` | TCP-Tunnel öffnen (SSH, WebGUI, etc.) |
| `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`
- `daemon` statt `nohup` für Hintergrundprozesse
- `csh` hat kein `$()` — Agent verwendet `/bin/sh -c`
- OPNsense Plugin-Cache nach View-Änderungen leeren
- PHP-Fehlerlog: `/var/log/php-fpm.log`