Show the detected machine type in device inventory
This commit is contained in:
@@ -6,7 +6,9 @@ Dieser Vertrag beschreibt den ausgelieferten Funktionsumfang. Die eingesetzten V
|
|||||||
|
|
||||||
Der Server betreibt die WebUI, den MCP-Endpunkt, den Releasekatalog und das Gerätegateway. PostgreSQL speichert die kundengebundenen Verwaltungsdaten. Der Geräteverkehr geht vom Client aus. Ein aufgenommener Agent authentisiert sich mit seinem Gerätezertifikat, übermittelt Heartbeats und Inventar, holt eventuell vorliegende Aufträge ab und meldet deren Verlauf und Ergebnis. Auch im Leerlauf meldet sich das Gerät regelmäßig.
|
Der Server betreibt die WebUI, den MCP-Endpunkt, den Releasekatalog und das Gerätegateway. PostgreSQL speichert die kundengebundenen Verwaltungsdaten. Der Geräteverkehr geht vom Client aus. Ein aufgenommener Agent authentisiert sich mit seinem Gerätezertifikat, übermittelt Heartbeats und Inventar, holt eventuell vorliegende Aufträge ab und meldet deren Verlauf und Ergebnis. Auch im Leerlauf meldet sich das Gerät regelmäßig.
|
||||||
|
|
||||||
Jede Installation ist an Kunde, Gerät und Agentenidentität gebunden. Die Standardansicht zeigt bereits authentisierte aktuelle Geräte als online oder offline, mit Hostname, Betriebssystem, freiem und gesamtem Speicherplatz, RAM, CPU und Kunde. Ausgemusterte, ersetzte und unbestätigte Kopplungen sind getrennt in der Historie abrufbar. Fehlende Inventarwerte bleiben als solche erkennbar. Der Zeitpunkt des letzten Kontakts und der Zeitpunkt der Inventarmessung haben unterschiedliche Bedeutung. [Geräteauswahl](crates/server/src/device_list.sql)
|
Jede Installation ist an Kunde, Gerät und Agentenidentität gebunden. Die Standardansicht zeigt bereits authentisierte aktuelle Geräte als online oder offline, mit Hostname, Type, Betriebssystem, freiem und gesamtem Speicherplatz, RAM, CPU und Kunde. Ausgemusterte, ersetzte und unbestätigte Kopplungen sind getrennt in der Historie abrufbar. Fehlende Inventarwerte bleiben als solche erkennbar. Der Zeitpunkt des letzten Kontakts und der Zeitpunkt der Inventarmessung haben unterschiedliche Bedeutung. [Geräteauswahl](crates/server/src/device_list.sql)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
Kunden lassen sich in der WebUI anlegen und umbenennen. Beim Kundenwechsel erhält das Gerät eine neue Kopplung. Eine ausgeschiedene Installation kann nach Widerruf und persönlicher Bestätigung endgültig gelöscht werden. Ein noch gültiger offener Genehmigungsantrag oder ein nicht abgeschlossener Job einschließlich `unknown` sperrt die Löschung. Daten weiterhin beteiligter Zielgeräte bleiben erhalten. [Regeln zur Löschung](migrations/0036_delete_device_pairing.sql)
|
Kunden lassen sich in der WebUI anlegen und umbenennen. Beim Kundenwechsel erhält das Gerät eine neue Kopplung. Eine ausgeschiedene Installation kann nach Widerruf und persönlicher Bestätigung endgültig gelöscht werden. Ein noch gültiger offener Genehmigungsantrag oder ein nicht abgeschlossener Job einschließlich `unknown` sperrt die Löschung. Daten weiterhin beteiligter Zielgeräte bleiben erhalten. [Regeln zur Löschung](migrations/0036_delete_device_pairing.sql)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use crate::{
|
|||||||
actions::{ServiceUnit, reboot_required},
|
actions::{ServiceUnit, reboot_required},
|
||||||
process,
|
process,
|
||||||
};
|
};
|
||||||
|
use rmm_domain::inventory_document::DeviceType;
|
||||||
use std::{
|
use std::{
|
||||||
collections::BTreeMap,
|
collections::BTreeMap,
|
||||||
ffi::{CStr, CString},
|
ffi::{CStr, CString},
|
||||||
@@ -257,6 +258,8 @@ pub struct UpdateStatus {
|
|||||||
#[derive(Debug, Clone, serde::Serialize)]
|
#[derive(Debug, Clone, serde::Serialize)]
|
||||||
pub struct Hardware {
|
pub struct Hardware {
|
||||||
pub readable_dmi: BTreeMap<String, String>,
|
pub readable_dmi: BTreeMap<String, String>,
|
||||||
|
pub device_type: Option<DeviceType>,
|
||||||
|
pub proxmox_ve: bool,
|
||||||
}
|
}
|
||||||
#[derive(Debug, Clone, serde::Serialize)]
|
#[derive(Debug, Clone, serde::Serialize)]
|
||||||
pub struct LinuxInventory {
|
pub struct LinuxInventory {
|
||||||
@@ -1116,7 +1119,36 @@ pub fn updates() -> Observation<UpdateStatus> {
|
|||||||
}
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
fn virtualization_type(output: &process::Output) -> Option<DeviceType> {
|
||||||
|
if output.timed_out || output.truncated {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
match (
|
||||||
|
output.code,
|
||||||
|
std::str::from_utf8(&output.stdout).ok()?.trim(),
|
||||||
|
) {
|
||||||
|
(Some(1), "none") => Some(DeviceType::Physical),
|
||||||
|
(Some(0), name) if !name.is_empty() && name != "none" => Some(DeviceType::Virtual),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn machine_type(proxmox_ve: bool) -> Option<DeviceType> {
|
||||||
|
if proxmox_ve {
|
||||||
|
return Some(DeviceType::Hypervisor);
|
||||||
|
}
|
||||||
|
let output = process::run(
|
||||||
|
"/usr/bin/systemd-detect-virt",
|
||||||
|
&[],
|
||||||
|
Duration::from_secs(2),
|
||||||
|
512,
|
||||||
|
)
|
||||||
|
.ok()?;
|
||||||
|
virtualization_type(&output)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn hardware() -> Observation<Hardware> {
|
pub fn hardware() -> Observation<Hardware> {
|
||||||
|
const SOURCE: &str = "linux.dmi:/sys/class/dmi/id;systemd-detect-virt;pve-manager";
|
||||||
let mut readable_dmi = BTreeMap::new();
|
let mut readable_dmi = BTreeMap::new();
|
||||||
for field in [
|
for field in [
|
||||||
"sys_vendor",
|
"sys_vendor",
|
||||||
@@ -1132,15 +1164,21 @@ pub fn hardware() -> Observation<Hardware> {
|
|||||||
readable_dmi.insert(field.into(), value);
|
readable_dmi.insert(field.into(), value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if readable_dmi.is_empty() {
|
let proxmox_ve =
|
||||||
Observation::unavailable(
|
Path::new("/usr/bin/pveversion").is_file() && Path::new("/usr/bin/pvedaemon").is_file();
|
||||||
"linux.dmi:/sys/class/dmi/id",
|
let device_type = machine_type(proxmox_ve);
|
||||||
Quality::Unsupported,
|
if readable_dmi.is_empty() && device_type.is_none() {
|
||||||
"DMI_UNAVAILABLE",
|
Observation::unavailable(SOURCE, Quality::Unsupported, "HARDWARE_UNAVAILABLE")
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
Observation::valid("linux.dmi:/sys/class/dmi/id", Hardware { readable_dmi })
|
Observation::valid(
|
||||||
.partial("READABLE_DMI_ONLY_NO_SMART_OR_ENCRYPTION_PROOF")
|
SOURCE,
|
||||||
|
Hardware {
|
||||||
|
readable_dmi,
|
||||||
|
device_type,
|
||||||
|
proxmox_ve,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.partial("NO_SMART_OR_ENCRYPTION_PROOF")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1362,6 +1400,26 @@ mod tests {
|
|||||||
assert_eq!(request.since_filter, "@100.123457");
|
assert_eq!(request.since_filter, "@100.123457");
|
||||||
assert_eq!(request.until_filter, "@101.987654");
|
assert_eq!(request.until_filter, "@101.987654");
|
||||||
}
|
}
|
||||||
|
#[test]
|
||||||
|
fn machine_types_distinguish_proxmox_guests_and_probe_failures() {
|
||||||
|
assert_eq!(machine_type(true), Some(DeviceType::Hypervisor));
|
||||||
|
let mut output = process::Output {
|
||||||
|
code: Some(0),
|
||||||
|
stdout: b"kvm\n".to_vec(),
|
||||||
|
stderr: vec![],
|
||||||
|
truncated: false,
|
||||||
|
timed_out: false,
|
||||||
|
interrupted: false,
|
||||||
|
};
|
||||||
|
assert_eq!(virtualization_type(&output), Some(DeviceType::Virtual));
|
||||||
|
output.code = Some(1);
|
||||||
|
assert_eq!(virtualization_type(&output), None);
|
||||||
|
output.stdout = b"none\n".to_vec();
|
||||||
|
assert_eq!(virtualization_type(&output), Some(DeviceType::Physical));
|
||||||
|
output.timed_out = true;
|
||||||
|
assert_eq!(virtualization_type(&output), None);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn harmless_native_read_providers() {
|
fn harmless_native_read_providers() {
|
||||||
assert_eq!(memory().quality, Quality::Valid);
|
assert_eq!(memory().quality, Quality::Valid);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
//! uninstall commands; registry entries are evidence, not verified MSI state.
|
//! uninstall commands; registry entries are evidence, not verified MSI state.
|
||||||
use anyhow::{Result, ensure};
|
use anyhow::{Result, ensure};
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
use rmm_domain::inventory_document::DeviceType;
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use std::{
|
use std::{
|
||||||
mem::{size_of, zeroed},
|
mem::{size_of, zeroed},
|
||||||
@@ -64,6 +65,82 @@ fn text(key: HKEY, name: &str) -> Result<Option<String>> {
|
|||||||
Ok(Some(String::from_utf16(&data[..count - 1])?))
|
Ok(Some(String::from_utf16(&data[..count - 1])?))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
fn non_microsoft_hypervisor() -> bool {
|
||||||
|
use std::arch::x86_64::__cpuid;
|
||||||
|
if __cpuid(1).ecx & (1 << 31) == 0 {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
let vendor = __cpuid(0x4000_0000);
|
||||||
|
// The Microsoft hypervisor can also be active on physical VBS machines.
|
||||||
|
[vendor.ebx, vendor.ecx, vendor.edx]
|
||||||
|
!= [
|
||||||
|
u32::from_le_bytes(*b"Micr"),
|
||||||
|
u32::from_le_bytes(*b"osof"),
|
||||||
|
u32::from_le_bytes(*b"t Hv"),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "x86_64"))]
|
||||||
|
fn non_microsoft_hypervisor() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
fn classify_machine(
|
||||||
|
hyper_v_host: bool,
|
||||||
|
guest_hypervisor: bool,
|
||||||
|
manufacturer: Option<&str>,
|
||||||
|
product: Option<&str>,
|
||||||
|
) -> Option<DeviceType> {
|
||||||
|
if hyper_v_host {
|
||||||
|
return Some(DeviceType::Hypervisor);
|
||||||
|
}
|
||||||
|
let manufacturer = manufacturer.unwrap_or_default().trim().to_ascii_lowercase();
|
||||||
|
let product = product.unwrap_or_default().trim().to_ascii_lowercase();
|
||||||
|
let virtual_firmware = [
|
||||||
|
"qemu",
|
||||||
|
"vmware",
|
||||||
|
"virtualbox",
|
||||||
|
"xen",
|
||||||
|
"parallels",
|
||||||
|
"bhyve",
|
||||||
|
"kvm",
|
||||||
|
"virtual machine",
|
||||||
|
"virtual platform",
|
||||||
|
]
|
||||||
|
.iter()
|
||||||
|
.any(|prefix| manufacturer.starts_with(prefix) || product.starts_with(prefix));
|
||||||
|
if guest_hypervisor || virtual_firmware {
|
||||||
|
return Some(DeviceType::Virtual);
|
||||||
|
}
|
||||||
|
(!manufacturer.is_empty() && !product.is_empty()).then_some(DeviceType::Physical)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn machine_type() -> Option<DeviceType> {
|
||||||
|
let hyper_v_host = open(
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
r"SYSTEM\CurrentControlSet\Services\vmms",
|
||||||
|
KEY_WOW64_64KEY,
|
||||||
|
)
|
||||||
|
.is_ok();
|
||||||
|
let bios = open(
|
||||||
|
HKEY_LOCAL_MACHINE,
|
||||||
|
r"HARDWARE\DESCRIPTION\System\BIOS",
|
||||||
|
KEY_WOW64_64KEY,
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
|
let read = |name| {
|
||||||
|
bios.as_ref()
|
||||||
|
.and_then(|key| text(key.0, name).ok().flatten())
|
||||||
|
};
|
||||||
|
classify_machine(
|
||||||
|
hyper_v_host,
|
||||||
|
non_microsoft_hypervisor(),
|
||||||
|
read("SystemManufacturer").as_deref(),
|
||||||
|
read("SystemProductName").as_deref(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fn hardware() -> Result<Value> {
|
fn hardware() -> Result<Value> {
|
||||||
let mut system: SYSTEM_INFO = unsafe { zeroed() };
|
let mut system: SYSTEM_INFO = unsafe { zeroed() };
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -91,7 +168,7 @@ fn hardware() -> Result<Value> {
|
|||||||
Ok(
|
Ok(
|
||||||
json!({"cpu_model":cpu_model, "logical_processors_visible":system.dwNumberOfProcessors,
|
json!({"cpu_model":cpu_model, "logical_processors_visible":system.dwNumberOfProcessors,
|
||||||
"memory_total_bytes":memory.ullTotalPhys,"memory_available_bytes":memory.ullAvailPhys,
|
"memory_total_bytes":memory.ullTotalPhys,"memory_available_bytes":memory.ullAvailPhys,
|
||||||
"memory_load_percent":memory.dwMemoryLoad}),
|
"memory_load_percent":memory.dwMemoryLoad,"device_type":machine_type()}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,7 +274,7 @@ pub fn observations() -> Vec<Value> {
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
"windows.hardware",
|
"windows.hardware",
|
||||||
"windows.win32:GetNativeSystemInfo+GlobalMemoryStatusEx;registry:CentralProcessor",
|
"windows.win32:GetNativeSystemInfo+GlobalMemoryStatusEx;registry:CentralProcessor,BIOS,vmms;cpuid",
|
||||||
hardware as Provider,
|
hardware as Provider,
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
@@ -226,3 +303,34 @@ pub fn observations() -> Vec<Value> {
|
|||||||
})
|
})
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn machine_type_distinguishes_hyper_v_hosts_from_guests() {
|
||||||
|
let guest = (Some("Microsoft Corporation"), Some("Virtual Machine"));
|
||||||
|
assert_eq!(
|
||||||
|
classify_machine(false, false, guest.0, guest.1),
|
||||||
|
Some(DeviceType::Virtual)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
classify_machine(true, false, guest.0, guest.1),
|
||||||
|
Some(DeviceType::Hypervisor)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
classify_machine(false, false, Some("QEMU"), Some("Standard PC")),
|
||||||
|
Some(DeviceType::Virtual)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
classify_machine(false, true, None, None),
|
||||||
|
Some(DeviceType::Virtual)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
classify_machine(false, false, Some("Dell Inc."), Some("Precision")),
|
||||||
|
Some(DeviceType::Physical)
|
||||||
|
);
|
||||||
|
assert_eq!(classify_machine(false, false, None, None), None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
//! Additive bounded passive metadata; the strict original Inventory stays intact.
|
//! Additive bounded passive metadata; the strict original Inventory stays intact.
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::Deserialize;
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum DeviceType {
|
||||||
|
Physical,
|
||||||
|
Virtual,
|
||||||
|
Hypervisor,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
struct Observation {
|
struct Observation {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use axum::{
|
|||||||
http::{HeaderMap, HeaderValue, StatusCode},
|
http::{HeaderMap, HeaderValue, StatusCode},
|
||||||
};
|
};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
use rmm_domain::inventory_document::DeviceType;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Value, json};
|
use serde_json::{Value, json};
|
||||||
use sqlx::{Postgres, Row, Transaction, postgres::PgRow};
|
use sqlx::{Postgres, Row, Transaction, postgres::PgRow};
|
||||||
@@ -289,7 +290,17 @@ fn volumes(data: &Value) -> Value {
|
|||||||
}
|
}
|
||||||
items.into()
|
items.into()
|
||||||
}
|
}
|
||||||
|
fn device_type(hardware: &Value) -> Option<DeviceType> {
|
||||||
|
DeviceType::deserialize(&hardware["device_type"]).ok()
|
||||||
|
}
|
||||||
|
|
||||||
fn os_label(data: &Value) -> Option<String> {
|
fn os_label(data: &Value) -> Option<String> {
|
||||||
|
let linux_hardware = observed(data, "linux.hardware");
|
||||||
|
if linux_hardware["proxmox_ve"].as_bool() == Some(true)
|
||||||
|
&& device_type(linux_hardware) == Some(DeviceType::Hypervisor)
|
||||||
|
{
|
||||||
|
return Some("Proxmox VE".to_owned());
|
||||||
|
}
|
||||||
let raw = data["os"].as_str()?;
|
let raw = data["os"].as_str()?;
|
||||||
if let Some(pretty) = observed(data, "linux.os")["release"]["PRETTY_NAME"].as_str() {
|
if let Some(pretty) = observed(data, "linux.os")["release"]["PRETTY_NAME"].as_str() {
|
||||||
return Some(pretty.to_owned());
|
return Some(pretty.to_owned());
|
||||||
@@ -341,6 +352,8 @@ fn project(row: &PgRow, now: DateTime<Utc>, full: bool) -> Value {
|
|||||||
let data = row.get::<Option<Value>, _>("data").unwrap_or(Value::Null);
|
let data = row.get::<Option<Value>, _>("data").unwrap_or(Value::Null);
|
||||||
let cpu = observed(&data, "linux.cpu");
|
let cpu = observed(&data, "linux.cpu");
|
||||||
let windows = observed(&data, "windows.hardware");
|
let windows = observed(&data, "windows.hardware");
|
||||||
|
let device_type =
|
||||||
|
device_type(observed(&data, "linux.hardware")).or_else(|| device_type(windows));
|
||||||
let last = row.get::<Option<DateTime<Utc>>, _>("last_contact_at");
|
let last = row.get::<Option<DateTime<Utc>>, _>("last_contact_at");
|
||||||
let revoked = row.get::<Option<DateTime<Utc>>, _>("revoked_at");
|
let revoked = row.get::<Option<DateTime<Utc>>, _>("revoked_at");
|
||||||
let presence = match (revoked, last.map(|t| (now - t).num_seconds())) {
|
let presence = match (revoked, last.map(|t| (now - t).num_seconds())) {
|
||||||
@@ -355,7 +368,7 @@ fn project(row: &PgRow, now: DateTime<Utc>, full: bool) -> Value {
|
|||||||
"agent_id":row.get::<Uuid,_>("agent_id"),"asset_id":row.get::<Uuid,_>("asset_id"),
|
"agent_id":row.get::<Uuid,_>("agent_id"),"asset_id":row.get::<Uuid,_>("asset_id"),
|
||||||
"status":row.get::<String,_>("status"),"lifecycle":row.get::<String,_>("lifecycle"),
|
"status":row.get::<String,_>("status"),"lifecycle":row.get::<String,_>("lifecycle"),
|
||||||
"archived_at":row.get::<Option<DateTime<Utc>>,_>("archived_at"),"revoked_at":revoked,
|
"archived_at":row.get::<Option<DateTime<Utc>>,_>("archived_at"),"revoked_at":revoked,
|
||||||
"hostname":data["hostname"].as_str(),"os":os_label(&data),
|
"hostname":data["hostname"].as_str(),"device_type":device_type,"os":os_label(&data),
|
||||||
"disk_free_bytes":data["root_available_bytes"].as_u64(),"disk_total_bytes":data["root_total_bytes"].as_u64(),
|
"disk_free_bytes":data["root_available_bytes"].as_u64(),"disk_total_bytes":data["root_total_bytes"].as_u64(),
|
||||||
"cpu_model":cpu["model"].as_str().or_else(||windows["cpu_model"].as_str()),
|
"cpu_model":cpu["model"].as_str().or_else(||windows["cpu_model"].as_str()),
|
||||||
"cpu_logical_count":cpu["logical_processors"].as_u64().or_else(||windows["logical_processors_visible"].as_u64()),
|
"cpu_logical_count":cpu["logical_processors"].as_u64().or_else(||windows["logical_processors_visible"].as_u64()),
|
||||||
@@ -411,6 +424,21 @@ mod tests {
|
|||||||
assert!(os_label(&Value::Null).is_none());
|
assert!(os_label(&Value::Null).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn proxmox_os_label_requires_a_valid_hypervisor_observation() {
|
||||||
|
let mut snapshot = json!({
|
||||||
|
"os": "Debian",
|
||||||
|
"observations": [{"scope":"linux.hardware","quality":"valid",
|
||||||
|
"data":{"device_type":"hypervisor","proxmox_ve":true}}]
|
||||||
|
});
|
||||||
|
assert_eq!(os_label(&snapshot).as_deref(), Some("Proxmox VE"));
|
||||||
|
snapshot["observations"][0]["data"]["device_type"] = json!("virtual");
|
||||||
|
assert_eq!(os_label(&snapshot).as_deref(), Some("Debian"));
|
||||||
|
snapshot["observations"][0]["quality"] = json!("error");
|
||||||
|
assert_eq!(device_type(observed(&snapshot, "linux.hardware")), None);
|
||||||
|
assert_eq!(device_type(&json!({"device_type":"desktop"})), None);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
#[ignore = "requires the disposable RLS database from tests/local_access_database.py"]
|
#[ignore = "requires the disposable RLS database from tests/local_access_database.py"]
|
||||||
async fn visibility_is_filtered_before_the_cursor_limit() {
|
async fn visibility_is_filtered_before_the_cursor_limit() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ Alle acht Versuche lieferten Exitcode 0. Bei beiden Neustarts wurde die Wiederan
|
|||||||
| Funktion | Beobachtung und Beleg |
|
| Funktion | Beobachtung und Beleg |
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| Öffentliche Verwaltung und Kundengrenzen | HTTPS-WebUI mit Passwort/TOTP, MCP mit widerrufbarem Token. Gerätebestand, Historie, eingeschränkter und kundenübergreifender Zugriff sowie Widerruf sind geprüft. [Öffentlicher Zugang](evidence/public-access-20261117.json) · [Kunden und Geräte](evidence/customer-fleet-20261117.json) |
|
| Öffentliche Verwaltung und Kundengrenzen | HTTPS-WebUI mit Passwort/TOTP, MCP mit widerrufbarem Token. Gerätebestand, Historie, eingeschränkter und kundenübergreifender Zugriff sowie Widerruf sind geprüft. [Öffentlicher Zugang](evidence/public-access-20261117.json) · [Kunden und Geräte](evidence/customer-fleet-20261117.json) |
|
||||||
|
| Gerätetyp in der Übersicht | Spalte „Type“ nach „Hostname“ mit `physical`, `virtual` und `hypervisor`. Erkannte Proxmox-VE-Hosts zeigen zusätzlich `Proxmox VE` als OS. [Inventarprojektion](../crates/server/src/devices.rs) · [Geräteansicht](../web/src/devices.tsx) |
|
||||||
| 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) |
|
| 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) |
|
||||||
| 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) |
|
| 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) |
|
||||||
| Betriebssystemupdate per PowerShell | Die Windows-Updatevorlage installierte KB890830 v5.147 als SYSTEM. Ergebnis und Windows-Ereignis 19 bestätigen die Installation. [Installationsbeleg](evidence/windows-update-installation-20261117.json) |
|
| Betriebssystemupdate per PowerShell | Die Windows-Updatevorlage installierte KB890830 v5.147 als SYSTEM. Ergebnis und Windows-Ereignis 19 bestätigen die Installation. [Installationsbeleg](evidence/windows-update-installation-20261117.json) |
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ test('creates and renames a customer, opens its inventory, and hides editing for
|
|||||||
if (!customer) throw new Error('Kunde fehlt im Testbestand');
|
if (!customer) throw new Error('Kunde fehlt im Testbestand');
|
||||||
return route.fulfill({ json: listing([{
|
return route.fulfill({ json: listing([{
|
||||||
tenant_id: customerId, customer_name: customer.name, asset_id: 'device-1', agent_id: 'agent-1',
|
tenant_id: customerId, customer_name: customer.name, asset_id: 'device-1', agent_id: 'agent-1',
|
||||||
lifecycle: 'current', status: 'online', hostname: 'NORD-PC', os: 'Linux'
|
lifecycle: 'current', status: 'online', hostname: 'NORD-PC', device_type: 'hypervisor', os: 'Proxmox VE'
|
||||||
}]) });
|
}]) });
|
||||||
}
|
}
|
||||||
if (method === 'POST' || method === 'PATCH') {
|
if (method === 'POST' || method === 'PATCH') {
|
||||||
@@ -101,7 +101,13 @@ test('creates and renames a customer, opens its inventory, and hides editing for
|
|||||||
await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Geräte', exact: true })).toBeVisible();
|
||||||
await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId);
|
await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId);
|
||||||
await expect(page.getByRole('combobox', { name: 'Kunde im Gerätebestand', exact: true })).toHaveValue(customerId);
|
await expect(page.getByRole('combobox', { name: 'Kunde im Gerätebestand', exact: true })).toHaveValue(customerId);
|
||||||
await expect(page.getByRole('row').filter({ hasText: 'NORD-PC' })).toContainText('Nord GmbH');
|
const device = page.getByRole('row').filter({ hasText: 'NORD-PC' });
|
||||||
|
await expect(device).toContainText('Nord GmbH');
|
||||||
|
const headers = page.getByRole('columnheader');
|
||||||
|
await expect(headers.nth(1)).toHaveText('Hostname');
|
||||||
|
await expect(headers.nth(2)).toHaveText('Type');
|
||||||
|
await expect(device.getByRole('cell').nth(2)).toHaveText('hypervisor');
|
||||||
|
await expect(device.getByRole('cell').nth(3)).toHaveText('Proxmox VE');
|
||||||
const navigation = page.getByRole('navigation', { name: 'Hauptnavigation' });
|
const navigation = page.getByRole('navigation', { name: 'Hauptnavigation' });
|
||||||
await navigation.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
await navigation.getByRole('link', { name: 'Aufträge', exact: true }).click();
|
||||||
await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId);
|
await expect(page.getByRole('combobox', { name: 'Kunde', exact: true })).toHaveValue(customerId);
|
||||||
|
|||||||
+3
-1
@@ -169,6 +169,7 @@ function DeviceDetail({
|
|||||||
const jobs = Array.isArray(d?.recent_jobs) ? d.recent_jobs.map((v) => record(v)) : null;
|
const jobs = Array.isArray(d?.recent_jobs) ? d.recent_jobs.map((v) => record(v)) : null;
|
||||||
const facts = d && [
|
const facts = d && [
|
||||||
['Kunde', label(d.customer_name)],
|
['Kunde', label(d.customer_name)],
|
||||||
|
['Type', label(d.device_type)],
|
||||||
['Betriebssystem', label(d.os)],
|
['Betriebssystem', label(d.os)],
|
||||||
['RAM', gib(d.ram_total_bytes) === null ? unknown : gib(d.ram_total_bytes) + ' GiB'],
|
['RAM', gib(d.ram_total_bytes) === null ? unknown : gib(d.ram_total_bytes) + ' GiB'],
|
||||||
['CPU', [cpu(d).primary, cpu(d).secondary].filter(Boolean).join(' · ')],
|
['CPU', [cpu(d).primary, cpu(d).secondary].filter(Boolean).join(' · ')],
|
||||||
@@ -533,7 +534,7 @@ export function Devices({
|
|||||||
<span className="sr-only">Ziel auswählen</span>
|
<span className="sr-only">Ziel auswählen</span>
|
||||||
</th>
|
</th>
|
||||||
)}
|
)}
|
||||||
{['Hostname', 'OS', 'Status', 'Speicher frei / gesamt', 'RAM', 'CPU', 'Kunde'].map(
|
{['Hostname', 'Type', 'OS', 'Status', 'Speicher frei / gesamt', 'RAM', 'CPU', 'Kunde'].map(
|
||||||
(h) => (
|
(h) => (
|
||||||
<th scope="col" key={h}>
|
<th scope="col" key={h}>
|
||||||
{h}
|
{h}
|
||||||
@@ -582,6 +583,7 @@ export function Devices({
|
|||||||
{label(d.hostname)}
|
{label(d.hostname)}
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
<td data-label="Type">{label(d.device_type)}</td>
|
||||||
<td data-label="OS">{label(d.os)}</td>
|
<td data-label="OS">{label(d.os)}</td>
|
||||||
<td data-label="Status" className="device-presence">
|
<td data-label="Status" className="device-presence">
|
||||||
<Presence d={d} />
|
<Presence d={d} />
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ section.fleet { padding:0; overflow:hidden; }
|
|||||||
.fleet-table tbody tr { cursor:pointer; } .fleet-table tbody tr:hover,.fleet-table tr:focus-within { background:#f2f7f4; }
|
.fleet-table tbody tr { cursor:pointer; } .fleet-table tbody tr:hover,.fleet-table tr:focus-within { background:#f2f7f4; }
|
||||||
.release-table tbody tr { cursor:auto; }
|
.release-table tbody tr { cursor:auto; }
|
||||||
.fleet-table .target-col { width:35px; }
|
.fleet-table .target-col { width:35px; }
|
||||||
|
.fleet-table td[data-label="Type"] { overflow-wrap:anywhere; }
|
||||||
.fleet-table input[type=checkbox] { margin:0; }
|
.fleet-table input[type=checkbox] { margin:0; }
|
||||||
.host-link { padding:0; background:none; color:var(--accent); text-align:left; font-weight:680; margin:0; overflow-wrap:anywhere; }
|
.host-link { padding:0; background:none; color:var(--accent); text-align:left; font-weight:680; margin:0; overflow-wrap:anywhere; }
|
||||||
.fleet-table .storage { font-variant-numeric:tabular-nums; }
|
.fleet-table .storage { font-variant-numeric:tabular-nums; }
|
||||||
|
|||||||
Reference in New Issue
Block a user