Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19163a2efe | ||
|
|
7201b18300 | ||
|
|
20bf40adce | ||
|
|
e29257b808 |
@@ -10,7 +10,7 @@ Jede Installation ist an Kunde, Gerät und Agentenidentität gebunden. Die Stand
|
|||||||
|
|
||||||
Der Agent meldet den Gerätetyp mit dem passiven Hardwareinventar. `physical` bezeichnet einen physischen Rechner, `virtual` ein virtualisiertes System und `hypervisor` eine erkannte Hostrolle. Proxmox VE erscheint als `hypervisor` mit `Proxmox VE` in der Spalte OS. Eine erkannte Hostrolle hat Vorrang, auch bei verschachtelter Virtualisierung. Bei fehlender Angabe zeigt die WebUI „Nicht gemeldet“. Die Geräteabfragen in WebUI und MCP verwenden denselben gespeicherten Typ. [Inventarprojektion](crates/server/src/devices.rs)
|
Der Agent meldet den Gerätetyp mit dem passiven Hardwareinventar. `physical` bezeichnet einen physischen Rechner, `virtual` ein virtualisiertes System und `hypervisor` eine erkannte Hostrolle. Proxmox VE erscheint als `hypervisor` mit `Proxmox VE` in der Spalte OS. Eine erkannte Hostrolle hat Vorrang, auch bei verschachtelter Virtualisierung. Bei fehlender Angabe zeigt die WebUI „Nicht gemeldet“. Die Geräteabfragen in WebUI und MCP verwenden denselben gespeicherten Typ. [Inventarprojektion](crates/server/src/devices.rs)
|
||||||
|
|
||||||
Für aktuelle virtuelle Geräte kann die WebUI einen registrierten Hypervisor aus demselben Kundenbestand zuordnen. Die Geräteübersicht zeigt diese Verbindung unter dem Hostnamen der VM und verlinkt auf die Gerätedetails des Hypervisors. Die Zuordnung gilt, solange der verknüpfte Host im Bestand ist und sich als Hypervisor meldet. Eine VM mit gemeldetem Hersteller Hetzner erhält bei fehlendem konkreten Host den Anzeigeplatzhalter „Hetzner Cloud“. Der Platzhalter hat keine Kopplung und zählt nicht als registriertes Gerät.
|
Für aktuelle virtuelle Geräte kann die WebUI einen registrierten Hypervisor aus demselben Kundenbestand zuordnen. Die Geräteübersicht des Bestands gliedert die Geräte einer Seite in Blöcke: je Hypervisor ein Block mit dem Host und seinen eingerückten VMs, danach „Hetzner Cloud“, „Physische Geräte“ und „Nicht zugeordnet“. Der Blockkopf des Hypervisors verlinkt auf dessen Gerätedetails, auch wenn der Host selbst nicht auf der Seite steht. An jeder VM steht, ob die Zuordnung automatisch erkannt oder manuell gesetzt wurde. Die Historie bleibt eine einfache Liste. Die Zuordnung gilt, solange der verknüpfte Host im Bestand ist und sich als Hypervisor meldet. Eine VM mit gemeldetem Hersteller Hetzner erhält bei fehlendem konkreten Host den Anzeigeplatzhalter „Hetzner Cloud“. Der Platzhalter hat keine Kopplung und zählt nicht als registriertes Gerät.
|
||||||
|
|
||||||
Ein aufgenommener Proxmox-VE-Host meldet über einen vom Installer eingerichteten, nur lesenden API-Token (`PVEAuditor`) die Gäste seines Nodes, die geplanten vzdump-Backupjobs und die Läufe der letzten acht Tage. Die Gerätedetails des Hosts listen VMs und Container mit Status, Ressourcen, zugeordnetem Gerät und letzter erfolgreicher Sicherung. Darunter folgen die Backupjobs mit Zeitplan, Storage, gesicherten Gästen, letztem fälligen Zeitpunkt, Ergebnis und nächstem Lauf sowie die Gäste ohne Backupjob. Der Server bewertet jeden aktiven Job als gelaufen, fehlgeschlagen, verpasst, laufend oder noch nicht fällig. Er beantwortet damit, ob alle geplanten Backups gelaufen sind. Ein virtuelles Gerät, dessen MAC-Adresse eindeutig in der Gastliste eines Proxmox-Hosts desselben Kunden steht, wird diesem Host automatisch als Hypervisor zugeordnet und so gekennzeichnet. Eine manuelle Zuordnung hat Vorrang und lässt sich wieder an die automatische Erkennung zurückgeben. [Proxmox-Host](deploy/proxmox/README.md)
|
Ein aufgenommener Proxmox-VE-Host meldet über einen vom Installer eingerichteten, nur lesenden API-Token (`PVEAuditor`) die Gäste seines Nodes, die geplanten vzdump-Backupjobs und die Läufe der letzten acht Tage. Die Gerätedetails des Hosts listen VMs und Container mit Status, Ressourcen, zugeordnetem Gerät und letzter erfolgreicher Sicherung. Darunter folgen die Backupjobs mit Zeitplan, Storage, gesicherten Gästen, letztem fälligen Zeitpunkt, Ergebnis und nächstem Lauf sowie die Gäste ohne Backupjob. Der Server bewertet jeden aktiven Job als gelaufen, fehlgeschlagen, verpasst, laufend oder noch nicht fällig. Er beantwortet damit, ob alle geplanten Backups gelaufen sind. Ein virtuelles Gerät, dessen MAC-Adresse eindeutig in der Gastliste eines Proxmox-Hosts desselben Kunden steht, wird diesem Host automatisch als Hypervisor zugeordnet und so gekennzeichnet. Eine manuelle Zuordnung hat Vorrang und lässt sich wieder an die automatische Erkennung zurückgeben. [Proxmox-Host](deploy/proxmox/README.md)
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ Die Spalte **Zweck** und das Gerätedetail zeigen optionalen Freitext. Unter **Z
|
|||||||
|
|
||||||
## Vom Skript zum Ergebnis
|
## Vom Skript zum Ergebnis
|
||||||
|
|
||||||
**OPNsense:** Das Gerätegateway akzeptiert `opnsense.base/1` als eigene Inventarplattform. Im Gerätedetail erscheinen aktive PF-Filterregeln sowie getrennte Listen für konfigurierte VPNs und native Laufzeitbefunde. Fehlende Berechtigung bzw. ausgefallene Quellen sind kein Nachweis einer leeren Liste. Skriptaufträge gehören wie bei Linux und Windows unter **Aufträge**. Die WebUI bindet eine Bibliotheksrevision oder ein einmaliges POSIX-Skript an die ausgewählten OPNsense-Geräte. Für die Ausführung als `root` gelten zusätzlich zum normalen signierten Abgleich und persönlichen Freigabeverfahren `root:execute`, die zentrale Geräte- und Principalbindung sowie die unabhängige Prüfung durch den lokal provisionierten FreeBSD-Helper. [OPNsense-Betrieb](deploy/opnsense/README.md)
|
**OPNsense:** Das Gerätegateway akzeptiert `opnsense.base/1` als eigene Inventarplattform. Im Gerätedetail erscheinen aktive PF-Filterregeln sowie getrennte Listen für konfigurierte VPNs und native Laufzeitbefunde. Fehlende Berechtigung bzw. ausgefallene Quellen sind kein Nachweis einer leeren Liste. Skriptaufträge gehören wie bei Linux und Windows unter **Aufträge**. Die WebUI bindet eine Bibliotheksrevision oder ein einmaliges POSIX-Skript an die ausgewählten OPNsense-Geräte. Für die Ausführung als `root` gelten zusätzlich zum normalen signierten Abgleich und persönlichen Freigabeverfahren `root:execute`, die zentrale Geräte- und Principalbindung sowie die unabhängige Prüfung durch den lokal provisionierten FreeBSD-Helper. Die Aufnahme erfolgt mit `opnsense.sh` über HTTPS: Das Skript fragt den Einmalcode ab, lädt das feste OPNsense-Paket des Servers nur gegen diesen Code, prüft jede Datei gegen Größe und SHA-256, nimmt das Gerät unter dem Dienstkonto `discovery` auf und bindet den Skript-Worker an diese Installation. Eine vorhandene Geräteidentität bleibt erhalten; eine Installation eines anderen Kunden wird nicht überschrieben. Der Root-Helper wird weiterhin separat eingerichtet. Die WebUI zeigt den Befehl, sobald der Server ein gültiges Paket bereithält. [OPNsense-Betrieb](deploy/opnsense/README.md)
|
||||||
|
|
||||||
| Schritt | Verhalten |
|
| Schritt | Verhalten |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
|
|||||||
@@ -304,6 +304,21 @@ RMM_BOOTSTRAP_PYTHON
|
|||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
.route(
|
||||||
|
"/install/opnsense.sh",
|
||||||
|
get(|| async {
|
||||||
|
(
|
||||||
|
[("content-type", "text/x-shellscript")],
|
||||||
|
concat!(
|
||||||
|
include_str!("bootstrap/opnsense.sh"),
|
||||||
|
include_str!("../../../deploy/opnsense/install-dev.sh"),
|
||||||
|
"RMM_OPNSENSE_FILES\ncat >\"$work/install.py\" <<'RMM_OPNSENSE_PYTHON'\n",
|
||||||
|
include_str!("bootstrap/opnsense_install.py"),
|
||||||
|
"RMM_OPNSENSE_PYTHON\n/usr/local/bin/python3 -I \"$work/install.py\" \"$work/install-files.sh\" \"$@\"\n"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}),
|
||||||
|
)
|
||||||
.route(
|
.route(
|
||||||
"/install/windows.ps1",
|
"/install/windows.ps1",
|
||||||
get(|| async {
|
get(|| async {
|
||||||
@@ -319,6 +334,8 @@ RMM_BOOTSTRAP_PYTHON
|
|||||||
get(bootstrap::artifact),
|
get(bootstrap::artifact),
|
||||||
)
|
)
|
||||||
.route("/agent/v1/bootstrap/updater", get(bootstrap::updater))
|
.route("/agent/v1/bootstrap/updater", get(bootstrap::updater))
|
||||||
|
.route("/agent/v1/bootstrap/opnsense/current", get(bootstrap::opnsense::current))
|
||||||
|
.route("/agent/v1/bootstrap/opnsense/files/{name}", get(bootstrap::opnsense::file))
|
||||||
.route("/agent/v1/releases/current", get(current))
|
.route("/agent/v1/releases/current", get(current))
|
||||||
.route("/agent/v1/releases/installed", get(installed))
|
.route("/agent/v1/releases/installed", get(installed))
|
||||||
.route("/agent/v1/releases/device-trust", get(bootstrap::device_trust))
|
.route("/agent/v1/releases/device-trust", get(bootstrap::device_trust))
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
//! the tenant's one-time enrollment token until the final enrollment consumes it.
|
//! the tenant's one-time enrollment token until the final enrollment consumes it.
|
||||||
use super::*;
|
use super::*;
|
||||||
mod starter;
|
mod starter;
|
||||||
|
pub(super) mod opnsense;
|
||||||
|
|
||||||
pub(super) use starter::publish_missing as publish_starters;
|
pub(super) use starter::publish_missing as publish_starters;
|
||||||
|
|
||||||
@@ -135,7 +136,8 @@ pub(super) async fn issue(
|
|||||||
.await?;
|
.await?;
|
||||||
tx.commit().await?;
|
tx.commit().await?;
|
||||||
Ok(private_json(
|
Ok(private_json(
|
||||||
json!({"token":token,"expires_at":expires,"bootstrap_origin":bootstrap_origin,"release_platforms":release_platforms}),
|
json!({"token":token,"expires_at":expires,"bootstrap_origin":bootstrap_origin,"release_platforms":release_platforms,
|
||||||
|
"opnsense_installer":opnsense::available()}),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
async fn token_tenant(s: &crate::State, h: &HeaderMap) -> Result<Uuid, Error> {
|
async fn token_tenant(s: &crate::State, h: &HeaderMap) -> Result<Uuid, Error> {
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
//! HTTPS installation of the OPNsense agent. The program files are a fixed
|
||||||
|
//! bundle in the release configuration (`opnsense/` next to the Linux bootstrap
|
||||||
|
//! file). The public script holds no credentials; the bundle is served only
|
||||||
|
//! against a valid one-time enrollment token, until enrollment consumes it.
|
||||||
|
use super::*;
|
||||||
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
|
/// Files the installer needs; `rmm-opnsense-jobs` (script worker) is optional.
|
||||||
|
const REQUIRED: [&str; 3] = ["agent.pyz", "collect.pyz", "discovery_agent"];
|
||||||
|
const OPTIONAL: [&str; 1] = ["rmm-opnsense-jobs"];
|
||||||
|
const MAX_FILE_BYTES: u64 = 32 * 1024 * 1024;
|
||||||
|
|
||||||
|
#[derive(Deserialize, serde::Serialize, Clone)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
pub(super) struct File {
|
||||||
|
sha256: String,
|
||||||
|
bytes: u64,
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
#[serde(deny_unknown_fields)]
|
||||||
|
struct Manifest {
|
||||||
|
schema_version: u32,
|
||||||
|
version: String,
|
||||||
|
files: BTreeMap<String, File>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn bundle_dir() -> Result<std::path::PathBuf, Error> {
|
||||||
|
std::env::var_os("RMM_AGENT_BOOTSTRAP_LINUX_FILE")
|
||||||
|
.and_then(|slot| FsPath::new(&slot).parent().map(|p| p.join("opnsense")))
|
||||||
|
.ok_or_else(|| fail("BOOTSTRAP_NOT_CONFIGURED"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn manifest() -> Result<Manifest, Error> {
|
||||||
|
let raw = protected_file(&bundle_dir()?.join("manifest.json"), 8192)?;
|
||||||
|
let m: Manifest = serde_json::from_slice(&raw).map_err(|_| fail("OPNSENSE_BUNDLE_INVALID"))?;
|
||||||
|
valid(&m).then_some(m).ok_or_else(|| fail("OPNSENSE_BUNDLE_INVALID"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn valid(m: &Manifest) -> bool {
|
||||||
|
m.schema_version == 1
|
||||||
|
&& (1..=64).contains(&m.version.len())
|
||||||
|
&& m.version.bytes().all(|b| b.is_ascii_alphanumeric() || b"._-".contains(&b))
|
||||||
|
&& REQUIRED.iter().all(|name| m.files.contains_key(*name))
|
||||||
|
&& m.files.iter().all(|(name, f)| {
|
||||||
|
(REQUIRED.contains(&name.as_str()) || OPTIONAL.contains(&name.as_str()))
|
||||||
|
&& rmm_domain::agent_update::digest(&f.sha256)
|
||||||
|
&& (1..=MAX_FILE_BYTES).contains(&f.bytes)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Whether the enrollment dialog can offer the OPNsense command.
|
||||||
|
pub(super) fn available() -> bool {
|
||||||
|
manifest().is_ok()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn current(State(s): State<crate::State>, headers: HeaderMap) -> Result<Response, Error> {
|
||||||
|
let tenant = token_tenant(&s, &headers).await?;
|
||||||
|
let m = manifest()?;
|
||||||
|
// The device gateway is the same for every platform; the Linux slot names it.
|
||||||
|
let gateway = config(&s, Platform::LinuxX64, tenant, None).await?.gateway_origin;
|
||||||
|
let ca = s.signer.as_ref().ok_or_else(missing)?.ca.to_pem().map_err(|_| invalid())?;
|
||||||
|
let trust = device_trust_data(&s)?;
|
||||||
|
Ok(private_json(json!({"schema_version":1,"tenant_id":tenant,"version":m.version,"gateway_origin":gateway,
|
||||||
|
"ca_pem":String::from_utf8(ca).map_err(|_| invalid())?,
|
||||||
|
"job_signing_public_key_hex":trust["job_signing_public_key_hex"],"files":m.files})))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn file(
|
||||||
|
State(s): State<crate::State>,
|
||||||
|
headers: HeaderMap,
|
||||||
|
Path(name): Path<String>,
|
||||||
|
) -> Result<Response, Error> {
|
||||||
|
token_tenant(&s, &headers).await?;
|
||||||
|
let expected = manifest()?.files.remove(&name).ok_or_else(missing)?;
|
||||||
|
let raw = protected_file(&bundle_dir()?.join(&name), MAX_FILE_BYTES)?;
|
||||||
|
if raw.len() as u64 != expected.bytes || hex::encode(openssl::sha::sha256(&raw)) != expected.sha256 {
|
||||||
|
return Err(fail("OPNSENSE_BUNDLE_INVALID"));
|
||||||
|
}
|
||||||
|
Ok(([("content-type", "application/octet-stream"), ("cache-control", "private, no-store"),
|
||||||
|
("x-content-type-options", "nosniff")], raw).into_response())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
fn bundle(files: &[(&str, u64)]) -> Manifest {
|
||||||
|
Manifest { schema_version: 1, version: "0.1.0-opnsense.6".into(),
|
||||||
|
files: files.iter().map(|(n, b)| (n.to_string(), File { sha256: "a".repeat(64), bytes: *b })).collect() }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn bundle_needs_the_program_files_and_accepts_only_known_names() {
|
||||||
|
let base = [("agent.pyz", 10), ("collect.pyz", 10), ("discovery_agent", 10)];
|
||||||
|
assert!(valid(&bundle(&base)));
|
||||||
|
assert!(valid(&bundle(&[base[0], base[1], base[2], ("rmm-opnsense-jobs", 10)])));
|
||||||
|
assert!(!valid(&bundle(&base[..2])));
|
||||||
|
assert!(!valid(&bundle(&[base[0], base[1], base[2], ("../ca.pem", 10)])));
|
||||||
|
assert!(!valid(&bundle(&[base[0], base[1], ("discovery_agent", 0)])));
|
||||||
|
assert!(!valid(&bundle(&[base[0], base[1], ("discovery_agent", MAX_FILE_BYTES + 1)])));
|
||||||
|
let mut bad = bundle(&base);
|
||||||
|
bad.version = "1.0 ; rm".into();
|
||||||
|
assert!(!valid(&bad));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# OPNsense (FreeBSD amd64). Usage as root: sh opnsense.sh https://bootstrap.example
|
||||||
|
set -eu
|
||||||
|
umask 077
|
||||||
|
if [ "$(id -u)" != 0 ]; then
|
||||||
|
echo 'Bitte als root ausfuehren (Konsole: Option 8, Shell).' >&2; exit 1
|
||||||
|
fi
|
||||||
|
if [ "$(uname -s)" != FreeBSD ] || [ ! -x /usr/local/sbin/opnsense-version ] || [ ! -x /usr/local/bin/python3 ]; then
|
||||||
|
echo 'Dieses Installationsskript ist nur fuer OPNsense.' >&2; exit 1
|
||||||
|
fi
|
||||||
|
work=$(mktemp -d /var/tmp/discovery-install.XXXXXX)
|
||||||
|
trap 'rm -rf "$work"' EXIT
|
||||||
|
cat >"$work/install-files.sh" <<'RMM_OPNSENSE_FILES'
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
"""HTTPS installer for the OPNsense agent. Runs as root on the firewall.
|
||||||
|
|
||||||
|
Downloads the fixed program bundle with the one-time enrollment code, checks
|
||||||
|
each file against the server's size and SHA-256, installs it with the same
|
||||||
|
steps as the development installation and enrolls the device under the
|
||||||
|
unprivileged `discovery` account. An existing device identity is kept.
|
||||||
|
"""
|
||||||
|
import getpass
|
||||||
|
import hashlib
|
||||||
|
import http.client
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import ssl
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import urllib.parse
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
STATE = Path('/var/db/discovery-agent')
|
||||||
|
CONF = Path('/usr/local/etc/discovery-agent')
|
||||||
|
APP = Path('/usr/local/libexec/discovery-agent')
|
||||||
|
BINDING = CONF / 'job-binding.json'
|
||||||
|
PYTHON = '/usr/local/bin/python3'
|
||||||
|
REQUIRED = ('agent.pyz', 'collect.pyz', 'discovery_agent')
|
||||||
|
OPTIONAL = ('rmm-opnsense-jobs',)
|
||||||
|
MAX_FILE = 32 * 1024 * 1024
|
||||||
|
|
||||||
|
|
||||||
|
def stop(message):
|
||||||
|
raise SystemExit('Installation abgebrochen: ' + message)
|
||||||
|
|
||||||
|
|
||||||
|
def origin(raw):
|
||||||
|
url = urllib.parse.urlsplit(raw)
|
||||||
|
if (url.scheme != 'https' or not url.hostname or url.username or url.password or url.query
|
||||||
|
or url.fragment or url.path not in ('', '/')):
|
||||||
|
stop('Die Serveradresse muss eine reine HTTPS-Adresse sein, z. B. https://server.example:8443')
|
||||||
|
return url
|
||||||
|
|
||||||
|
|
||||||
|
def tls():
|
||||||
|
context = ssl.create_default_context()
|
||||||
|
if not context.get_ca_certs():
|
||||||
|
for bundle in ('/usr/local/openssl/cert.pem', '/usr/local/etc/ssl/cert.pem', '/etc/ssl/cert.pem'):
|
||||||
|
if os.path.isfile(bundle):
|
||||||
|
context.load_verify_locations(bundle)
|
||||||
|
break
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
def get(base, path, token, limit):
|
||||||
|
conn = http.client.HTTPSConnection(base.hostname, base.port or 443, context=tls(), timeout=30)
|
||||||
|
try:
|
||||||
|
conn.request('GET', path, headers={'Authorization': 'Enrollment ' + token})
|
||||||
|
res = conn.getresponse()
|
||||||
|
if res.status == 401:
|
||||||
|
stop('Der Einmalcode ist ungueltig, abgelaufen oder bereits verwendet.')
|
||||||
|
if res.status != 200:
|
||||||
|
stop(f'Server antwortet auf {path} mit HTTP {res.status}.')
|
||||||
|
body = res.read(limit + 1)
|
||||||
|
if len(body) > limit:
|
||||||
|
stop('Antwort des Servers ist zu gross.')
|
||||||
|
return body
|
||||||
|
finally:
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
def metadata(raw):
|
||||||
|
meta = json.loads(raw)
|
||||||
|
files = meta.get('files')
|
||||||
|
if (meta.get('schema_version') != 1 or not isinstance(files, dict)
|
||||||
|
or not all(name in files for name in REQUIRED)
|
||||||
|
or not all(name in REQUIRED + OPTIONAL for name in files)
|
||||||
|
or not re.fullmatch('[a-f0-9]{64}', str(meta.get('job_signing_public_key_hex')))
|
||||||
|
or not str(meta.get('ca_pem', '')).startswith('-----BEGIN CERTIFICATE-----')
|
||||||
|
or not re.fullmatch(r'[A-Za-z0-9._-]{1,64}', str(meta.get('version')))
|
||||||
|
or not re.fullmatch(r'https://[a-z0-9.-]+(:[0-9]{1,5})?/?', str(meta.get('gateway_origin')))):
|
||||||
|
stop('Der Server liefert kein gueltiges OPNsense-Paket.')
|
||||||
|
uuid.UUID(meta['tenant_id'])
|
||||||
|
for item in files.values():
|
||||||
|
if not (re.fullmatch('[a-f0-9]{64}', str(item.get('sha256'))) and isinstance(item.get('bytes'), int)
|
||||||
|
and 0 < item['bytes'] <= MAX_FILE):
|
||||||
|
stop('Der Server liefert kein gueltiges OPNsense-Paket.')
|
||||||
|
return meta
|
||||||
|
|
||||||
|
|
||||||
|
def as_discovery(command, payload, timeout=60):
|
||||||
|
# `su -m` keeps root's shell; OPNsense may set an interactive menu there.
|
||||||
|
return subprocess.run(['su', '-m', 'discovery', '-c', command], input=payload, capture_output=True,
|
||||||
|
timeout=timeout, env={**os.environ, 'SHELL': '/bin/sh'})
|
||||||
|
|
||||||
|
|
||||||
|
# Runs as `discovery`: reads the device-owned key only after dropping privileges.
|
||||||
|
DEVICE_QUERY = """
|
||||||
|
import http.client,json,ssl,sys
|
||||||
|
from pathlib import Path
|
||||||
|
p=Path('/var/db/discovery-agent')
|
||||||
|
ctx=ssl.create_default_context(cafile='/usr/local/etc/discovery-agent/ca.pem')
|
||||||
|
ctx.load_cert_chain(p/'device.pem',p/'device.key')
|
||||||
|
out={}
|
||||||
|
for name,path in (('installed','/agent/v1/releases/installed'),('trust','/agent/v1/releases/device-trust')):
|
||||||
|
c=http.client.HTTPSConnection(sys.argv[1],int(sys.argv[2]),context=ctx,timeout=15)
|
||||||
|
c.request('GET',path)
|
||||||
|
r=c.getresponse()
|
||||||
|
if r.status!=200: raise SystemExit(name+' HTTP '+str(r.status))
|
||||||
|
out[name]=json.loads(r.read(65537))
|
||||||
|
print(json.dumps(out))
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def device_view(host, port):
|
||||||
|
res = as_discovery(f'{PYTHON} -I - {host} {port}', DEVICE_QUERY.encode())
|
||||||
|
if res.returncode:
|
||||||
|
return None
|
||||||
|
return json.loads(res.stdout)
|
||||||
|
|
||||||
|
|
||||||
|
def bind_jobs(meta, host, port):
|
||||||
|
"""Pin the job signing key for the script worker of this exact installation."""
|
||||||
|
view = device_view(host, port)
|
||||||
|
if view is None:
|
||||||
|
stop('Der Gerätekanal ist nicht erreichbar; die Skriptbindung wurde nicht angelegt.')
|
||||||
|
identity = json.loads((STATE / 'identity.json').read_bytes())
|
||||||
|
installed, key = view['installed'], view['trust']['job_signing_public_key_hex']
|
||||||
|
if (installed['tenant_id'], installed['agent_id'], installed['asset_id'], key) != (
|
||||||
|
meta['tenant_id'], identity['agent_id'], identity['asset_id'], meta['job_signing_public_key_hex']):
|
||||||
|
stop('Gerätekanal und Installationsserver widersprechen sich.')
|
||||||
|
payload = dict(agent_id=identity['agent_id'], asset_id=identity['asset_id'], tenant_id=meta['tenant_id'],
|
||||||
|
enrollment_generation=int(installed['enrollment_generation']),
|
||||||
|
assignment_version=int(installed['assignment_version']), public_key_hex=key)
|
||||||
|
with BINDING.open('x') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o444)
|
||||||
|
json.dump(payload, f)
|
||||||
|
f.flush()
|
||||||
|
os.fsync(f.fileno())
|
||||||
|
|
||||||
|
|
||||||
|
def running():
|
||||||
|
return all(Path(f'/var/run/discovery-{part}.pid').is_file() for part in ('agent', 'collect'))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
if len(sys.argv) not in (3, 5) or (len(sys.argv) == 5 and sys.argv[3] != '--token-file'):
|
||||||
|
stop('Aufruf: sh opnsense.sh https://server.example:8443')
|
||||||
|
files_script, base = Path(sys.argv[1]), origin(sys.argv[2])
|
||||||
|
existing = (STATE / 'identity.json').is_file() and (STATE / 'identity.json').stat().st_size > 0
|
||||||
|
if existing:
|
||||||
|
print('Vorhandene Installation gefunden. Programmdateien werden aktualisiert, die Geräteidentität bleibt.')
|
||||||
|
if len(sys.argv) == 5:
|
||||||
|
token = Path(sys.argv[4]).read_text().strip()
|
||||||
|
else:
|
||||||
|
token = getpass.getpass('Einmalcode: ').strip()
|
||||||
|
if not re.fullmatch('[0-9a-f]{64}', token):
|
||||||
|
stop('Der Einmalcode besteht aus 64 Zeichen 0-9 und a-f.')
|
||||||
|
meta = metadata(get(base, '/agent/v1/bootstrap/opnsense/current', token, 65536))
|
||||||
|
if existing and BINDING.is_file() and json.loads(BINDING.read_bytes())['tenant_id'] != meta['tenant_id']:
|
||||||
|
stop('Diese Installation gehört zu einem anderen Kunden. Für einen Kundenwechsel das Gerät neu aufnehmen.')
|
||||||
|
stage = files_script.parent / 'stage'
|
||||||
|
stage.mkdir(mode=0o700)
|
||||||
|
for name, item in sorted(meta['files'].items()):
|
||||||
|
data = get(base, '/agent/v1/bootstrap/opnsense/files/' + name, token, item['bytes'])
|
||||||
|
if len(data) != item['bytes'] or hashlib.sha256(data).hexdigest() != item['sha256']:
|
||||||
|
stop(f'{name} stimmt nicht mit der Prüfsumme des Servers überein.')
|
||||||
|
(stage / name).write_bytes(data)
|
||||||
|
(stage / 'ca.pem').write_text(meta['ca_pem'])
|
||||||
|
print(f'OPNsense-Agent {meta["version"]} geladen und geprüft. Installation läuft …')
|
||||||
|
subprocess.run(['sh', str(files_script), str(stage)], check=True)
|
||||||
|
gateway = urllib.parse.urlsplit(meta['gateway_origin'])
|
||||||
|
host, port = gateway.hostname, gateway.port or 443
|
||||||
|
if not existing:
|
||||||
|
res = as_discovery(f'{PYTHON} -I {APP}/agent.pyz enroll', (token + '\n').encode())
|
||||||
|
if res.returncode:
|
||||||
|
stop('Die Aufnahme beim Server ist fehlgeschlagen. Bitte einen neuen Einmalcode erzeugen.')
|
||||||
|
print('Gerät beim Server aufgenommen.')
|
||||||
|
if (APP / 'rmm-opnsense-jobs').is_file() and not BINDING.exists():
|
||||||
|
bind_jobs(meta, host, port)
|
||||||
|
print('Skriptausführung für diese Installation gebunden.')
|
||||||
|
before = device_view(host, port) if existing else None
|
||||||
|
generation = int(before['installed']['connection_generation']) if before else -1
|
||||||
|
subprocess.run(['service', 'discovery_agent', 'restart' if running() else 'start'], check=True,
|
||||||
|
stdout=subprocess.DEVNULL)
|
||||||
|
for _ in range(30):
|
||||||
|
time.sleep(3)
|
||||||
|
view = running() and device_view(host, port)
|
||||||
|
# A new client hello raises the connection generation and reports the installed version.
|
||||||
|
if (view and view['installed'].get('agent_version') == meta['version']
|
||||||
|
and int(view['installed']['connection_generation']) > generation):
|
||||||
|
print(f'Fertig. Das Gerät meldet sich mit Version {view["installed"]["agent_version"]} '
|
||||||
|
'und erscheint in der WebUI unter Geräte.')
|
||||||
|
return
|
||||||
|
stop('Der Dienst läuft, hat sich aber noch nicht beim Server gemeldet. '
|
||||||
|
'Diagnose: /var/log/system/latest.log und service discovery_agent restart.')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
Test-VM `discovery-opnsense` auf `qemu:///system`, 2 vCPU, 1536 MiB RAM, 12 GiB virtuelle Platte. Basis: offizielles Nano-Image OPNsense 26.7 amd64; SHA-256 des komprimierten Images `28d5e2f37e40d87468a924e3006ef10e2ddc6de485b85333d9e3958c84d0cb9d`, gegen die Herstellerankündigung verglichen und die Signatur des entpackten Images geprüft. Start bei Bedarf: `virsh -c qemu:///system start discovery-opnsense`. Konsole: `virsh -c qemu:///system console discovery-opnsense`. Das LAN `192.168.247.0/24` ist eine isolierte libvirt-Bridge, das WAN `192.168.246.0/24` verwendet NAT. Management vom Notebook: `https://192.168.247.1`. Der Hostpin stammt aus der seriellen Konsole; Zugangswerte liegen ausschließlich im privaten Zugangsspeicher des ursprünglichen Checkouts.
|
Test-VM `discovery-opnsense` auf `qemu:///system`, 2 vCPU, 1536 MiB RAM, 12 GiB virtuelle Platte. Basis: offizielles Nano-Image OPNsense 26.7 amd64; SHA-256 des komprimierten Images `28d5e2f37e40d87468a924e3006ef10e2ddc6de485b85333d9e3958c84d0cb9d`, gegen die Herstellerankündigung verglichen und die Signatur des entpackten Images geprüft. Start bei Bedarf: `virsh -c qemu:///system start discovery-opnsense`. Konsole: `virsh -c qemu:///system console discovery-opnsense`. Das LAN `192.168.247.0/24` ist eine isolierte libvirt-Bridge, das WAN `192.168.246.0/24` verwendet NAT. Management vom Notebook: `https://192.168.247.1`. Der Hostpin stammt aus der seriellen Konsole; Zugangswerte liegen ausschließlich im privaten Zugangsspeicher des ursprünglichen Checkouts.
|
||||||
|
|
||||||
|
## Aufnahme per HTTPS
|
||||||
|
|
||||||
|
Unter **Verwaltung → Geräteaufnahme** den Kunden wählen und einen Einmalcode erstellen. Auf der Firewall als `root` (SSH oder Konsole, Option **8) Shell**) den angezeigten Befehl ausführen:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
fetch -o opnsense.sh 'https://discovery.ease-technologies.de:8443/install/opnsense.sh' && sh opnsense.sh 'https://discovery.ease-technologies.de:8443'
|
||||||
|
```
|
||||||
|
|
||||||
|
Das Skript fragt nach dem **Einmalcode**. Es lädt mit diesem Code das OPNsense-Paket des Servers, prüft jede Datei gegen Größe und SHA-256 und installiert es mit denselben Schritten wie [install-dev.sh](install-dev.sh). Danach nimmt es die Firewall unter dem Dienstkonto `discovery` auf. Ist der Skript-Worker im Paket, wird er über den Gerätekanal an genau diese Installation gebunden (`job-binding.json`). Das Skript startet den Dienst und wartet, bis sich die Firewall mit der Paketversion meldet. [Installer](../../crates/server/src/bootstrap/opnsense_install.py)
|
||||||
|
|
||||||
|
Ein erneuter Lauf auf einer aufgenommenen Firewall aktualisiert nur die Programmdateien. Geräteidentität, Zertifikat, Journale und Bindung bleiben erhalten; der Einmalcode wird dabei nicht verbraucht. Gehört die vorhandene Bindung zu einem anderen Kunden, bricht das Skript ab. Für einen Kundenwechsel das Gerät neu aufnehmen. Den Root-Helper richtet der Installer nicht ein (siehe unten).
|
||||||
|
|
||||||
|
**Paket bereitstellen:** `python3 tools/dev_opnsense_bundle.py --worker-from-guest` baut `agent.pyz` und `collect.pyz` aus diesem Verzeichnis, nimmt das rc.d-Skript und den nativen Worker aus dem Testgast und legt alles mit `manifest.json` unter `devstate/mvp-releases/config/opnsense/` auf dem Entwicklungsserver ab (Eigentümer wie die übrige Releasekonfiguration, Modus 0600). Die Version stammt aus `VERSION` in `agent.py`. Ohne gültiges Paket zeigt die WebUI keinen OPNsense-Befehl. Das Paket ist nicht signiert. Seine Integrität beruht auf der HTTPS-Verbindung zum Installationsserver, über die auch das Skript selbst kommt. [Paketwerkzeug](../../tools/dev_opnsense_bundle.py)
|
||||||
|
|
||||||
## Quelle und Entwicklungsinstallation
|
## Quelle und Entwicklungsinstallation
|
||||||
|
|
||||||
Der OPNsense-eigene Python-Interpreter führt zwei Zipapps aus. Der lokale Collector läuft mit den für PF, VPN-Sockets und Konfiguration nötigen Rechten. Er veröffentlicht ausschließlich den ausgewählten Bestand atomar in `/var/db/discovery-observations/inventory.json`. Das Dienstkonto `discovery` kann die Datei lesen, aber weder Collector noch Cache verändern. Nur dieses Konto hält die Geräteidentität und nutzt den ausgehenden HTTPS-Kanal. Für die Erfassung wird keine eingehende Netzwerkverbindung benötigt.
|
Der OPNsense-eigene Python-Interpreter führt zwei Zipapps aus. Der lokale Collector läuft mit den für PF, VPN-Sockets und Konfiguration nötigen Rechten. Er veröffentlicht ausschließlich den ausgewählten Bestand atomar in `/var/db/discovery-observations/inventory.json`. Das Dienstkonto `discovery` kann die Datei lesen, aber weder Collector noch Cache verändern. Nur dieses Konto hält die Geräteidentität und nutzt den ausgehenden HTTPS-Kanal. Für die Erfassung wird keine eingehende Netzwerkverbindung benötigt.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Ein Proxmox-VE-Host ist ein Debian-System. Er verwendet deshalb den regulären L
|
|||||||
|
|
||||||
## Aufnahme
|
## Aufnahme
|
||||||
|
|
||||||
Für die Aufnahme den gemeinsamen [HTTPS-Installer](../../docs/development.md#linux-gerät-per-https-aufnehmen) als `root` auf dem Proxmox-Host ausführen. Der Installer erkennt Proxmox VE an `pveversion` und `pveum` und richtet einen nur lesenden Zugang ein:
|
Für die Aufnahme den gemeinsamen [HTTPS-Installer](../../docs/development.md#linux-gerät-per-https-aufnehmen) als `root` auf dem Proxmox-Host ausführen. Proxmox VE enthält kein `sudo`. Die WebUI zeigt unter **Gerät aufnehmen** deshalb einen eigenen Befehl „Proxmox VE“, der `linux.sh` direkt mit `sh` startet. Der Installer erkennt Proxmox VE an `pveversion` und `pveum` und richtet einen nur lesenden Zugang ein:
|
||||||
|
|
||||||
- Proxmox-Benutzer `rmm-discovery@pve` und das privilegiengetrennte API-Token `rmm-discovery@pve!inventory`. Beide erhalten auf `/` ausschließlich die Rolle `PVEAuditor`. Bei einem privilegiengetrennten Token gilt die Schnittmenge aus Benutzer- und Tokenrechten. Deshalb braucht auch der Benutzer die Rolle.
|
- Proxmox-Benutzer `rmm-discovery@pve` und das privilegiengetrennte API-Token `rmm-discovery@pve!inventory`. Beide erhalten auf `/` ausschließlich die Rolle `PVEAuditor`. Bei einem privilegiengetrennten Token gilt die Schnittmenge aus Benutzer- und Tokenrechten. Deshalb braucht auch der Benutzer die Rolle.
|
||||||
- Den Tokenwert schreibt er nach `/opt/rust-discovery-client/proxmox-token` (Eigentümer root, Modus 0600). Die Cluster-CA landet als `/opt/rust-discovery-client/pve-ca.pem`.
|
- Den Tokenwert schreibt er nach `/opt/rust-discovery-client/proxmox-token` (Eigentümer root, Modus 0600). Die Cluster-CA landet als `/opt/rust-discovery-client/pve-ca.pem`.
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ http {
|
|||||||
proxy_set_header Host discovery.ease-technologies.de;
|
proxy_set_header Host discovery.ease-technologies.de;
|
||||||
proxy_set_header Content-Length "";
|
proxy_set_header Content-Length "";
|
||||||
proxy_set_header Authorization $http_authorization;
|
proxy_set_header Authorization $http_authorization;
|
||||||
location ~ "^/(install/(linux\.sh|windows\.ps1)|agent/v1/bootstrap/(current|updater|releases/[0-9a-f-]{36}/artifacts/[0-9a-f-]{36}))$" {
|
location ~ "^/(install/(linux\.sh|windows\.ps1|opnsense\.sh)|agent/v1/bootstrap/(current|updater|releases/[0-9a-f-]{36}/artifacts/[0-9a-f-]{36}|opnsense/current|opnsense/files/(agent\.pyz|collect\.pyz|discovery_agent|rmm-opnsense-jobs)))$" {
|
||||||
limit_except GET { deny all; }
|
limit_except GET { deny all; }
|
||||||
proxy_pass https://127.0.0.1:18444$uri$is_args$args;
|
proxy_pass https://127.0.0.1:18444$uri$is_args$args;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -75,7 +75,7 @@ Unter **Verwaltung → Geräteaufnahme** den Kunden wählen und einen Einmalcode
|
|||||||
curl --fail --show-error --silent 'https://discovery.ease-technologies.de:8443/install/linux.sh' -o linux.sh && sudo sh linux.sh 'https://discovery.ease-technologies.de:8443' --enable-admin-scripts
|
curl --fail --show-error --silent 'https://discovery.ease-technologies.de:8443/install/linux.sh' -o linux.sh && sudo sh linux.sh 'https://discovery.ease-technologies.de:8443' --enable-admin-scripts
|
||||||
```
|
```
|
||||||
|
|
||||||
Den Einmalcode auf Nachfrage eingeben. Bei direkter Root-Anmeldung entfällt `sudo`. `--enable-admin-scripts` aktiviert den lokalen Skript-Helper. Zusätzliche zentrale Geräterechte und die WebUI-Genehmigung gelten pro Auftrag.
|
Den Einmalcode auf Nachfrage eingeben. Bei direkter Root-Anmeldung entfällt `sudo`. Für OPNsense-Firewalls gibt es einen eigenen Befehl mit `opnsense.sh`. [OPNsense-Aufnahme](../deploy/opnsense/README.md#aufnahme-per-https) `--enable-admin-scripts` aktiviert den lokalen Skript-Helper. Zusätzliche zentrale Geräterechte und die WebUI-Genehmigung gelten pro Auftrag.
|
||||||
|
|
||||||
Auf einem bereits aufgenommenen Linux-Gerät kann der gleiche HTTPS-Installer den Root-Skript-Helper nachträglich einrichten. Dazu `--enable-admin-scripts` verwenden. Der Installer übernimmt die vorhandene Geräteidentität. Für die WebUI muss die zentrale Geräteregel zusätzlich das berechtigte Konto und die authentisiert gemeldete Helper-Bindung enthalten. [Richtlinie und Berechtigungen](public-access.md#administrator-skripte-anfordern)
|
Auf einem bereits aufgenommenen Linux-Gerät kann der gleiche HTTPS-Installer den Root-Skript-Helper nachträglich einrichten. Dazu `--enable-admin-scripts` verwenden. Der Installer übernimmt die vorhandene Geräteidentität. Für die WebUI muss die zentrale Geräteregel zusätzlich das berechtigte Konto und die authentisiert gemeldete Helper-Bindung enthalten. [Richtlinie und Berechtigungen](public-access.md#administrator-skripte-anfordern)
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
| Genehmigung und Zustellung | [Genehmigungseingang](../crates/server/src/approvals.rs), [Entscheidung und Freigabe](../crates/server/src/jobs.rs), [Gerätegateway](../crates/server/src/job_gateway.rs), [Abgleich im Agenten](../crates/agent-core/src/reconcile.rs) |
|
| Genehmigung und Zustellung | [Genehmigungseingang](../crates/server/src/approvals.rs), [Entscheidung und Freigabe](../crates/server/src/jobs.rs), [Gerätegateway](../crates/server/src/job_gateway.rs), [Abgleich im Agenten](../crates/agent-core/src/reconcile.rs) |
|
||||||
| MCP und Administrator-Skripte | [Werkzeuge](../crates/server/src/mcp.rs), [Tokenrechte](../crates/server/src/mcp_tokens.rs), [Helper und zentrale Geräteregel](../crates/server/src/managed_scripts.rs) |
|
| MCP und Administrator-Skripte | [Werkzeuge](../crates/server/src/mcp.rs), [Tokenrechte](../crates/server/src/mcp_tokens.rs), [Helper und zentrale Geräteregel](../crates/server/src/managed_scripts.rs) |
|
||||||
| Geräteaufnahme und Releasewechsel | [HTTPS-Installer und Lebenszyklus](../crates/server/src/bootstrap), [Releasekatalog](../crates/server/src/agent_updates.rs), [Signaturprüfung](../crates/updater/src/manifest.rs) |
|
| Geräteaufnahme und Releasewechsel | [HTTPS-Installer und Lebenszyklus](../crates/server/src/bootstrap), [Releasekatalog](../crates/server/src/agent_updates.rs), [Signaturprüfung](../crates/updater/src/manifest.rs) |
|
||||||
|
| OPNsense-Aufnahme per HTTPS | [Skript](../crates/server/src/bootstrap/opnsense.sh), [Installer](../crates/server/src/bootstrap/opnsense_install.py), [Paketauslieferung](../crates/server/src/bootstrap/opnsense.rs), [Paketwerkzeug](../tools/dev_opnsense_bundle.py) |
|
||||||
| Native Laufzeiten | [Linux-Agent](../crates/agent/src/main.rs), [Linux-Inventar und Skripte](../crates/agent-linux/src), [Windows-Agent](../crates/agent-windows/src/runtime.rs), [Agentprotokoll](../proto/BACKEND_CONTRACT.md) |
|
| Native Laufzeiten | [Linux-Agent](../crates/agent/src/main.rs), [Linux-Inventar und Skripte](../crates/agent-linux/src), [Windows-Agent](../crates/agent-windows/src/runtime.rs), [Agentprotokoll](../proto/BACKEND_CONTRACT.md) |
|
||||||
| Proxmox-Host und VM-Zuordnung | [Sammelmodul](../crates/agent-linux/src/inventory/proxmox.rs), [Validierung und Backupbewertung](../crates/domain/src/inventory_document/proxmox.rs), [automatische Zuordnung](../crates/server/src/proxmox_links.sql), [Detailansicht](../web/src/proxmox.tsx), [Betrieb](../deploy/proxmox/README.md) |
|
| Proxmox-Host und VM-Zuordnung | [Sammelmodul](../crates/agent-linux/src/inventory/proxmox.rs), [Validierung und Backupbewertung](../crates/domain/src/inventory_document/proxmox.rs), [automatische Zuordnung](../crates/server/src/proxmox_links.sql), [Detailansicht](../web/src/proxmox.tsx), [Betrieb](../deploy/proxmox/README.md) |
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ Alle acht Versuche lieferten Exitcode 0. Bei beiden Neustarts wurde die Wiederan
|
|||||||
| RAM und CPU-Auslastung in der Übersicht | RAM als verfügbar / gesamt in GiB mit demselben Belegungsbalken wie beim Speicherplatz. Die CPU-Spalte zeigt die letzte gemessene Auslastung in Prozent. Am 18. November wurde `6ed57c4` mit Schema 41 produktiv aktiviert. Beide TLS-Healthchecks und der öffentliche WebUI-Index stimmten mit dem Build überein. Die öffentliche Übersicht zeigte die RAM-Balken auf Desktop und bei 390 px Breite für alle drei Geräte. Die Detailansicht und die automatische Aktualisierung wurden in Chromium auf Linux x64 und ARM64 nachgelesen. OTRS meldete um 18:05 UTC nach dem signierten Wechsel auf `0.1.0-arm64.3` `6,2 / 7,6 GiB` und `1,1 %`. Um 18:06 UTC meldeten Linux x64 `0.1.0-mvp.9`, Windows `0.1.18` und ARM64 frische CPU-Werte und waren authentisiert erreichbar. [Geräteansicht](../web/src/devices.tsx) · [Geräteprojektion](../crates/server/src/devices.rs) |
|
| RAM und CPU-Auslastung in der Übersicht | RAM als verfügbar / gesamt in GiB mit demselben Belegungsbalken wie beim Speicherplatz. Die CPU-Spalte zeigt die letzte gemessene Auslastung in Prozent. Am 18. November wurde `6ed57c4` mit Schema 41 produktiv aktiviert. Beide TLS-Healthchecks und der öffentliche WebUI-Index stimmten mit dem Build überein. Die öffentliche Übersicht zeigte die RAM-Balken auf Desktop und bei 390 px Breite für alle drei Geräte. Die Detailansicht und die automatische Aktualisierung wurden in Chromium auf Linux x64 und ARM64 nachgelesen. OTRS meldete um 18:05 UTC nach dem signierten Wechsel auf `0.1.0-arm64.3` `6,2 / 7,6 GiB` und `1,1 %`. Um 18:06 UTC meldeten Linux x64 `0.1.0-mvp.9`, Windows `0.1.18` und ARM64 frische CPU-Werte und waren authentisiert erreichbar. [Geräteansicht](../web/src/devices.tsx) · [Geräteprojektion](../crates/server/src/devices.rs) |
|
||||||
| Gerätetyp in der Übersicht | Spalte „Type“ nach „Hostname“ mit `physical`, `virtual` und `hypervisor`. Erkannte Proxmox-VE-Hosts zeigen `Proxmox VE` als OS. Am 18. November wurde `c599baa` auf dem öffentlichen Server aktiviert. Der Serverrunner bestätigte API, Gateway und öffentlichen API-Dienst mit Binärhash `4f9c8c60…`. Der öffentliche WebUI-Index stimmte mit dem gebauten Bundle überein. Die unveränderten Geräteidentitäten meldeten nach regulärem signierten Update `virtual` auf Linux mit `0.1.0-mvp.7` um 16:45 UTC und Windows mit `0.1.17` um 16:47 UTC. Geräteliste, Details, Mobilansicht mit 390 px und Historie sind in der öffentlichen WebUI geprüft. Beide Pakete sind in Development A und B und als Starter für leere Kataloge veröffentlicht. Die Typen `physical` und `hypervisor` sind mit Testdaten geprüft. Die Feldabnahme auf einem physischen Gerät und einem Proxmox-VE-Host steht aus. [Inventarprojektion](../crates/server/src/devices.rs) · [Geräteansicht](../web/src/devices.tsx) |
|
| Gerätetyp in der Übersicht | Spalte „Type“ nach „Hostname“ mit `physical`, `virtual` und `hypervisor`. Erkannte Proxmox-VE-Hosts zeigen `Proxmox VE` als OS. Am 18. November wurde `c599baa` auf dem öffentlichen Server aktiviert. Der Serverrunner bestätigte API, Gateway und öffentlichen API-Dienst mit Binärhash `4f9c8c60…`. Der öffentliche WebUI-Index stimmte mit dem gebauten Bundle überein. Die unveränderten Geräteidentitäten meldeten nach regulärem signierten Update `virtual` auf Linux mit `0.1.0-mvp.7` um 16:45 UTC und Windows mit `0.1.17` um 16:47 UTC. Geräteliste, Details, Mobilansicht mit 390 px und Historie sind in der öffentlichen WebUI geprüft. Beide Pakete sind in Development A und B und als Starter für leere Kataloge veröffentlicht. Die Typen `physical` und `hypervisor` sind mit Testdaten geprüft. Die Feldabnahme auf einem physischen Gerät und einem Proxmox-VE-Host steht aus. [Inventarprojektion](../crates/server/src/devices.rs) · [Geräteansicht](../web/src/devices.tsx) |
|
||||||
| Hostzuordnung bei VMs | Die WebUI zeigt einen zugeordneten Hypervisor direkt an der VM. Der Browsertest prüfte Zuordnung, Verlinkung, Entfernen und den Hetzner-Platzhalter bei 390 px Breite. In PostgreSQL wurden die Page-Grenze, archivierte Hypervisoren und die Trennung der Kunden geprüft. 80 WebUI-Tests, vier Browsertests und fünf Rust-Gerätetests bestanden. Revision `bcd3bd8` wurde am 18. November um 21:43 UTC mit Schema 43 aktiviert. Der Serverrunner bestätigte die TLS-Healthchecks und der öffentliche Index entsprach dem Build. In der öffentlichen WebUI zeigten zwei vorhandene Hetzner-VMs den Platzhalter auf Desktop und Mobil. Die Auswahl war im Gerätedetail verfügbar. Der Bestand enthielt zum Prüfzeitpunkt keinen registrierten Hypervisor. [Geräteansicht](../web/src/device-hypervisor.tsx) · [Hostsuche](../crates/server/src/hypervisors.sql) |
|
| Hostzuordnung bei VMs | Die WebUI zeigt einen zugeordneten Hypervisor direkt an der VM. Der Browsertest prüfte Zuordnung, Verlinkung, Entfernen und den Hetzner-Platzhalter bei 390 px Breite. In PostgreSQL wurden die Page-Grenze, archivierte Hypervisoren und die Trennung der Kunden geprüft. 80 WebUI-Tests, vier Browsertests und fünf Rust-Gerätetests bestanden. Revision `bcd3bd8` wurde am 18. November um 21:43 UTC mit Schema 43 aktiviert. Der Serverrunner bestätigte die TLS-Healthchecks und der öffentliche Index entsprach dem Build. In der öffentlichen WebUI zeigten zwei vorhandene Hetzner-VMs den Platzhalter auf Desktop und Mobil. Die Auswahl war im Gerätedetail verfügbar. Der Bestand enthielt zum Prüfzeitpunkt keinen registrierten Hypervisor. [Geräteansicht](../web/src/device-hypervisor.tsx) · [Hostsuche](../crates/server/src/hypervisors.sql) |
|
||||||
|
| Gruppierte Geräteübersicht | Der Bestand zeigt je Hypervisor einen Block mit Host und eingerückten VMs, danach „Hetzner Cloud“, „Physische Geräte“ und „Nicht zugeordnet“. Am 20. November bestanden 87 WebUI-Tests, darunter vier zur Gruppierung (Reihenfolge, Host außerhalb der Seite, Kundentrennung, manuell zugeordneter Host), und die lokale Browsersuite mit dem angepassten Zuordnungstest bei 390 px Breite. Desktop- und Mobildarstellung wurden mit Beispieldaten im Browser angesehen. Eine Sichtprüfung mit persönlicher Sitzung auf dem Entwicklungsserver steht aus. [Gruppierung](../web/src/device-groups.ts) · [Geräteliste](../web/src/devices.tsx) |
|
||||||
|
| OPNsense-Aufnahme per HTTPS | Am 21. November wurde Revision `7201b18` aktiviert, das OPNsense-Paket `0.1.0-opnsense.6` mit nativem Worker auf dem Server abgelegt und der öffentliche Ingress um die OPNsense-Pfade ergänzt. Öffentlich: `/install/opnsense.sh` 200, Paketmetadaten und Dateien ohne gültigen Code 401, nicht gelistete Dateinamen 404. Auf der Test-VM `discovery-opnsense` (Kunde `9d730e0a-…`) lud der Befehl das Skript mit `fetch`, prüfte das Paket und aktualisierte die Programmdateien. Danach entsprachen `agent.pyz`, `collect.pyz` und `rmm-opnsense-jobs` den SHA-256 des Servers. Identität, Gerätschlüssel, Job-Bindung und Root-Policy waren unverändert, Agent, Collector und Root-Helper liefen, und die Firewall meldete sich mit neuer Verbindungsgeneration und Version `0.1.0-opnsense.6`. Ein ungültiger Code brach vor jeder Änderung ab. Die Erstaufnahme einer neuen Firewall ist live noch nicht geprüft. 87 WebUI-Tests und die Browsersuite bestanden. [Installer](../crates/server/src/bootstrap/opnsense_install.py) · [Paketauslieferung](../crates/server/src/bootstrap/opnsense.rs) |
|
||||||
|
| Installationsbefehl für Proxmox VE | Proxmox VE 9.2 enthält kein `sudo`. Auf dem Testhost am 21. November geprüft: `curl` und `python3` vorhanden, `sudo` fehlt. Der Linux-Befehl der WebUI brach dort deshalb ab. **Gerät aufnehmen** zeigt bei verfügbarem x86-64-Release zusätzlich den Block „Proxmox VE“ mit demselben Installer ohne `sudo` für eine Root-Shell, mit und ohne `--enable-admin-scripts`. 87 WebUI-Tests und der angepasste Browsertest der Aufnahmebefehle bestanden. [Aufnahme](../web/src/main.tsx) · [Proxmox-Host](../deploy/proxmox/README.md) |
|
||||||
| Von der Auswahl zur Ausgabe | Die WebUI bindet die ausgewählte Skriptversion, zeigt den Inhalt vor Genehmigung und verlinkt das Ergebnis je Gerät. Ein abgelehnter Antrag erzeugte null Jobs. [Auftragsablauf](evidence/webui-auftragsablauf-20261117.json) · [Ergebnislinks und Entscheidungen](evidence/webui-order-history-20261118.json) Auf OTRS ARM64 wurde der Root-Skript-Helper nachträglich mit dem HTTPS-Installer aktiviert. Die zentrale Geräteregel bindet das berechtigte WebUI-Konto an diese Installation und den signierten Helper. Die öffentliche WebUI-Vorschau akzeptierte Root für OTRS. Die Probe blieb bei einer Vorschau und erzeugte null Anträge, Jobs, Outbox-Einträge und Startgrants. [OTRS-Nachweis](evidence/linux-arm64-otrs-root-helper-20261118.json) |
|
| Von der Auswahl zur Ausgabe | Die WebUI bindet die ausgewählte Skriptversion, zeigt den Inhalt vor Genehmigung und verlinkt das Ergebnis je Gerät. Ein abgelehnter Antrag erzeugte null Jobs. [Auftragsablauf](evidence/webui-auftragsablauf-20261117.json) · [Ergebnislinks und Entscheidungen](evidence/webui-order-history-20261118.json) Auf OTRS ARM64 wurde der Root-Skript-Helper nachträglich mit dem HTTPS-Installer aktiviert. Die zentrale Geräteregel bindet das berechtigte WebUI-Konto an diese Installation und den signierten Helper. Die öffentliche WebUI-Vorschau akzeptierte Root für OTRS. Die Probe blieb bei einer Vorschau und erzeugte null Anträge, Jobs, Outbox-Einträge und Startgrants. [OTRS-Nachweis](evidence/linux-arm64-otrs-root-helper-20261118.json) |
|
||||||
| Frische Installation und periodisches Agentupdate | Beide VMs wurden über HTTPS aufgenommen und übernahmen anschließend ein signiertes Folgepaket mit derselben Geräteidentität. Auf Windows ist der öffentliche GNU-Kanal einschließlich Prüfung des offiziellen Schlüssels belegt. [Linux](evidence/linux-public-installer-update-20261117.json) · [Windows GNU](evidence/windows-gnu-official-vm-20261118.json). ARM64 erweitert denselben HTTPS-Installer mit automatischer Architekturerkennung. Release `0.1.0-arm64.1` ist veröffentlicht und als Starter verfügbar. Auf Ubuntu 22.04.5 ARM64 wurden die öffentlichen Downloads, die Signaturprüfung, die Ablehnung einer veränderten Agentdatei und der native Start aller drei Dateien im Prüfmodus beobachtet. OTRS ist mit Gerätezertifikat aufgenommen und meldet authentisierte Heartbeats. Die erste Kontaktprüfung wartet seit der Korrektur auf das Zertifikat. Der öffentliche Installer lief auf OTRS erneut ohne Traceback und ohne neuen Einmalcode. Der ARM64-Katalogabruf ist bestätigt. Ein späterer Versionswechsel auf ARM64 steht aus. [ARM64-Release](evidence/linux-arm64-installer-20261118.json) · [Geräteaufnahme und Nachtest](evidence/linux-arm64-enrollment-heartbeat-20261118.json) |
|
| Frische Installation und periodisches Agentupdate | Beide VMs wurden über HTTPS aufgenommen und übernahmen anschließend ein signiertes Folgepaket mit derselben Geräteidentität. Auf Windows ist der öffentliche GNU-Kanal einschließlich Prüfung des offiziellen Schlüssels belegt. [Linux](evidence/linux-public-installer-update-20261117.json) · [Windows GNU](evidence/windows-gnu-official-vm-20261118.json). ARM64 erweitert denselben HTTPS-Installer mit automatischer Architekturerkennung. Release `0.1.0-arm64.1` ist veröffentlicht und als Starter verfügbar. Auf Ubuntu 22.04.5 ARM64 wurden die öffentlichen Downloads, die Signaturprüfung, die Ablehnung einer veränderten Agentdatei und der native Start aller drei Dateien im Prüfmodus beobachtet. OTRS ist mit Gerätezertifikat aufgenommen und meldet authentisierte Heartbeats. Die erste Kontaktprüfung wartet seit der Korrektur auf das Zertifikat. Der öffentliche Installer lief auf OTRS erneut ohne Traceback und ohne neuen Einmalcode. Der ARM64-Katalogabruf ist bestätigt. Ein späterer Versionswechsel auf ARM64 steht aus. [ARM64-Release](evidence/linux-arm64-installer-20261118.json) · [Geräteaufnahme und Nachtest](evidence/linux-arm64-enrollment-heartbeat-20261118.json) |
|
||||||
| Erste Windows-Meldung ohne `DisplayVersion` | Bei einem betroffenen Gerät nahm das Gateway das Enrollment und die authentisierten Verbindungsaufbauten an, erhielt aber weder Inventar noch Heartbeat. Windows GNU `0.1.26` aus `037b5e3` nutzt bei fehlendem `DisplayVersion` den Registrywert `ReleaseId` oder meldet Produkt und Build ohne Versionsbezeichnung. Drei Regressionen und die Inventarprobe liefen nativ auf der Windows-Test-VM. Das offiziell signierte Paket (Sequenz 27) ist im Katalog des betroffenen Kunden und als Starter für neue Windows-Kataloge verfügbar. Die Test-VM übernahm das reguläre Update, meldete einen neuen Heartbeat mit derselben Identität und startete beide signierten Binärdateien mit den erwarteten Hashes. Die erneute Meldung des betroffenen Geräts mit derselben Identität steht aus. Bei durch den Erstkontakt blockiertem Installer den vorhandenen `RmmDiscoveryReleasePull` lokal starten; nach erfolgreichem Update den Installer mit derselben Identität abschließen. [Nachweis](evidence/windows-missing-display-version-20261119.json) |
|
| Erste Windows-Meldung ohne `DisplayVersion` | Bei einem betroffenen Gerät nahm das Gateway das Enrollment und die authentisierten Verbindungsaufbauten an, erhielt aber weder Inventar noch Heartbeat. Windows GNU `0.1.26` aus `037b5e3` nutzt bei fehlendem `DisplayVersion` den Registrywert `ReleaseId` oder meldet Produkt und Build ohne Versionsbezeichnung. Drei Regressionen und die Inventarprobe liefen nativ auf der Windows-Test-VM. Das offiziell signierte Paket (Sequenz 27) ist im Katalog des betroffenen Kunden und als Starter für neue Windows-Kataloge verfügbar. Die Test-VM übernahm das reguläre Update, meldete einen neuen Heartbeat mit derselben Identität und startete beide signierten Binärdateien mit den erwarteten Hashes. Die erneute Meldung des betroffenen Geräts mit derselben Identität steht aus. Bei durch den Erstkontakt blockiertem Installer den vorhandenen `RmmDiscoveryReleasePull` lokal starten; nach erfolgreichem Update den Installer mit derselben Identität abschließen. [Nachweis](evidence/windows-missing-display-version-20261119.json) |
|
||||||
|
|||||||
@@ -441,9 +441,10 @@ test('shows real VM hosts and the Hetzner placeholder without adding a device',
|
|||||||
});
|
});
|
||||||
|
|
||||||
await page.goto(origin + '/#geraete');
|
await page.goto(origin + '/#geraete');
|
||||||
const vmRow = page.getByRole('row').filter({ has: page.getByRole('button', { name: vm.hostname }) });
|
const block = (name: string) => page.getByRole('group', { name });
|
||||||
await expect(vmRow).toContainText('Hetzner Cloud');
|
await expect(block('Hetzner Cloud')).toContainText('Platzhalter');
|
||||||
await expect(vmRow).toContainText('Platzhalter');
|
await expect(block('Hetzner Cloud').getByRole('button', { name: vm.hostname })).toBeVisible();
|
||||||
|
await expect(block('Hypervisor pve-01')).toContainText('Keine zugeordneten virtuellen Maschinen');
|
||||||
await expect(page.getByRole('button', { name: 'Hetzner Cloud' })).toHaveCount(0);
|
await expect(page.getByRole('button', { name: 'Hetzner Cloud' })).toHaveCount(0);
|
||||||
await expect(page.locator('.fleet-table tbody tr')).toHaveCount(2);
|
await expect(page.locator('.fleet-table tbody tr')).toHaveCount(2);
|
||||||
await page.getByRole('button', { name: vm.hostname }).click();
|
await page.getByRole('button', { name: vm.hostname }).click();
|
||||||
@@ -455,10 +456,14 @@ test('shows real VM hosts and the Hetzner placeholder without adding a device',
|
|||||||
await expect(page.getByText('Hypervisor zugeordnet.', { exact: true })).toBeVisible();
|
await expect(page.getByText('Hypervisor zugeordnet.', { exact: true })).toBeVisible();
|
||||||
await page.getByRole('button', { name: 'Zur Geräteliste' }).click();
|
await page.getByRole('button', { name: 'Zur Geräteliste' }).click();
|
||||||
await page.setViewportSize({ width: 390, height: 844 });
|
await page.setViewportSize({ width: 390, height: 844 });
|
||||||
const hostLink = vmRow.getByRole('link', { name: pve.hostname });
|
const hostBlock = block('Hypervisor pve-01');
|
||||||
await expect(hostLink).toBeVisible();
|
await expect(hostBlock.locator('tbody tr')).toHaveCount(2);
|
||||||
await expect(vmRow).not.toContainText('Hetzner Cloud');
|
await expect(hostBlock.locator('tbody tr').first()).toContainText(pve.hostname);
|
||||||
await hostLink.click();
|
await expect(hostBlock.locator('tr.guest')).toContainText(vm.hostname);
|
||||||
|
await expect(hostBlock.locator('tr.guest')).toContainText('manuell zugeordnet');
|
||||||
|
await expect(hostBlock).toContainText('1 virtuelle Maschine');
|
||||||
|
await expect(block('Hetzner Cloud')).toHaveCount(0);
|
||||||
|
await hostBlock.getByRole('link', { name: pve.hostname }).click();
|
||||||
await expect(page.getByRole('heading', { name: pve.hostname })).toBeVisible();
|
await expect(page.getByRole('heading', { name: pve.hostname })).toBeVisible();
|
||||||
await expect(page.getByRole('heading', { name: 'Virtuelle Maschinen und Container' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Virtuelle Maschinen und Container' })).toBeVisible();
|
||||||
await expect(page.getByRole('row').filter({ hasText: 'alpine-ct' })).toContainText('Container');
|
await expect(page.getByRole('row').filter({ hasText: 'alpine-ct' })).toContainText('Container');
|
||||||
@@ -473,5 +478,5 @@ test('shows real VM hosts and the Hetzner placeholder without adding a device',
|
|||||||
await page.getByRole('button', { name: 'Zuordnung speichern' }).click();
|
await page.getByRole('button', { name: 'Zuordnung speichern' }).click();
|
||||||
await expect(page.getByText('Hostzuordnung entfernt.', { exact: true })).toBeVisible();
|
await expect(page.getByText('Hostzuordnung entfernt.', { exact: true })).toBeVisible();
|
||||||
await page.getByRole('button', { name: 'Zur Geräteliste' }).click();
|
await page.getByRole('button', { name: 'Zur Geräteliste' }).click();
|
||||||
await expect(vmRow).toContainText('Hetzner Cloud');
|
await expect(block('Hetzner Cloud').getByRole('button', { name: vm.hostname })).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ test('shows the execution stop and prepares the Windows restart through a versio
|
|||||||
expect(writes).toHaveLength(2);
|
expect(writes).toHaveLength(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('offers one Linux command for x86-64 and ARM64 and keeps the code outside both installer commands', async ({ page }) => {
|
test('offers one Linux command for x86-64 and ARM64, root commands for Proxmox VE and OPNsense and keeps the code outside all installer commands', async ({ page }) => {
|
||||||
const token = 'f'.repeat(64), api = '/api/v1/tenants/' + tenantId;
|
const token = 'f'.repeat(64), api = '/api/v1/tenants/' + tenantId;
|
||||||
const requests: string[] = [];
|
const requests: string[] = [];
|
||||||
await page.route(origin + '/auth/config', r => r.fulfill({ json: { dev_login_enabled: true, oidc_configured: false, oidc_login_url: null } }));
|
await page.route(origin + '/auth/config', r => r.fulfill({ json: { dev_login_enabled: true, oidc_configured: false, oidc_login_url: null } }));
|
||||||
@@ -176,7 +176,8 @@ test('offers one Linux command for x86-64 and ARM64 and keeps the code outside b
|
|||||||
if (url.pathname === '/api/v1/tenants') return r.fulfill({ json: listing(auth.tenants) });
|
if (url.pathname === '/api/v1/tenants') return r.fulfill({ json: listing(auth.tenants) });
|
||||||
if (url.pathname === api + '/enrollment-tokens') return r.fulfill({ json: {
|
if (url.pathname === api + '/enrollment-tokens') return r.fulfill({ json: {
|
||||||
token, expires_at: new Date(Date.now() + 900000).toISOString(), bootstrap_origin: 'https://bootstrap.example',
|
token, expires_at: new Date(Date.now() + 900000).toISOString(), bootstrap_origin: 'https://bootstrap.example',
|
||||||
release_platforms: ['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-gnu']
|
release_platforms: ['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-gnu'],
|
||||||
|
opnsense_installer: true
|
||||||
} });
|
} });
|
||||||
return r.fulfill({ json: { ...listing([]), pending_count: 0 } });
|
return r.fulfill({ json: { ...listing([]), pending_count: 0 } });
|
||||||
});
|
});
|
||||||
@@ -187,11 +188,20 @@ test('offers one Linux command for x86-64 and ARM64 and keeps the code outside b
|
|||||||
await enroll.getByRole('button', { name: 'Einmalcode erstellen' }).click();
|
await enroll.getByRole('button', { name: 'Einmalcode erstellen' }).click();
|
||||||
await expect(enroll.getByRole('heading', { name: 'Linux (x86-64 und ARM64)' })).toBeVisible();
|
await expect(enroll.getByRole('heading', { name: 'Linux (x86-64 und ARM64)' })).toBeVisible();
|
||||||
const commands = enroll.locator('pre');
|
const commands = enroll.locator('pre');
|
||||||
await expect(commands).toHaveCount(2);
|
await expect(commands).toHaveCount(4);
|
||||||
|
await expect(commands.nth(0)).toContainText("&& sudo sh linux.sh 'https://bootstrap.example'");
|
||||||
|
await expect(enroll.getByRole('heading', { name: 'Proxmox VE' })).toBeVisible();
|
||||||
|
await expect(commands.nth(1)).toHaveText("curl --fail --show-error --silent 'https://bootstrap.example/install/linux.sh' -o linux.sh && sh linux.sh 'https://bootstrap.example'");
|
||||||
|
await expect(enroll.getByRole('heading', { name: 'OPNsense' })).toBeVisible();
|
||||||
|
await expect(commands.nth(2)).toHaveText("fetch -o opnsense.sh 'https://bootstrap.example/install/opnsense.sh' && sh opnsense.sh 'https://bootstrap.example'");
|
||||||
expect((await commands.allTextContents()).join(' ')).not.toMatch(/enable-admin-scripts|EnableAdministratorScripts/);
|
expect((await commands.allTextContents()).join(' ')).not.toMatch(/enable-admin-scripts|EnableAdministratorScripts/);
|
||||||
await option.check();
|
await option.check();
|
||||||
await expect(commands.nth(0)).toContainText('--enable-admin-scripts');
|
await expect(commands.nth(0)).toContainText('--enable-admin-scripts');
|
||||||
await expect(commands.nth(1)).toContainText('-EnableAdministratorScripts');
|
await expect(commands.nth(1)).toContainText("sh linux.sh 'https://bootstrap.example' --enable-admin-scripts");
|
||||||
|
await expect(commands.nth(1)).not.toContainText('sudo');
|
||||||
|
await expect(commands.nth(2)).not.toContainText('admin');
|
||||||
|
await expect(enroll.getByText(/Root-Helper/)).toBeVisible();
|
||||||
|
await expect(commands.nth(3)).toContainText('-EnableAdministratorScripts');
|
||||||
await expect(enroll.getByText(/Für jeden Auftrag gelten zusätzlich/)).toBeVisible();
|
await expect(enroll.getByText(/Für jeden Auftrag gelten zusätzlich/)).toBeVisible();
|
||||||
expect((await commands.allTextContents()).join(' ')).not.toContain(token);
|
expect((await commands.allTextContents()).join(' ')).not.toContain(token);
|
||||||
expect(requests).toEqual([api + '/enrollment-tokens']);
|
expect(requests).toEqual([api + '/enrollment-tokens']);
|
||||||
|
|||||||
+2
-1
@@ -42,7 +42,8 @@ TARGETS = {
|
|||||||
}
|
}
|
||||||
REMOTE_TARGETS = ("server-arm64", "linux-arm64")
|
REMOTE_TARGETS = ("server-arm64", "linux-arm64")
|
||||||
SOURCE_PATHS = ["Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "crates", "proto",
|
SOURCE_PATHS = ["Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "crates", "proto",
|
||||||
"migrations", "tools/apt-transaction", "deploy/linux", "tests"]
|
"migrations", "tools/apt-transaction", "deploy/linux",
|
||||||
|
"deploy/opnsense/install-dev.sh", "tests"]
|
||||||
|
|
||||||
|
|
||||||
def git(*args):
|
def git(*args):
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Build the OPNsense agent bundle and place it on the dev server for the HTTPS installer.
|
||||||
|
|
||||||
|
The bundle is `agent.pyz`, `collect.pyz`, the rc.d script and optionally the native
|
||||||
|
script worker `rmm-opnsense-jobs` (FreeBSD amd64, built natively in the test guest).
|
||||||
|
It lands in `devstate/mvp-releases/config/opnsense/` next to the Linux bootstrap
|
||||||
|
configuration and is served only against a valid one-time enrollment code.
|
||||||
|
"""
|
||||||
|
import argparse
|
||||||
|
import base64
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
sys.path.insert(0, str(ROOT / 'tools'))
|
||||||
|
|
||||||
|
|
||||||
|
def activate(payload):
|
||||||
|
"""Runs on the dev server as root."""
|
||||||
|
import os
|
||||||
|
target = Path('/opt/rust-discovery/devstate/mvp-releases/config/opnsense')
|
||||||
|
owner = os.stat(target.parent)
|
||||||
|
target.mkdir(mode=0o700, exist_ok=True)
|
||||||
|
os.chown(target, owner.st_uid, owner.st_gid)
|
||||||
|
os.chmod(target, 0o700)
|
||||||
|
wanted = set(payload['files']) | {'manifest.json'}
|
||||||
|
for name, data in [*payload['files'].items(), ('manifest.json', payload['manifest'])]:
|
||||||
|
raw = base64.b64decode(data, validate=True)
|
||||||
|
tmp = target / ('.' + name + '.new')
|
||||||
|
with open(tmp, 'wb') as f:
|
||||||
|
os.fchmod(f.fileno(), 0o600)
|
||||||
|
f.write(raw)
|
||||||
|
f.flush()
|
||||||
|
os.fsync(f.fileno())
|
||||||
|
os.chown(tmp, owner.st_uid, owner.st_gid)
|
||||||
|
os.replace(tmp, target / name)
|
||||||
|
for old in target.iterdir():
|
||||||
|
if old.name not in wanted:
|
||||||
|
old.unlink()
|
||||||
|
print(json.dumps({'directory': str(target), 'files': sorted(wanted)}))
|
||||||
|
|
||||||
|
|
||||||
|
def build_zipapps(out):
|
||||||
|
python = ROOT / 'devstate/opnsense-vm/venv/bin/python'
|
||||||
|
if not python.is_file():
|
||||||
|
raise SystemExit('Build-venv fehlt: devstate/opnsense-vm/venv mit grpcio-tools==1.76.0 und protobuf==6.33.5')
|
||||||
|
subprocess.run([str(python), str(ROOT / 'deploy/opnsense/build.py'), str(out)], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
def worker_from_guest():
|
||||||
|
credentials = ROOT / 'credentials'
|
||||||
|
ssh = ['ssh', '-F', '/dev/null', '-T', '-i', str(credentials / 'opnsense-dev-key'),
|
||||||
|
'-o', 'UserKnownHostsFile=' + str(credentials / 'opnsense-dev.known_hosts'),
|
||||||
|
'-o', 'GlobalKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=yes', '-o', 'BatchMode=yes',
|
||||||
|
'-o', 'IdentitiesOnly=yes', '-o', 'ConnectTimeout=10', 'root@192.168.247.1']
|
||||||
|
return subprocess.run([*ssh, 'cat /usr/local/libexec/discovery-agent/rmm-opnsense-jobs'],
|
||||||
|
check=True, capture_output=True).stdout
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||||
|
worker = parser.add_mutually_exclusive_group()
|
||||||
|
worker.add_argument('--worker', type=Path, help='Native rmm-opnsense-jobs (FreeBSD amd64) to include')
|
||||||
|
worker.add_argument('--worker-from-guest', action='store_true',
|
||||||
|
help='Take the installed rmm-opnsense-jobs from the OPNsense test guest')
|
||||||
|
parser.add_argument('--prepare-only', type=Path, metavar='DIR', help='Write the bundle locally, do not upload')
|
||||||
|
args = parser.parse_args()
|
||||||
|
version = re.search(r"^VERSION = '([A-Za-z0-9._-]+)'$", (ROOT / 'deploy/opnsense/agent.py').read_text(), re.M)[1]
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
out = Path(tmp)
|
||||||
|
build_zipapps(out)
|
||||||
|
files = {name: (out / name).read_bytes() for name in ('agent.pyz', 'collect.pyz')}
|
||||||
|
files['discovery_agent'] = (ROOT / 'deploy/opnsense/discovery_agent').read_bytes()
|
||||||
|
if args.worker:
|
||||||
|
files['rmm-opnsense-jobs'] = args.worker.read_bytes()
|
||||||
|
elif args.worker_from_guest:
|
||||||
|
files['rmm-opnsense-jobs'] = worker_from_guest()
|
||||||
|
if 'rmm-opnsense-jobs' in files and not files['rmm-opnsense-jobs'].startswith(b'\x7fELF'):
|
||||||
|
raise SystemExit('rmm-opnsense-jobs ist keine ELF-Datei')
|
||||||
|
manifest = json.dumps({'schema_version': 1, 'version': version, 'files': {
|
||||||
|
name: {'sha256': hashlib.sha256(data).hexdigest(), 'bytes': len(data)} for name, data in sorted(files.items())
|
||||||
|
}}, indent=1).encode()
|
||||||
|
if args.prepare_only:
|
||||||
|
args.prepare_only.mkdir(parents=True, exist_ok=True, mode=0o700)
|
||||||
|
for name, data in [*files.items(), ('manifest.json', manifest)]:
|
||||||
|
(args.prepare_only / name).write_bytes(data)
|
||||||
|
print(manifest.decode())
|
||||||
|
return
|
||||||
|
from dev_stage import ssh_prefix
|
||||||
|
import inspect
|
||||||
|
payload = json.dumps({'manifest': base64.b64encode(manifest).decode(),
|
||||||
|
'files': {n: base64.b64encode(d).decode() for n, d in files.items()}})
|
||||||
|
source = 'import base64, json, os\nfrom pathlib import Path\n' + inspect.getsource(activate)
|
||||||
|
subprocess.run(ssh_prefix('server') + [shlex.join(['python3', '-I', '-'])],
|
||||||
|
input=source + '\nactivate(json.loads(' + repr(payload) + '))\n', text=True, check=True)
|
||||||
|
print(manifest.decode())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import { expect, it } from 'vitest';
|
||||||
|
import type { RecordValue } from './api';
|
||||||
|
import { groupDevices } from './device-groups';
|
||||||
|
|
||||||
|
const tenant = '11111111-1111-4111-8111-111111111111';
|
||||||
|
const device = (hostname: string, device_type: string | null, extra: RecordValue = {}): RecordValue => ({
|
||||||
|
tenant_id: tenant, customer_name: 'Testkunde', asset_id: hostname + '-asset', agent_id: hostname + '-agent',
|
||||||
|
hostname, device_type, ...extra });
|
||||||
|
const on = (host: string, tenantHost = host) => ({ hypervisor: {
|
||||||
|
kind: 'device', asset_id: tenantHost + '-asset', agent_id: tenantHost + '-agent', hostname: host } });
|
||||||
|
const hetzner = { hypervisor: { kind: 'placeholder', provider: 'hetzner', hostname: 'Hetzner Cloud' } };
|
||||||
|
const shape = (items: RecordValue[]) => groupDevices(items).map(g =>
|
||||||
|
[g.kind, g.title, g.rows.map(r => r.role + ':' + String(r.device.hostname)).join(',')]);
|
||||||
|
|
||||||
|
it('lists each hypervisor with its virtual machines, then Hetzner, physical and unassigned devices', () => {
|
||||||
|
expect(shape([
|
||||||
|
device('vm-b', 'virtual', on('pve-01')),
|
||||||
|
device('laptop', 'physical'),
|
||||||
|
device('cloud', 'virtual', hetzner),
|
||||||
|
device('pve-01', 'hypervisor'),
|
||||||
|
device('stray', 'virtual'),
|
||||||
|
device('vm-a', 'virtual', on('pve-01')),
|
||||||
|
device('pve-02', 'hypervisor'),
|
||||||
|
device('untyped', null),
|
||||||
|
])).toEqual([
|
||||||
|
['hypervisor', 'pve-01', 'host:pve-01,guest:vm-b,guest:vm-a'],
|
||||||
|
['hypervisor', 'pve-02', 'host:pve-02'],
|
||||||
|
['hetzner', '', 'guest:cloud'],
|
||||||
|
['physical', '', 'plain:laptop'],
|
||||||
|
['unassigned', '', 'plain:stray,plain:untyped'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('keeps the block and the link of a hypervisor that is not on this page', () => {
|
||||||
|
const [group] = groupDevices([device('vm-a', 'virtual', on('pve-01'))]);
|
||||||
|
expect(group).toMatchObject({ kind: 'hypervisor', title: 'pve-01', hostListed: false,
|
||||||
|
hostPath: 'geraete/' + tenant + '/pve-01-asset/pve-01-agent' });
|
||||||
|
expect(group?.rows.map(r => r.role)).toEqual(['guest']);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('never merges hosts of two customers that share an asset id', () => {
|
||||||
|
const other = { tenant_id: '22222222-2222-4222-8222-222222222222', customer_name: 'Anderer Kunde' };
|
||||||
|
const groups = groupDevices([
|
||||||
|
device('pve-01', 'hypervisor'),
|
||||||
|
device('vm-a', 'virtual', { ...on('pve-01'), ...other }),
|
||||||
|
]);
|
||||||
|
expect(groups.map(g => [g.customer, g.hostListed, g.rows.length])).toEqual([
|
||||||
|
['Testkunde', true, 1], ['Anderer Kunde', false, 1]]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('uses a manually assigned host as the head of its block whatever type it reports', () => {
|
||||||
|
expect(shape([device('vm-a', 'virtual', on('esx')), device('esx', 'physical')])).toEqual([
|
||||||
|
['hypervisor', 'esx', 'host:esx,guest:vm-a']]);
|
||||||
|
});
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
import { record, type RecordValue } from './api';
|
||||||
|
|
||||||
|
export type GroupKind = 'hypervisor' | 'hetzner' | 'physical' | 'unassigned';
|
||||||
|
export type RowRole = 'host' | 'guest' | 'plain';
|
||||||
|
export type FleetGroup = {
|
||||||
|
key: string;
|
||||||
|
kind: GroupKind;
|
||||||
|
/** Hostname of the hypervisor; empty for the fixed blocks. */
|
||||||
|
title: string;
|
||||||
|
customer: string;
|
||||||
|
/** Detail route of the hypervisor, also when its row is not part of this page. */
|
||||||
|
hostPath: string | null;
|
||||||
|
hostListed: boolean;
|
||||||
|
rows: { device: RecordValue; role: RowRole }[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const text = (value: unknown) => (typeof value === 'string' ? value : '');
|
||||||
|
const route = (tenant: string, asset: string, agent: string) =>
|
||||||
|
tenant && asset && agent ? ['geraete', tenant, asset, agent].map(encodeURIComponent).join('/') : null;
|
||||||
|
|
||||||
|
/** The registered hypervisor a virtual device is assigned to, if any. */
|
||||||
|
function assignedHost(device: RecordValue) {
|
||||||
|
if (device.device_type !== 'virtual' || !device.hypervisor || typeof device.hypervisor !== 'object') return null;
|
||||||
|
const info = record(device.hypervisor);
|
||||||
|
const asset = text(info.asset_id);
|
||||||
|
return info.kind === 'device' && asset ? { asset, agent: text(info.agent_id), hostname: text(info.hostname) } : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function isHetzner(device: RecordValue) {
|
||||||
|
if (device.device_type !== 'virtual' || !device.hypervisor || typeof device.hypervisor !== 'object') return false;
|
||||||
|
const info = record(device.hypervisor);
|
||||||
|
return info.kind === 'placeholder' && info.provider === 'hetzner';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sorts one page of the device list into blocks: one per hypervisor with its virtual
|
||||||
|
* machines, then Hetzner guests, physical devices and everything without a known place.
|
||||||
|
* A hypervisor is a block of its own within its customer; guests whose host is not on
|
||||||
|
* this page still get that host's block, without the host row.
|
||||||
|
*/
|
||||||
|
export function groupDevices(items: RecordValue[]): FleetGroup[] {
|
||||||
|
const hosts = new Map<string, FleetGroup>();
|
||||||
|
const fixed = new Map<GroupKind, FleetGroup>();
|
||||||
|
const hostGroup = (tenant: string, asset: string) => {
|
||||||
|
const key = tenant + '/' + asset;
|
||||||
|
let group = hosts.get(key);
|
||||||
|
if (!group) {
|
||||||
|
group = { key, kind: 'hypervisor', title: '', customer: '', hostPath: null, hostListed: false, rows: [] };
|
||||||
|
hosts.set(key, group);
|
||||||
|
}
|
||||||
|
return group;
|
||||||
|
};
|
||||||
|
const fixedGroup = (kind: GroupKind) => {
|
||||||
|
let group = fixed.get(kind);
|
||||||
|
if (!group) {
|
||||||
|
group = { key: kind, kind, title: '', customer: '', hostPath: null, hostListed: false, rows: [] };
|
||||||
|
fixed.set(kind, group);
|
||||||
|
}
|
||||||
|
return group;
|
||||||
|
};
|
||||||
|
const referenced = new Set<string>();
|
||||||
|
for (const device of items) {
|
||||||
|
const host = assignedHost(device);
|
||||||
|
if (host) referenced.add(text(device.tenant_id) + '/' + host.asset);
|
||||||
|
}
|
||||||
|
for (const device of items) {
|
||||||
|
const tenant = text(device.tenant_id), asset = text(device.asset_id);
|
||||||
|
const host = assignedHost(device);
|
||||||
|
if (device.device_type === 'hypervisor' || (!host && referenced.has(tenant + '/' + asset))) {
|
||||||
|
const group = hostGroup(tenant, asset);
|
||||||
|
group.title = text(device.hostname);
|
||||||
|
group.customer = text(device.customer_name);
|
||||||
|
group.hostPath = route(tenant, asset, text(device.agent_id));
|
||||||
|
group.hostListed = true;
|
||||||
|
group.rows.unshift({ device, role: 'host' });
|
||||||
|
} else if (host) {
|
||||||
|
const group = hostGroup(tenant, host.asset);
|
||||||
|
if (!group.hostListed) {
|
||||||
|
group.title = host.hostname;
|
||||||
|
group.customer = text(device.customer_name);
|
||||||
|
group.hostPath = route(tenant, host.asset, host.agent);
|
||||||
|
}
|
||||||
|
group.rows.push({ device, role: 'guest' });
|
||||||
|
} else {
|
||||||
|
const kind = isHetzner(device) ? 'hetzner' : device.device_type === 'physical' ? 'physical' : 'unassigned';
|
||||||
|
fixedGroup(kind).rows.push({ device, role: kind === 'hetzner' ? 'guest' : 'plain' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [...hosts.values(),
|
||||||
|
...(['hetzner', 'physical', 'unassigned'] as const).flatMap(kind => fixed.get(kind) ?? [])];
|
||||||
|
}
|
||||||
+156
-91
@@ -21,6 +21,7 @@ import { OPNsenseDetails } from './opnsense';
|
|||||||
import { ProxmoxDetails } from './proxmox';
|
import { ProxmoxDetails } from './proxmox';
|
||||||
import { DeviceCustomerTransfer } from './device-customer-transfer';
|
import { DeviceCustomerTransfer } from './device-customer-transfer';
|
||||||
import { HypervisorAssignment, HypervisorLabel } from './device-hypervisor';
|
import { HypervisorAssignment, HypervisorLabel } from './device-hypervisor';
|
||||||
|
import { groupDevices, type FleetGroup, type RowRole } from './device-groups';
|
||||||
import { ErrorBox, errorText, useResource } from './resource';
|
import { ErrorBox, errorText, useResource } from './resource';
|
||||||
import { NavIcon, orderDetailRoute } from './navigation';
|
import { NavIcon, orderDetailRoute } from './navigation';
|
||||||
import { orderTitle, Status } from './order-presentation';
|
import { orderTitle, Status } from './order-presentation';
|
||||||
@@ -32,6 +33,49 @@ import { SystemNonstartReview } from './system-nonstart-review';
|
|||||||
|
|
||||||
const unknown = 'Nicht gemeldet';
|
const unknown = 'Nicht gemeldet';
|
||||||
const noPurpose = 'Nicht hinterlegt';
|
const noPurpose = 'Nicht hinterlegt';
|
||||||
|
const plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`;
|
||||||
|
|
||||||
|
function groupName(group: FleetGroup) {
|
||||||
|
return group.kind === 'hypervisor' ? 'Hypervisor ' + (group.title || 'unbekannt')
|
||||||
|
: group.kind === 'hetzner' ? 'Hetzner Cloud'
|
||||||
|
: group.kind === 'physical' ? 'Physische Geräte' : 'Nicht zugeordnet';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** How a listed virtual machine got its place under a registered hypervisor. */
|
||||||
|
function linkSource(d: RecordValue) {
|
||||||
|
if (!d.hypervisor || typeof d.hypervisor !== 'object') return '';
|
||||||
|
const info = record(d.hypervisor);
|
||||||
|
return info.kind !== 'device' ? '' : info.source === 'proxmox' ? 'automatisch erkannt' : 'manuell zugeordnet';
|
||||||
|
}
|
||||||
|
|
||||||
|
function GroupHeader({ group, showCustomer }: { group: FleetGroup; showCustomer: boolean }) {
|
||||||
|
const guests = group.rows.filter((r) => r.role !== 'host').length;
|
||||||
|
const machines = plural(guests, 'virtuelle Maschine', 'virtuelle Maschinen');
|
||||||
|
const [icon, eyebrow, title, facts] =
|
||||||
|
group.kind === 'hypervisor'
|
||||||
|
? (['server', 'Hypervisor',
|
||||||
|
group.hostPath ? <a href={'#' + group.hostPath}>{group.title || 'Unbekannter Host'}</a> : group.title || 'Unbekannter Host',
|
||||||
|
[guests ? machines : 'Keine zugeordneten virtuellen Maschinen',
|
||||||
|
!group.hostListed && 'Host in dieser Ansicht nicht enthalten',
|
||||||
|
showCustomer && group.customer]] as const)
|
||||||
|
: group.kind === 'hetzner'
|
||||||
|
? (['cloud', 'Externer Anbieter', 'Hetzner Cloud', [machines, 'Platzhalter, kein Gerät im Bestand']] as const)
|
||||||
|
: group.kind === 'physical'
|
||||||
|
? (['geraete', 'Eigene Hardware', 'Physische Geräte', [plural(guests, 'Gerät', 'Geräte')]] as const)
|
||||||
|
: (['offen', 'Ohne Zuordnung', 'Nicht zugeordnet',
|
||||||
|
[plural(guests, 'Gerät', 'Geräte'), 'kein Hypervisor oder Gerätetyp erkannt']] as const);
|
||||||
|
return (
|
||||||
|
<div className="fleet-group-head">
|
||||||
|
<span className="group-icon"><NavIcon name={icon} /></span>
|
||||||
|
<div>
|
||||||
|
<span className="group-eyebrow">{eyebrow}</span>
|
||||||
|
<strong>{title}</strong>
|
||||||
|
</div>
|
||||||
|
<p>{facts.filter(Boolean).map((fact, i) => <span key={i}>{fact}</span>)}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const number = new Intl.NumberFormat('de-DE', { maximumFractionDigits: 1 });
|
const number = new Intl.NumberFormat('de-DE', { maximumFractionDigits: 1 });
|
||||||
const date = new Intl.DateTimeFormat('de-DE', { dateStyle: 'medium', timeStyle: 'short' });
|
const date = new Intl.DateTimeFormat('de-DE', { dateStyle: 'medium', timeStyle: 'short' });
|
||||||
function label(value: unknown) {
|
function label(value: unknown) {
|
||||||
@@ -580,6 +624,105 @@ export function Devices({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
const columns = ['Hostname', 'Type', 'Zweck', 'OS', 'Status', 'Speicher belegt / gesamt', 'RAM belegt / gesamt', 'CPU', 'Kunde'];
|
||||||
|
const row = (d: RecordValue, role: RowRole | 'flat') => {
|
||||||
|
const asset = objectId(d, 'asset'),
|
||||||
|
agent = objectId(d, 'agent'),
|
||||||
|
customer = objectId(d, 'tenant'),
|
||||||
|
model = cpu(d),
|
||||||
|
purpose = typeof d.purpose === 'string' ? d.purpose : '';
|
||||||
|
const show = () => {
|
||||||
|
setDeletionNotice('');
|
||||||
|
window.location.hash = ['geraete', customer, asset, agent]
|
||||||
|
.map(encodeURIComponent)
|
||||||
|
.join('/');
|
||||||
|
};
|
||||||
|
const another = selection.ids.length > 0 && selection.customer !== customer;
|
||||||
|
return (
|
||||||
|
<tr key={agent} onClick={show} className={role === 'flat' ? undefined : role}>
|
||||||
|
{!history && (
|
||||||
|
<td className="target-col" onClick={(e) => e.stopPropagation()}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
aria-label={'Ziel ' + asset}
|
||||||
|
title={
|
||||||
|
another ? 'Aufträge werden je Kunde geplant' : 'Für Auftrag auswählen'
|
||||||
|
}
|
||||||
|
disabled={another}
|
||||||
|
checked={selection.customer === customer && selection.ids.includes(asset)}
|
||||||
|
onChange={(e) => select(d, e.target.checked)}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
)}
|
||||||
|
<td className="hostname">
|
||||||
|
<button
|
||||||
|
className="host-link"
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
show();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{label(d.hostname)}
|
||||||
|
</button>
|
||||||
|
{role === 'flat' && <HypervisorLabel device={d} />}
|
||||||
|
{role === 'guest' && linkSource(d) && <small className="link-source">{linkSource(d)}</small>}
|
||||||
|
</td>
|
||||||
|
<td data-label="Type">{label(d.device_type)}</td>
|
||||||
|
<td data-label="Zweck" className="purpose-col">
|
||||||
|
<span className={'purpose-text' + (purpose ? '' : ' muted')} title={purpose || undefined}>
|
||||||
|
{purpose || noPurpose}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td data-label="OS">{label(d.os)}</td>
|
||||||
|
<td data-label="Status" className="device-presence">
|
||||||
|
<Presence d={d} />
|
||||||
|
{d.status === 'offline' && d.lifecycle === 'current' && (
|
||||||
|
<small>Zuletzt {time(d.last_contact_at)}</small>
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
<td data-label="Speicher belegt / gesamt" className="capacity-cell">
|
||||||
|
<DiskCapacity device={d} />
|
||||||
|
</td>
|
||||||
|
<td data-label="RAM belegt / gesamt" className="capacity-cell" title={measuredAt(d.ram_observed_at)}>
|
||||||
|
<Capacity free={d.ram_available_bytes} total={d.ram_total_bytes} />
|
||||||
|
</td>
|
||||||
|
<td data-label="CPU">
|
||||||
|
{model.primary}
|
||||||
|
{model.secondary && <small>{model.secondary}</small>}
|
||||||
|
<small title={measuredAt(d.cpu_usage_observed_at)}>
|
||||||
|
Auslastung {cpuUsage(d.cpu_usage_percent)}
|
||||||
|
</small>
|
||||||
|
</td>
|
||||||
|
<td data-label="Kunde">{label(d.customer_name)}</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/** Every block shares these column widths, so the blocks line up under one heading. */
|
||||||
|
const table = (rows: { device: RecordValue; role: RowRole | 'flat' }[], heading: 'visible' | 'hidden' | 'only') => (
|
||||||
|
<div className={'table fleet-table' + (heading === 'only' ? ' fleet-head' : '')} aria-hidden={heading === 'only' || undefined}>
|
||||||
|
<table>
|
||||||
|
<colgroup>
|
||||||
|
{!history && <col className="target-col" />}
|
||||||
|
{columns.map((h) => <col key={h} className={h === 'Zweck' ? 'purpose-col' : h === 'Hostname' ? 'host-col' : undefined} />)}
|
||||||
|
</colgroup>
|
||||||
|
<thead className={heading === 'hidden' ? 'sr-only' : undefined}>
|
||||||
|
<tr>
|
||||||
|
{!history && (
|
||||||
|
<th className="target-col">
|
||||||
|
<span className="sr-only">Ziel auswählen</span>
|
||||||
|
</th>
|
||||||
|
)}
|
||||||
|
{columns.map((h) => (
|
||||||
|
<th scope="col" key={h} className={h === 'Zweck' ? 'purpose-col' : undefined}>
|
||||||
|
{h}
|
||||||
|
</th>
|
||||||
|
))}
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
{heading !== 'only' && <tbody>{rows.map((r) => row(r.device, r.role))}</tbody>}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="page-title">
|
<div className="page-title">
|
||||||
@@ -669,99 +812,21 @@ export function Devices({
|
|||||||
{!list.data && !list.error && <p className="list-message">Geräte werden geladen …</p>}
|
{!list.data && !list.error && <p className="list-message">Geräte werden geladen …</p>}
|
||||||
{list.data && (
|
{list.data && (
|
||||||
<>
|
<>
|
||||||
<div className="table fleet-table">
|
{history ? (
|
||||||
<table>
|
table(list.data.items.map((device) => ({ device, role: 'flat' as const })), 'visible')
|
||||||
<thead>
|
) : (
|
||||||
<tr>
|
!!list.data.items.length && (
|
||||||
{!history && (
|
<div className="fleet-groups">
|
||||||
<th className="target-col">
|
{table([], 'only')}
|
||||||
<span className="sr-only">Ziel auswählen</span>
|
{groupDevices(list.data.items).map((group) => (
|
||||||
</th>
|
<div className={'fleet-group ' + group.kind} role="group" aria-label={groupName(group)} key={group.key}>
|
||||||
)}
|
<GroupHeader group={group} showCustomer={!filter} />
|
||||||
{['Hostname', 'Type', 'Zweck', 'OS', 'Status', 'Speicher belegt / gesamt', 'RAM belegt / gesamt', 'CPU', 'Kunde'].map(
|
{table(group.rows, 'hidden')}
|
||||||
(h) => (
|
</div>
|
||||||
<th scope="col" key={h} className={h === 'Zweck' ? 'purpose-col' : undefined}>
|
))}
|
||||||
{h}
|
</div>
|
||||||
</th>
|
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{list.data.items.map((d) => {
|
|
||||||
const asset = objectId(d, 'asset'),
|
|
||||||
agent = objectId(d, 'agent'),
|
|
||||||
customer = objectId(d, 'tenant'),
|
|
||||||
model = cpu(d),
|
|
||||||
purpose = typeof d.purpose === 'string' ? d.purpose : '';
|
|
||||||
const show = () => {
|
|
||||||
setDeletionNotice('');
|
|
||||||
window.location.hash = ['geraete', customer, asset, agent]
|
|
||||||
.map(encodeURIComponent)
|
|
||||||
.join('/');
|
|
||||||
};
|
|
||||||
const another = selection.ids.length > 0 && selection.customer !== customer;
|
|
||||||
return (
|
|
||||||
<tr key={agent} onClick={show}>
|
|
||||||
{!history && (
|
|
||||||
<td className="target-col" onClick={(e) => e.stopPropagation()}>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
aria-label={'Ziel ' + asset}
|
|
||||||
title={
|
|
||||||
another ? 'Aufträge werden je Kunde geplant' : 'Für Auftrag auswählen'
|
|
||||||
}
|
|
||||||
disabled={another}
|
|
||||||
checked={selection.customer === customer && selection.ids.includes(asset)}
|
|
||||||
onChange={(e) => select(d, e.target.checked)}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
)}
|
|
||||||
<td className="hostname">
|
|
||||||
<button
|
|
||||||
className="host-link"
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
show();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{label(d.hostname)}
|
|
||||||
</button>
|
|
||||||
<HypervisorLabel device={d} />
|
|
||||||
</td>
|
|
||||||
<td data-label="Type">{label(d.device_type)}</td>
|
|
||||||
<td data-label="Zweck" className="purpose-col">
|
|
||||||
<span className={'purpose-text' + (purpose ? '' : ' muted')} title={purpose || undefined}>
|
|
||||||
{purpose || noPurpose}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td data-label="OS">{label(d.os)}</td>
|
|
||||||
<td data-label="Status" className="device-presence">
|
|
||||||
<Presence d={d} />
|
|
||||||
{d.status === 'offline' && d.lifecycle === 'current' && (
|
|
||||||
<small>Zuletzt {time(d.last_contact_at)}</small>
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
<td data-label="Speicher belegt / gesamt" className="capacity-cell">
|
|
||||||
<DiskCapacity device={d} />
|
|
||||||
</td>
|
|
||||||
<td data-label="RAM belegt / gesamt" className="capacity-cell" title={measuredAt(d.ram_observed_at)}>
|
|
||||||
<Capacity free={d.ram_available_bytes} total={d.ram_total_bytes} />
|
|
||||||
</td>
|
|
||||||
<td data-label="CPU">
|
|
||||||
{model.primary}
|
|
||||||
{model.secondary && <small>{model.secondary}</small>}
|
|
||||||
<small title={measuredAt(d.cpu_usage_observed_at)}>
|
|
||||||
Auslastung {cpuUsage(d.cpu_usage_percent)}
|
|
||||||
</small>
|
|
||||||
</td>
|
|
||||||
<td data-label="Kunde">{label(d.customer_name)}</td>
|
|
||||||
</tr>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{!list.data.items.length && (
|
{!list.data.items.length && (
|
||||||
<div className="empty-list">
|
<div className="empty-list">
|
||||||
<NavIcon name="geraete" />
|
<NavIcon name="geraete" />
|
||||||
|
|||||||
+24
-5
@@ -194,7 +194,7 @@ function AgentReleaseCatalog({ tenantId, auth }: { tenantId: string; auth: Sessi
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string; auth: Session; customerName: string }) {
|
function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string; auth: Session; customerName: string }) {
|
||||||
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null; platforms: string[] } | null>(null);
|
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null; platforms: string[]; opnsense: boolean } | null>(null);
|
||||||
const [enrollmentError, setEnrollmentError] = useState<string | null>(null);
|
const [enrollmentError, setEnrollmentError] = useState<string | null>(null);
|
||||||
const [issuing, setIssuing] = useState(false);
|
const [issuing, setIssuing] = useState(false);
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
@@ -206,6 +206,10 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
|||||||
] as const;
|
] as const;
|
||||||
const availableLinuxArchitectures = linuxArchitectures.filter(([target]) => enrollment?.platforms.includes(target)).map(([, label]) => label);
|
const availableLinuxArchitectures = linuxArchitectures.filter(([target]) => enrollment?.platforms.includes(target)).map(([, label]) => label);
|
||||||
const linuxInstaller = origin && availableLinuxArchitectures.length > 0 ? `${origin}/install/linux.sh` : null;
|
const linuxInstaller = origin && availableLinuxArchitectures.length > 0 ? `${origin}/install/linux.sh` : null;
|
||||||
|
/** Proxmox VE is Debian on x86-64 and ships without sudo; the installer then runs from a root shell. */
|
||||||
|
const proxmoxInstaller = linuxInstaller && enrollment?.platforms.includes('x86_64-unknown-linux-gnu') ? linuxInstaller : null;
|
||||||
|
const adminFlag = adminScripts ? ' --enable-admin-scripts' : '';
|
||||||
|
const opnsenseInstaller = origin && enrollment?.opnsense ? `${origin}/install/opnsense.sh` : null;
|
||||||
const windowsPlatforms = ['x86_64-pc-windows-gnu', 'x86_64-pc-windows-msvc'].filter(platform => enrollment?.platforms.includes(platform));
|
const windowsPlatforms = ['x86_64-pc-windows-gnu', 'x86_64-pc-windows-msvc'].filter(platform => enrollment?.platforms.includes(platform));
|
||||||
const windowsInstaller = origin && windowsPlatforms.length > 0 ? `${origin}/install/windows.ps1` : null;
|
const windowsInstaller = origin && windowsPlatforms.length > 0 ? `${origin}/install/windows.ps1` : null;
|
||||||
return <section aria-label="Gerät aufnehmen"><h2>Gerät aufnehmen</h2>
|
return <section aria-label="Gerät aufnehmen"><h2>Gerät aufnehmen</h2>
|
||||||
@@ -217,6 +221,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
|||||||
if (typeof result.token !== 'string' || !/^[a-f0-9]{64}$/.test(result.token) || typeof result.expires_at !== 'string') throw new Error('Ungültiger Einmalcode');
|
if (typeof result.token !== 'string' || !/^[a-f0-9]{64}$/.test(result.token) || typeof result.expires_at !== 'string') throw new Error('Ungültiger Einmalcode');
|
||||||
const bootstrap = typeof result.bootstrap_origin === 'string' ? new URL(result.bootstrap_origin) : null;
|
const bootstrap = typeof result.bootstrap_origin === 'string' ? new URL(result.bootstrap_origin) : null;
|
||||||
setEnrollment({ token: result.token, expires: result.expires_at, origin: bootstrap?.protocol === 'https:' ? bootstrap.origin : null,
|
setEnrollment({ token: result.token, expires: result.expires_at, origin: bootstrap?.protocol === 'https:' ? bootstrap.origin : null,
|
||||||
|
opnsense: result.opnsense_installer === true,
|
||||||
platforms: Array.isArray(result.release_platforms) ? result.release_platforms.filter((p): p is string => typeof p === 'string') : [] });
|
platforms: Array.isArray(result.release_platforms) ? result.release_platforms.filter((p): p is string => typeof p === 'string') : [] });
|
||||||
} catch (error) { setEnrollmentError(errorText(error)); } finally { setIssuing(false); }
|
} catch (error) { setEnrollmentError(errorText(error)); } finally { setIssuing(false); }
|
||||||
}}>Einmalcode erstellen</button>
|
}}>Einmalcode erstellen</button>
|
||||||
@@ -232,9 +237,9 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
|||||||
<article>
|
<article>
|
||||||
<h3>Installation auf dem neuen Gerät</h3>
|
<h3>Installation auf dem neuen Gerät</h3>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Öffnen Sie auf dem neuen Linux-Gerät ein Terminal mit <code>sudo</code>-Rechten oder auf dem neuen Windows-Gerät Windows PowerShell 5.1 (64 Bit) als Administrator.</li>
|
<li>Öffnen Sie auf dem neuen Linux-Gerät ein Terminal mit <code>sudo</code>-Rechten, auf einem Proxmox-VE-Host oder einer OPNsense-Firewall eine Shell als <code>root</code> oder auf dem neuen Windows-Gerät Windows PowerShell 5.1 (64 Bit) als Administrator.</li>
|
||||||
<li>Führen Sie den passenden Befehlsblock unten aus. Er lädt das Installationsskript per HTTPS vom Server und startet es.</li>
|
<li>Führen Sie den passenden Befehlsblock unten aus. Er lädt das Installationsskript per HTTPS vom Server und startet es.</li>
|
||||||
<li>Fügen Sie den oben angezeigten Einmalcode ein, sobald das Skript nach <strong>Einmalcode</strong> (Linux) oder <strong>One-time enrollment token</strong> (Windows) fragt. Bestätigen Sie mit Enter. Eine vorherige Passwortabfrage von <code>sudo</code> gehört zur Anmeldung mit Administratorrechten.</li>
|
<li>Fügen Sie den oben angezeigten Einmalcode ein, sobald das Skript nach <strong>Einmalcode</strong> (Linux, Proxmox VE, OPNsense) oder <strong>One-time enrollment token</strong> (Windows) fragt. Bestätigen Sie mit Enter. Eine vorherige Passwortabfrage von <code>sudo</code> gehört zur Anmeldung mit Administratorrechten.</li>
|
||||||
<li>Prüfen Sie nach der Installation, ob das neue Gerät unter <a href="#geraete">Geräte</a> beim gewählten Kunden erscheint.</li>
|
<li>Prüfen Sie nach der Installation, ob das neue Gerät unter <a href="#geraete">Geräte</a> beim gewählten Kunden erscheint.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<label className="check"><input type="checkbox" checked={adminScripts} onChange={e => setAdminScripts(e.target.checked)}/>
|
<label className="check"><input type="checkbox" checked={adminScripts} onChange={e => setAdminScripts(e.target.checked)}/>
|
||||||
@@ -244,11 +249,25 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
|||||||
{' '}Für jeden Auftrag gelten zusätzlich die Skript- und Administratorrechte des Kunden und die Genehmigung in der WebUI.</p>}
|
{' '}Für jeden Auftrag gelten zusätzlich die Skript- und Administratorrechte des Kunden und die Genehmigung in der WebUI.</p>}
|
||||||
{!enrollment && <p className="muted">Die Downloadlinks und Befehle erscheinen hier, sobald ein Einmalcode angezeigt wird.</p>}
|
{!enrollment && <p className="muted">Die Downloadlinks und Befehle erscheinen hier, sobald ein Einmalcode angezeigt wird.</p>}
|
||||||
{enrollment && !origin && <p role="status">Für die Geräteaufnahme ist keine HTTPS-Downloadadresse konfiguriert.</p>}
|
{enrollment && !origin && <p role="status">Für die Geräteaufnahme ist keine HTTPS-Downloadadresse konfiguriert.</p>}
|
||||||
{origin && !linuxInstaller && !windowsInstaller && <p role="status">Für diesen Kunden ist derzeit kein Linux- oder Windows-Installer verfügbar.</p>}
|
{origin && !linuxInstaller && !windowsInstaller && !opnsenseInstaller && <p role="status">Für diesen Kunden ist derzeit kein Installer verfügbar.</p>}
|
||||||
{linuxInstaller && <>
|
{linuxInstaller && <>
|
||||||
<h4>Linux ({availableLinuxArchitectures.join(' und ')})</h4>
|
<h4>Linux ({availableLinuxArchitectures.join(' und ')})</h4>
|
||||||
<p>Installationsskript <a href={linuxInstaller} target="_blank" rel="noopener noreferrer">linux.sh</a></p>
|
<p>Installationsskript <a href={linuxInstaller} target="_blank" rel="noopener noreferrer">linux.sh</a></p>
|
||||||
<pre>{`curl --fail --show-error --silent '${linuxInstaller}' -o linux.sh && sudo sh linux.sh '${origin}'${adminScripts ? ' --enable-admin-scripts' : ''}`}</pre>
|
<pre>{`curl --fail --show-error --silent '${linuxInstaller}' -o linux.sh && sudo sh linux.sh '${origin}'${adminFlag}`}</pre>
|
||||||
|
</>}
|
||||||
|
{proxmoxInstaller && <>
|
||||||
|
<h4>Proxmox VE</h4>
|
||||||
|
<p>Proxmox VE enthält kein <code>sudo</code>. Führen Sie den Befehl in einer Shell als <code>root</code> aus, zum Beispiel über SSH oder die Shell des Nodes in der Proxmox-Oberfläche.
|
||||||
|
{' '}Der Installer richtet zusätzlich einen nur lesenden Proxmox-Zugang für Gäste und Backups ein.</p>
|
||||||
|
<pre>{`curl --fail --show-error --silent '${proxmoxInstaller}' -o linux.sh && sh linux.sh '${origin}'${adminFlag}`}</pre>
|
||||||
|
</>}
|
||||||
|
{opnsenseInstaller && <>
|
||||||
|
<h4>OPNsense</h4>
|
||||||
|
<p>Installationsskript <a href={opnsenseInstaller} target="_blank" rel="noopener noreferrer">opnsense.sh</a>.
|
||||||
|
{' '}Führen Sie den Befehl als <code>root</code> aus, über SSH oder an der Konsole mit Option <strong>8) Shell</strong>.
|
||||||
|
{' '}Der Installer lädt den Agenten, prüft jede Datei gegen die Prüfsumme des Servers, nimmt die Firewall auf und startet den Dienst.
|
||||||
|
{adminScripts && <>{' '}Skripte mit <code>root</code>-Rechten brauchen auf OPNsense zusätzlich den separat eingerichteten Root-Helper; der Installer richtet ihn nicht ein.</>}</p>
|
||||||
|
<pre>{`fetch -o opnsense.sh '${opnsenseInstaller}' && sh opnsense.sh '${origin}'`}</pre>
|
||||||
</>}
|
</>}
|
||||||
{windowsInstaller && <>
|
{windowsInstaller && <>
|
||||||
<h4>Windows (x64)</h4>
|
<h4>Windows (x64)</h4>
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ const glyphs = {
|
|||||||
suchen: 'M16 16l5 5 M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0',
|
suchen: 'M16 16l5 5 M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0',
|
||||||
plus: 'M12 5v14 M5 12h14',
|
plus: 'M12 5v14 M5 12h14',
|
||||||
abmelden: 'M10 4H4v16h6 M8 12h13 M16 7l5 5-5 5',
|
abmelden: 'M10 4H4v16h6 M8 12h13 M16 7l5 5-5 5',
|
||||||
zurueck: 'M20 12H4 M10 6l-6 6 6 6'
|
zurueck: 'M20 12H4 M10 6l-6 6 6 6',
|
||||||
|
server: 'M3 4h18v7H3z M3 13h18v7H3z M7 7.5h.01 M7 16.5h.01 M11 7.5h6 M11 16.5h6',
|
||||||
|
cloud: 'M7 19a4.5 4.5 0 0 1-.6-9A6 6 0 0 1 18 11.2a3.9 3.9 0 0 1 0 7.8z',
|
||||||
|
offen: 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0z M9.6 9.4a2.5 2.5 0 1 1 3.6 2.3c-.8.5-1.2 1-1.2 1.9 M12 17h.01'
|
||||||
};
|
};
|
||||||
export function NavIcon({ name }: { name: keyof typeof glyphs }) {
|
export function NavIcon({ name }: { name: keyof typeof glyphs }) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
+30
-1
@@ -97,7 +97,32 @@ section.fleet { padding:0; overflow:hidden; }
|
|||||||
.vm-hypervisor { display:flex; align-items:baseline; gap:6px; margin-top:5px; color:var(--subtle); font-size:.78rem; overflow-wrap:anywhere; }
|
.vm-hypervisor { display:flex; align-items:baseline; gap:6px; margin-top:5px; color:var(--subtle); font-size:.78rem; overflow-wrap:anywhere; }
|
||||||
.vm-hypervisor .nav-icon { width:13px; height:13px; flex:none; align-self:flex-start; margin-top:2px; }
|
.vm-hypervisor .nav-icon { width:13px; height:13px; flex:none; align-self:flex-start; margin-top:2px; }
|
||||||
.fleet-table .target-col { width:35px; }
|
.fleet-table .target-col { width:35px; }
|
||||||
.fleet-table th.purpose-col { width:17%; }
|
.fleet-table th.purpose-col,.fleet-table col.purpose-col { width:17%; }
|
||||||
|
.fleet-groups { --group:var(--accent); --group-soft:#eaf3ef; padding:0 14px 16px; background:#f7f9f8; border-top:1px solid var(--line); }
|
||||||
|
.fleet-head thead th { background:none; border-bottom:0; padding-block:11px 9px; }
|
||||||
|
.fleet-group { background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--group); border-radius:10px; overflow:hidden; box-shadow:0 1px 2px rgba(21,45,42,.05); }
|
||||||
|
.fleet-group + .fleet-group { margin-top:14px; }
|
||||||
|
.fleet-group.hetzner { --group:#b4432f; --group-soft:#fbeeea; }
|
||||||
|
.fleet-group.physical { --group:var(--blue); --group-soft:#e8f1f4; }
|
||||||
|
.fleet-group.unassigned { --group:#a8791f; --group-soft:#faf1df; border-style:dashed; border-left-style:solid; }
|
||||||
|
.fleet-group-head { display:flex; align-items:center; gap:12px; padding:11px 16px 11px 14px; background:linear-gradient(90deg,var(--group-soft),transparent 75%); border-bottom:1px solid var(--line); }
|
||||||
|
.group-icon { display:grid; place-items:center; flex:none; width:34px; height:34px; border-radius:9px; background:var(--group); color:#fff; }
|
||||||
|
.group-icon .nav-icon { width:18px; height:18px; }
|
||||||
|
.fleet-group-head > div { display:flex; flex-direction:column; min-width:0; }
|
||||||
|
.group-eyebrow { color:var(--group); font-size:.68rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase; }
|
||||||
|
.fleet-group-head strong { font-size:1.04rem; letter-spacing:-.015em; overflow-wrap:anywhere; }
|
||||||
|
.fleet-group-head strong a { color:inherit; text-decoration:none; } .fleet-group-head strong a:hover { text-decoration:underline; }
|
||||||
|
.fleet-group-head p { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:6px; margin:0 0 0 auto; }
|
||||||
|
.fleet-group-head p span { border-radius:20px; padding:2px 10px; background:var(--surface); border:1px solid var(--line); color:var(--subtle); font-size:.78rem; white-space:nowrap; }
|
||||||
|
.fleet-group-head p span:first-child { border-color:transparent; background:var(--group-soft); color:var(--group); font-weight:650; }
|
||||||
|
.fleet-group .fleet-table tbody tr:last-child td { border-bottom:0; }
|
||||||
|
.fleet-group tr.host { background:#fbfdfc; } .fleet-group tr.host .host-link { color:var(--ink); }
|
||||||
|
.link-source { display:block; color:var(--subtle); overflow-wrap:normal; }
|
||||||
|
.fleet-table col.host-col { width:15%; }
|
||||||
|
/* Guests hang on a branch below their host. */
|
||||||
|
.fleet-group tr.guest td.hostname { position:relative; padding-left:38px; }
|
||||||
|
.fleet-group tr.guest td.hostname::before { content:''; position:absolute; left:12px; top:0; bottom:50%; width:16px; border-left:2px solid var(--group); border-bottom:2px solid var(--group); border-bottom-left-radius:8px; opacity:.45; }
|
||||||
|
.fleet-group tr.guest:not(:last-child) td.hostname::after { content:''; position:absolute; left:12px; top:50%; bottom:0; border-left:2px solid var(--group); opacity:.45; }
|
||||||
.purpose-text { white-space:pre-wrap; overflow-wrap:anywhere; }
|
.purpose-text { white-space:pre-wrap; overflow-wrap:anywhere; }
|
||||||
.fleet-table .purpose-text { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; }
|
.fleet-table .purpose-text { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; }
|
||||||
.device-purpose textarea { font-family:inherit; }
|
.device-purpose textarea { font-family:inherit; }
|
||||||
@@ -167,6 +192,10 @@ ul.compact { margin:4px 0 0; padding-left:18px; font-size:.85rem; }
|
|||||||
.fleet-table td,.fleet-table td:first-child,.fleet-table td:last-child {display:block;padding:0;border:0;font-size:.9rem;}
|
.fleet-table td,.fleet-table td:first-child,.fleet-table td:last-child {display:block;padding:0;border:0;font-size:.9rem;}
|
||||||
.fleet-table td[data-label]::before {content:attr(data-label);display:block;color:var(--subtle);font-size:.73rem;}
|
.fleet-table td[data-label]::before {content:attr(data-label);display:block;color:var(--subtle);font-size:.73rem;}
|
||||||
.fleet-table .hostname {grid-column:1/-1;padding-right:28px;} .host-link {font-size:1rem;}
|
.fleet-table .hostname {grid-column:1/-1;padding-right:28px;} .host-link {font-size:1rem;}
|
||||||
|
.fleet-head {display:none;} .fleet-groups {padding:12px 10px;border-top:0;} .fleet-group .fleet-table tr:first-child {border-top:0;}
|
||||||
|
.fleet-group-head {flex-wrap:wrap;} .fleet-group-head p span {white-space:normal;} .fleet-group-head p {margin-left:46px;justify-content:flex-start;flex-basis:100%;}
|
||||||
|
.fleet-group tr.guest {margin-left:16px;border-left:2px solid color-mix(in srgb,var(--group) 45%,transparent);}
|
||||||
|
.fleet-group tr.guest td.hostname {padding-left:0;} .fleet-group tr.guest td.hostname::before,.fleet-group tr.guest td.hostname::after {display:none;}
|
||||||
.fleet-table .purpose-col {grid-column:1/-1;}
|
.fleet-table .purpose-col {grid-column:1/-1;}
|
||||||
.fleet-table .target-col {position:absolute;right:14px;top:14px;width:auto;} .capacity-track {width:min(76px,100%);}
|
.fleet-table .target-col {position:absolute;right:14px;top:14px;width:auto;} .capacity-track {width:min(76px,100%);}
|
||||||
.list-footer {border-top:1px solid var(--line);flex-wrap:wrap;} .facts {grid-template-columns:1fr 1fr;gap:12px;}
|
.list-footer {border-top:1px solid var(--line);flex-wrap:wrap;} .facts {grid-template-columns:1fr 1fr;gap:12px;}
|
||||||
|
|||||||
Reference in New Issue
Block a user