Compare commits

..
Author SHA1 Message Date
kevin_janssen 5a9eafbff1 Record Windows idle CPU and SYSTEM follow-up
Rust development slice / linux (push) Failing after 13s
2026-11-19 10:21:07 +01:00
kevin_janssen f01e81418e Verify damaged history still blocks durable no-start
Rust development slice / linux (push) Failing after 13s
2026-11-19 10:10:02 +01:00
kevin_janssen d4cbc40979 Avoid replaying the helper journal history during idle sync 2026-11-19 10:09:38 +01:00
kevin_janssen 478ee1fc1a Avoid repeated full journal scans and fast ticks in Windows idle 2026-11-19 10:04:26 +01:00
19 changed files with 437 additions and 344 deletions
@@ -20,8 +20,6 @@ Eine ausgeschiedene Installation kann nach Widerruf und persönlicher Bestätigu
In den Gerätedetails erscheinen OS-Installationszeit, letzter Systemstart, Hersteller, BIOS-Seriennummer, Netzwerkkarten samt IPv4- und IPv6-Adressen, installierte Software und die bei der letzten Inventur angemeldeten Benutzer. Windows meldet den vom Betriebssystem erfassten Installationszeitpunkt. Linux kennzeichnet den Zeitstempel aus dem Installer-Verzeichnis oder dem Root-Dateisystem als Schätzung. Das Softwareinventar erfasst Linux-Pakete aus dpkg und Windows-Systeminstallationen aus der Uninstall-Registrierung. Begrenzte Meldungen werden ausgewiesen. Herstellergarantie und Firmwaredaten erscheinen bei verfügbarem Befund. Die Daten gehören zum kundengebundenen Inventar des Geräts. [Geräteansicht](web/src/device-inventory.tsx)
Die Spalte **Zweck** und das Gerätedetail zeigen optionalen Freitext. Unter **Zweck bearbeiten** können Betreiber mit Inventarlese- und Geräteverwaltungsrecht für den betreffenden Kunden bis zu 500 Zeichen speichern oder den Text entfernen. Der Zweck gehört zum Gerät beim bisherigen Kunden und wird beim Kundenwechsel nicht übernommen. Die Änderung wird ohne den Text auditiert und erzeugt keinen Geräteauftrag.
## Vom Skript zum Ergebnis
| Schritt | Verhalten |
+53 -27
View File
@@ -205,6 +205,7 @@ pub struct HelperSync<V = DefaultVerifier> {
born: DateTime<Utc>,
capture: Option<Capture>,
lease: Option<Lease>,
integrity: Option<crate::ledger::IntegrityMonitor>,
}
impl HelperSync<DefaultVerifier> {
/// No persisted ready bit can open a newly started helper.
@@ -222,6 +223,7 @@ impl<V: Ed25519Verifier> HelperSync<V> {
born: clock.now()?,
capture: None,
lease: None,
integrity: None,
})
}
/// Select exactly one protected helper execution identity, closing leases.
@@ -230,6 +232,12 @@ impl<V: Ed25519Verifier> HelperSync<V> {
self.identity = identity;
self
}
/// Use with one protected SQLite connection retained for this instance.
/// The native owner must run a full check before any new host effect.
pub fn with_periodic_idle_integrity_checks(mut self) -> Self {
self.integrity = Some(crate::ledger::IntegrityMonitor::default());
self
}
pub fn close(&mut self) {
self.lease = None;
self.capture = None;
@@ -288,7 +296,8 @@ impl<V: Ed25519Verifier> HelperSync<V> {
ledger_fingerprint: lease.fingerprint.clone(),
captured_at: capture.captured_at,
};
self.verify_no_start_anchor(db, guard, &anchor, clock, boot)?;
let audit_history = self.integrity.is_none();
self.verify_no_start_anchor(db, guard, &anchor, clock, boot, audit_history)?;
Ok(anchor)
}
/// Consume exactly the approved update attempt and delegate its ORIGINAL
@@ -389,9 +398,9 @@ impl<V: Ed25519Verifier> HelperSync<V> {
tx.commit()?;
return Ok(outcome);
}
self.verify_no_start_anchor(&tx, guard, anchor, clock, boot)?;
self.verify_no_start_anchor(&tx, guard, anchor, clock, boot, true)?;
let observation = guard.verify_no_dispatch(request, anchor)?;
let now = self.verify_no_start_anchor(&tx, guard, anchor, clock, boot)?;
let now = self.verify_no_start_anchor(&tx, guard, anchor, clock, boot, true)?;
ensure!(
!observation.intent_id.is_nil()
&& digest(&observation.intent_sha256)
@@ -421,6 +430,7 @@ impl<V: Ed25519Verifier> HelperSync<V> {
anchor: &NoStartAnchor,
clock: &impl Clock,
boot: &impl BootSource,
audit_history: bool,
) -> Result<DateTime<Utc>> {
guard.check(db)?;
let now = clock.now()?;
@@ -445,15 +455,18 @@ impl<V: Ed25519Verifier> HelperSync<V> {
&& ledger_fingerprint(db)? == anchor.ledger_fingerprint,
"DENIAL_HELPER_LINEAGE_CHANGED"
);
// Exact equality is deliberate: a first implementation refuses even
// legitimate intervening progress rather than inventing lineage links.
verify_checkpoint_repair_history_with(
db,
&self.binding,
None,
self.identity,
&self.verifier,
)?;
// Idle anchor capture checks the current signed head. The native
// executor audits the full history before execution, and abandonment
// always audits it under the same transaction before recording evidence.
if audit_history {
verify_checkpoint_repair_history_with(
db,
&self.binding,
None,
self.identity,
&self.verifier,
)?;
}
let (response, raw): (Vec<u8>, Vec<u8>) = db.query_row(
"SELECT response,request FROM helper_sync_decisions WHERE decision_id=?1",
[anchor.decision_id.to_string()],
@@ -483,8 +496,12 @@ impl<V: Ed25519Verifier> HelperSync<V> {
&& decision.helper_journal_id == Some(anchor.journal_id)
&& decision.helper_checkpoint == anchor.checkpoint
&& decision.connection_generation == anchor.connection_generation
&& decision.request_hash == anchor.sync_request_sha256
&& capture.journal_id == anchor.journal_id
&& capture.checkpoint == anchor.checkpoint
&& capture.captured_at == anchor.captured_at
&& capture.boot_id == anchor.boot_id
&& capture.captured_at <= decision.issued_at
&& capture.captured_at <= now,
"DENIAL_CONFIRMED_READY_REQUIRED"
);
@@ -523,7 +540,12 @@ impl<V: Ed25519Verifier> HelperSync<V> {
);
let boot_id = boot.current_boot()?;
ensure!(!boot_id.is_nil(), "BOOT_ID_REQUIRED");
initialize(db, &self.binding)?;
if let Some(integrity) = &mut self.integrity {
integrity.check(db, false, "ROOT_LEDGER_INTEGRITY")?;
initialize_schema(db, &self.binding)?;
} else {
initialize(db, &self.binding)?;
}
let tx = db.transaction_with_behavior(TransactionBehavior::Immediate)?;
let meta = metadata(&tx)?;
ensure!(meta.fault.is_none(), "HELPER_MANUAL_RECOVERY_REQUIRED");
@@ -1031,13 +1053,17 @@ struct Meta {
agent_checkpoint: u64,
}
fn initialize(db: &Connection, binding: &Binding) -> Result<()> {
let check: String = db.query_row("PRAGMA integrity_check", [], |r| r.get(0))?;
ensure!(check == "ok", "ROOT_LEDGER_INTEGRITY");
crate::ledger::check_integrity(db, "ROOT_LEDGER_INTEGRITY")?;
initialize_schema(db, binding)
}
fn initialize_schema(db: &Connection, binding: &Binding) -> Result<()> {
db.execute_batch("PRAGMA synchronous=FULL;
CREATE TABLE IF NOT EXISTS helper_sync_meta(id INTEGER PRIMARY KEY CHECK(id=1),journal_id TEXT NOT NULL,checkpoint INTEGER NOT NULL DEFAULT 0,generation INTEGER NOT NULL DEFAULT 0,binding_sha256 TEXT NOT NULL,last_decision TEXT,fault TEXT,agent_journal_id TEXT,agent_checkpoint INTEGER NOT NULL DEFAULT 0);
CREATE TABLE IF NOT EXISTS helper_sync_rows(grant_id TEXT PRIMARY KEY,revision INTEGER NOT NULL,fingerprint TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS helper_sync_captures(checkpoint INTEGER PRIMARY KEY,snapshot BLOB NOT NULL,fingerprint TEXT NOT NULL,captured_at TEXT NOT NULL);
CREATE TABLE IF NOT EXISTS helper_sync_decisions(decision_id TEXT PRIMARY KEY,checkpoint INTEGER NOT NULL,response BLOB NOT NULL,request BLOB NOT NULL,fingerprint TEXT NOT NULL);")?;
CREATE TABLE IF NOT EXISTS helper_sync_decisions(decision_id TEXT PRIMARY KEY,checkpoint INTEGER NOT NULL,response BLOB NOT NULL,request BLOB NOT NULL,fingerprint TEXT NOT NULL);
CREATE INDEX IF NOT EXISTS helper_sync_decisions_checkpoint ON helper_sync_decisions(checkpoint);")?;
let legacy_captures: bool = db.query_row(
"SELECT EXISTS(SELECT 1 FROM sqlite_schema WHERE type='table' AND name='helper_sync_captures')",
[], |row| row.get(0),
@@ -1175,23 +1201,23 @@ pub fn verify_checkpoint_repair_history_with(
) -> Result<()> {
let meta = metadata(db)?;
validate_history(db, binding, &meta, meta.generation, verifier)?;
let entry_count: u64 = db.query_row(
"SELECT count(*) FROM helper_sync_decisions",
[],
|row| row.get(0),
)?;
ensure!(entry_count <= 100000, "REPAIR_HISTORY_LIMIT");
let mut statement = db.prepare(
"SELECT response,request,checkpoint FROM helper_sync_decisions ORDER BY checkpoint",
)?;
let entries = statement
.query_map([], |r| {
Ok((
r.get::<_, Vec<u8>>(0)?,
r.get::<_, Vec<u8>>(1)?,
r.get::<_, u64>(2)?,
))
})?
.collect::<rusqlite::Result<Vec<_>>>()?;
ensure!(entries.len() <= 100000, "REPAIR_HISTORY_LIMIT");
let mut entries = statement.query([])?;
let mut previous = None;
let mut previous_checkpoint = 0;
let mut previous_agent_checkpoint = 0;
for (signed, raw, checkpoint) in entries {
while let Some(entry) = entries.next()? {
let signed: Vec<u8> = entry.get(0)?;
let raw: Vec<u8> = entry.get(1)?;
let checkpoint: u64 = entry.get(2)?;
let response: SignedResponse = serde_json::from_slice(&signed)?;
let parsed: ReconcileDecisionPayload = serde_json::from_slice(&response.decision_bytes)?;
let decision = verify(verifier, binding, &response, parsed.issued_at)?;
+72 -3
View File
@@ -7,7 +7,8 @@ use rmm_domain::{
jobs::hash,
reconciliation::{ReconciledOutcome, canonical_outcome_bytes},
};
use rusqlite::{OptionalExtension, TransactionBehavior, params};
use rusqlite::{Connection, OptionalExtension, TransactionBehavior, params};
use std::time::{Duration, Instant};
use uuid::Uuid;
/// Finite 1 GiB bound for durable agent/helper history. Unexpected page sizes
@@ -29,11 +30,48 @@ pub fn initialize_ledger(db: &rusqlite::Connection) -> Result<()> {
CREATE TABLE IF NOT EXISTS consumed(grant_id TEXT PRIMARY KEY, agent TEXT NOT NULL, generation INTEGER NOT NULL,
job TEXT NOT NULL, attempt TEXT NOT NULL, result BLOB, UNIQUE(agent,generation,job,attempt));
CREATE TABLE IF NOT EXISTS execution_evidence(grant_id TEXT PRIMARY KEY, start BLOB NOT NULL, outcome BLOB);")?;
let check: String = db.query_row("PRAGMA integrity_check", [], |r| r.get(0))?;
ensure!(check == "ok", "JOURNAL_INTEGRITY");
check_integrity(db, "JOURNAL_INTEGRITY")
}
pub fn check_integrity(db: &Connection, error_code: &'static str) -> Result<()> {
let check: String = db.query_row("PRAGMA integrity_check", [], |row| row.get(0))?;
ensure!(check == "ok", "{error_code}");
Ok(())
}
/// Full integrity scans for an owner holding one protected, long-lived SQLite
/// connection. External commits and schema changes require another scan even
/// when the interval has not elapsed. No cached result authorizes an effect.
#[derive(Default)]
pub(crate) struct IntegrityMonitor {
checked: Option<(u64, u64, Instant)>,
}
impl IntegrityMonitor {
pub(crate) fn check(
&mut self,
db: &Connection,
required: bool,
error_code: &'static str,
) -> Result<()> {
let data: u64 = db.query_row("PRAGMA data_version", [], |row| row.get(0))?;
let schema: u64 = db.query_row("PRAGMA schema_version", [], |row| row.get(0))?;
if !required
&& self.checked.is_some_and(|(previous_data, previous_schema, checked)| {
data == previous_data
&& schema == previous_schema
&& checked.elapsed() < Duration::from_secs(300)
})
{
return Ok(());
}
self.checked = None;
check_integrity(db, error_code)?;
self.checked = Some((data, schema, Instant::now()));
Ok(())
}
}
/// Before a human WebUI closure replaces the unresolved local outcome, keep the
/// exact original outcome bytes once. A differing second copy fails closed.
pub(crate) fn retain_closure_original(
@@ -379,3 +417,34 @@ pub fn start_witness_bytes(
"reauthentication_required":true,"postconditions_passed":false});
Ok(serde_json::to_vec(&evidence)?)
}
#[cfg(test)]
mod integrity_tests {
use super::*;
#[test]
fn idle_integrity_reuses_the_check_but_reaudits_external_changes_and_expiry() {
let path = std::env::temp_dir().join(format!("rmm-integrity-{}.sqlite", Uuid::new_v4()));
{
let db = Connection::open(&path).unwrap();
db.execute_batch("CREATE TABLE sample(id INTEGER PRIMARY KEY);").unwrap();
let mut monitor = IntegrityMonitor::default();
monitor.check(&db, false, "JOURNAL_INTEGRITY").unwrap();
let first = monitor.checked.unwrap();
db.execute("INSERT INTO sample VALUES (1)", []).unwrap();
monitor.check(&db, false, "JOURNAL_INTEGRITY").unwrap();
assert_eq!(monitor.checked, Some(first));
let peer = Connection::open(&path).unwrap();
peer.execute("INSERT INTO sample VALUES (2)", []).unwrap();
monitor.check(&db, false, "JOURNAL_INTEGRITY").unwrap();
let changed = monitor.checked.unwrap();
assert_ne!(changed.0, first.0);
monitor.checked = Some((changed.0, changed.1, changed.2 - Duration::from_secs(300)));
monitor.check(&db, false, "JOURNAL_INTEGRITY").unwrap();
assert!(monitor.checked.unwrap().2 >= changed.2);
}
std::fs::remove_file(path).unwrap();
}
}
+23 -3
View File
@@ -101,6 +101,7 @@ pub struct ClientSync<V = DefaultVerifier> {
verifier: V,
helper_identity: HelperIdentity,
pending: Option<PreparedSync>,
integrity: Option<crate::ledger::IntegrityMonitor>,
channel: Option<Channel>,
gate: Option<Gate>,
}
@@ -117,6 +118,7 @@ impl<V: Ed25519Verifier> ClientSync<V> {
verifier,
helper_identity: HelperIdentity::Root,
pending: None,
integrity: None,
channel: None,
gate: None,
}
@@ -127,6 +129,11 @@ impl<V: Ed25519Verifier> ClientSync<V> {
self.helper_identity = identity;
self
}
/// Use with one protected SQLite connection retained for this instance.
pub fn with_periodic_idle_integrity_checks(mut self) -> Self {
self.integrity = Some(crate::ledger::IntegrityMonitor::default());
self
}
/// Invoke on every authenticated/fenced ServerHello or transport loss.
pub fn close(&mut self) {
self.gate = None;
@@ -606,7 +613,17 @@ impl<V: Ed25519Verifier> ClientSync<V> {
channel.connection_generation > 0 && !channel.boot_id.is_nil(),
"UNAUTHENTICATED_CHANNEL"
);
initialize(db)?;
if let Some(integrity) = &mut self.integrity {
let work_pending: bool = db.query_row(
"SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state NOT IN ('succeeded','failed','cancelled','expired','closed_unknown'))",
[],
|row| row.get(0),
)?;
integrity.check(db, work_pending, "JOURNAL_INTEGRITY")?;
initialize_schema(db)?;
} else {
initialize(db)?;
}
let tx = db.transaction_with_behavior(TransactionBehavior::Immediate)?;
let meta = metadata(&tx)?;
ensure!(meta.fault.is_none(), "SYNC_MANUAL_RECOVERY_REQUIRED");
@@ -1147,8 +1164,11 @@ impl<V: Ed25519Verifier> ClientSync<V> {
}
pub fn initialize(db: &Connection) -> Result<()> {
let check: String = db.query_row("PRAGMA integrity_check", [], |r| r.get(0))?;
ensure!(check == "ok", "JOURNAL_INTEGRITY");
crate::ledger::check_integrity(db, "JOURNAL_INTEGRITY")?;
initialize_schema(db)
}
fn initialize_schema(db: &Connection) -> Result<()> {
db.execute_batch("PRAGMA synchronous=FULL;
CREATE TABLE IF NOT EXISTS reconcile_meta(id INTEGER PRIMARY KEY CHECK(id=1),journal_id TEXT NOT NULL,checkpoint INTEGER NOT NULL DEFAULT 0,high_sequence INTEGER NOT NULL DEFAULT 0,generation INTEGER NOT NULL DEFAULT 0,last_decision TEXT,pending_request TEXT,helper_id TEXT,helper_checkpoint INTEGER NOT NULL DEFAULT 0,fault TEXT);
CREATE TABLE IF NOT EXISTS reconcile_requests(id TEXT PRIMARY KEY,request BLOB NOT NULL,envelope BLOB NOT NULL,generation INTEGER NOT NULL,response BLOB);
@@ -466,6 +466,31 @@ struct Fixture {
identity: HelperIdentity,
}
#[test]
fn idle_anchor_checks_the_head_but_abandonment_rejects_damaged_history() {
let (mut f, sync, _, request, mut guard) = denial_case();
let mut sync = sync.with_periodic_idle_integrity_checks();
f.clock.now += Duration::seconds(1);
let capture = f.snapshot(&mut sync, 7);
let raw = f.request(&capture);
let ready = f.decision(&capture, &raw, 7, true);
assert!(f.apply(&mut sync, &ready, &raw).unwrap().ready);
guard.intent_recorded_at = f.clock.now;
f.db.execute(
"UPDATE helper_sync_decisions SET response=X'00' WHERE checkpoint < ?1",
[capture.checkpoint],
).unwrap();
let anchor = sync.no_start_anchor(&f.db, &guard, 7, &f.clock, &f.boot).unwrap();
guard.anchor_sha256 = hash(&serde_json::to_vec(&anchor).unwrap());
let before = denial_ledger_bytes(&f.db);
assert!(
sync.abandon_no_start(&mut f.db, &guard, &anchor, &request, &f.clock, &f.boot)
.is_err()
);
assert_eq!(denial_ledger_bytes(&f.db), before);
}
#[test]
fn checkpoint_repair_verifies_complete_signed_history_and_detects_removed_predecessor() {
let mut f = Fixture::new();
+23 -12
View File
@@ -903,9 +903,6 @@ impl SystemHelper {
RuntimeClock::enrolled_windows_update_helper(settings.binding.clone(), settings.helper.clone())
} else { RuntimeClock::new(rmm_time_attestation::Role::SystemHelper) }.for_generation(0);
let boot = WindowsBoot::capture()?;
let sync = HelperSync::with_verifier(settings.binding.clone(), DalekVerifier, &clock)
.ok()
.map(|s| s.with_helper_identity(HelperIdentity::System));
Ok(Self {
settings,
pin,
@@ -914,7 +911,8 @@ impl SystemHelper {
db,
clock,
boot,
sync,
// The initial connection creates the reconciler using its own qualified time.
sync: None,
last_diagnostic: None,
last_apply_diagnostic: None,
unsettled_msi: None,
@@ -1008,14 +1006,17 @@ impl SystemHelper {
}
fn sync(&mut self) -> Result<&mut HelperSync<DalekVerifier>> {
if self.sync.is_none() {
self.sync = Some(
HelperSync::with_verifier(
self.settings.binding.clone(),
DalekVerifier,
&self.clock,
)?
.with_helper_identity(HelperIdentity::System),
);
let sync = HelperSync::with_verifier(
self.settings.binding.clone(),
DalekVerifier,
&self.clock,
)?
.with_helper_identity(HelperIdentity::System);
self.sync = Some(if self.settings.managed_scripts() {
sync.with_periodic_idle_integrity_checks()
} else {
sync
});
}
self.sync.as_mut().context("SYSTEM_SYNC_CLOSED")
}
@@ -1290,6 +1291,16 @@ impl SystemHelper {
}
ensure!(self.settings.enable_effects, "SYSTEM_EFFECTS_DISABLED");
verified_window(&self.settings.binding, request, &self.clock)?;
if self.settings.managed_scripts() {
ledger::check_integrity(&self.db, "ROOT_LEDGER_INTEGRITY")?;
rmm_agent_core::helper_reconcile::verify_checkpoint_repair_history_with(
&self.db,
&self.settings.binding,
None,
HelperIdentity::System,
&DalekVerifier,
)?;
}
self.sync()?;
ensure!(
self.sync.as_ref().unwrap().can_start(
+31 -6
View File
@@ -1291,8 +1291,8 @@ impl Agent {
&& !self.helper_apply_unconfirmed
&& !self.prepared
&& self.running.is_none()
&& !self.journal.connection().query_row("SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state IN ('requesting','running','verifying'))",[],|r|r.get::<_,bool>(0))?
&& self.helper_probe_at.elapsed() >= Duration::from_secs(30)
&& !self.journal.connection().query_row("SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state IN ('requesting','running','verifying'))",[],|r|r.get::<_,bool>(0))?
{
let agent = self.identity.agent_id.clone();
let asset = self.identity.asset_id.clone();
@@ -2663,8 +2663,9 @@ impl Agent {
let mut heartbeat = Instant::now() - Duration::from_secs(60);
let mut previous_cpu = None;
let mut heartbeat_after = Duration::from_secs(30);
let mut tick = tokio::time::interval(Duration::from_millis(20));
tick.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
let active_tick = Duration::from_millis(20);
let idle_tick = Duration::from_millis(250);
let mut next_tick = tokio::time::Instant::now();
let mut readiness_at = Instant::now() - Duration::from_secs(5);
#[cfg(feature = "system-helper")]
let mut update_control_at = Instant::now() - Duration::from_secs(2);
@@ -2675,9 +2676,19 @@ impl Agent {
running.cancel.store(true, Ordering::SeqCst);
}
}
let control_pending = self.running.is_some()
|| self.prepared
|| self.deferred_sync.is_some()
|| self.deferred_permit.is_some()
|| self.helper_control_pending();
#[cfg(feature = "system-helper")]
let control_pending = control_pending || self.helper_probe.is_some();
let cadence = if control_pending { active_tick } else { idle_tick };
next_tick = next_tick.min(tokio::time::Instant::now() + cadence);
tokio::select! {
Some(completion)=self.completed_rx.recv()=>{self.completed(generation,completion)?;needs_sync=true;},
_=tick.tick()=>{
_=tokio::time::sleep_until(next_tick)=>{
next_tick = tokio::time::Instant::now() + cadence;
if !stop.load(Ordering::SeqCst) && self.poll_sync_apply(generation,true).is_err(){self.close_gate();needs_sync=true;}
#[cfg(feature = "system-helper")]
if !stop.load(Ordering::SeqCst) && self.poll_helper(&channel,generation).await.is_err() {self.close_gate();needs_sync=self.sync.is_some();}
@@ -2709,7 +2720,9 @@ impl Agent {
if self.sync.is_some() && !self.prepared && !self.helper_control_busy_for_sync() && rmm_agent_windows::job_readiness::refresh_due(needs_sync,sync_at.elapsed(),self.sync.as_ref().and_then(|s|s.validity_deadline()),self.clock.reading().ok().map(|r|r.upper)) {
if self.start_sync(&channel,generation).await.is_err(){self.close_gate();needs_sync=true;}else{needs_sync=false;}sync_at=Instant::now();
}
if Instant::now() >= permit_after && !needs_sync && !self.prepared && self.ready(generation) && jobs::events(self.journal.connection())?.is_empty() && self.journal.count()?==0 {
if Instant::now() >= permit_after && !needs_sync && !self.prepared && self.config.enable_jobs
&& self.journal.connection().prepare_cached("SELECT EXISTS(SELECT 1 FROM job_attempts WHERE state='accepted' AND cancel_requested=0)")?.query_row([], |row| row.get::<_, bool>(0))?
&& self.ready(generation) && jobs::events(self.journal.connection())?.is_empty() && self.journal.count()?==0 {
// A transiently stale clock skips this tick; it must not end the session.
if let Ok(now)=self.clock.now() && let Some(offer)=jobs::next_at(self.journal.connection(),now)? {
let job=self.binding.as_ref().context("JOB_BINDING_REQUIRED")?.job(&offer.payload_bytes)?;
@@ -3078,7 +3091,19 @@ async fn run_service_binding(path: &Path, stop: &'static AtomicBool, release_gua
ensure!(rmm_agent_windows::echo_probe::protected_scope()? == *scope, "WINDOWS_ECHO_CONFIGURATION_CHANGED");
}
}
let sync=if config.enable_jobs && (!config.windows_echo_probe_only || config.echo_scope.is_some()) {binding.clone().map(|binding|reconcile::ClientSync::new(binding).with_helper_identity(reconcile::HelperIdentity::System))} else {None};
let sync = if config.enable_jobs && (!config.windows_echo_probe_only || config.echo_scope.is_some()) {
binding.clone().map(|binding| {
let sync = reconcile::ClientSync::new(binding)
.with_helper_identity(reconcile::HelperIdentity::System);
if config.localservice_time_policy.is_some() {
sync.with_periodic_idle_integrity_checks()
} else {
sync
}
})
} else {
None
};
let (completed_tx,completed_rx)=tokio::sync::mpsc::channel(1);
let mut agent = Agent {
config,
+1 -65
View File
@@ -3,7 +3,7 @@ use axum::{
Json, Router,
extract::{Path, Query, State},
http::{HeaderMap, StatusCode},
routing::{delete, patch, post},
routing::{delete, post},
};
use serde::Deserialize;
use serde_json::{Value, json};
@@ -34,10 +34,6 @@ pub fn routes(r: Router<crate::State>) -> Router<crate::State> {
"/api/v1/tenants/{tenant}/devices/{asset}/archive",
post(archive_device),
)
.route(
"/api/v1/tenants/{tenant}/devices/{asset}/purpose",
patch(update_device_purpose),
)
.route(
"/api/v1/tenants/{tenant}/operation-plans/{plan}/revocation",
post(revoke_plan),
@@ -136,66 +132,6 @@ async fn archive_device(
tx.commit().await?;
Ok(Json(json!({"asset_id":asset, "archived":input.archived})))
}
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Purpose {
purpose: String,
}
fn normalize_purpose(raw: &str) -> Result<Option<String>, Error> {
let normalized = raw.replace("\r\n", "\n");
let text = normalized.trim();
if text.chars().count() > 500
|| normalized
.chars()
.any(|c| c.is_control() && !matches!(c, '\n' | '\t'))
{
return Err(Error(StatusCode::BAD_REQUEST, "VALIDATION_ERROR"));
}
Ok((!text.is_empty()).then(|| text.to_owned()))
}
async fn update_device_purpose(
State(s): State<crate::State>,
h: HeaderMap,
Path((tenant, asset)): Path<(Uuid, Uuid)>,
Json(input): Json<Purpose>,
) -> Result<Json<Value>, Error> {
const EVENT: &str = "device_purpose_updated";
let (p, mut tx) = context(&s, &h, tenant, "devices:revoke", EVENT).await?;
crate::permissions::require_principal(&mut tx, &p, "inventory:read").await?;
let purpose = normalize_purpose(&input.purpose)?;
let current: Option<String> = sqlx::query_scalar(
"SELECT purpose FROM assets WHERE tenant_id=$1 AND asset_id=$2
AND EXISTS (SELECT 1 FROM agent_installations a WHERE a.tenant_id=$1 AND a.asset_id=$2
AND NOT a.customer_transfer_pending)
FOR UPDATE",
)
.bind(tenant)
.bind(asset)
.fetch_optional(&mut *tx)
.await?
.ok_or(Error(StatusCode::NOT_FOUND, "NOT_FOUND"))?;
if current != purpose {
sqlx::query("UPDATE assets SET purpose=$3 WHERE tenant_id=$1 AND asset_id=$2")
.bind(tenant)
.bind(asset)
.bind(&purpose)
.execute(&mut *tx)
.await?;
audit(
&mut tx,
&p,
EVENT,
json!({"asset_id":asset,"cleared":purpose.is_none()}),
)
.await?;
}
tx.commit().await?;
Ok(Json(json!({"asset_id":asset,"purpose":purpose})))
}
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
struct Pairing {
+1 -1
View File
@@ -3,7 +3,7 @@ WITH classified AS (
a.last_authenticated_at,a.last_authenticated_certificate_sha256,a.certificate_sha256,
a.enrollment_generation,a.assignment_version,a.capabilities,a.reported_agent_version,
a.system_usage,a.system_usage_observed_at,
asset.archived_at,asset.hypervisor_asset_id,asset.purpose,t.name AS customer_name,
asset.archived_at,asset.hypervisor_asset_id,t.name AS customer_name,
CASE
WHEN a.revoked_at IS NOT NULL THEN 'revoked'
WHEN asset.archived_at IS NOT NULL THEN 'archived'
+1 -2
View File
@@ -533,8 +533,7 @@ fn project(row: &PgRow, now: DateTime<Utc>, full: bool, hosts: &HashMap<Uuid, Ho
"agent_id":row.get::<Uuid,_>("agent_id"),"asset_id":row.get::<Uuid,_>("asset_id"),
"status":row.get::<String,_>("status"),"lifecycle":row.get::<String,_>("lifecycle"),
"archived_at":row.get::<Option<DateTime<Utc>>,_>("archived_at"),"revoked_at":revoked,
"hostname":data["hostname"].as_str(),"purpose":row.get::<Option<String>,_>("purpose"),
"device_type":device_type,"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(),
"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()),
-29
View File
@@ -492,8 +492,6 @@ mod tests {
"rollout":{"max_parallel":1,"halt_after_failures":1},"reason":"test customer authorization"});
for request in [
client.get(format!("{base}/{b}/devices/{asset}")),
client.patch(format!("{base}/{b}/devices/{asset}/purpose"))
.json(&json!({"purpose":"foreign write"})),
client.delete(format!("{base}/{b}/devices/{asset}?agent_id={id}")),
client
.post(format!("{base}/{b}/operation-plans"))
@@ -532,14 +530,6 @@ mod tests {
.send().await.unwrap().json::<Value>().await.unwrap();
let deletion = || client.delete(&pair).header("origin", origin).header("cookie", cookie);
let csrf = session["csrf_token"].as_str().unwrap();
let detail = format!("{base}/{a}/devices/{asset}");
let purpose = format!("{detail}/purpose");
let update = |text: &str| client.patch(&purpose).header("origin", origin)
.header("cookie", cookie).json(&json!({"purpose":text}));
assert_eq!(client.patch(&purpose).bearer_auth(&token).json(&json!({"purpose":"token write"}))
.send().await.unwrap().status(), StatusCode::FORBIDDEN);
assert_eq!(update("reader denied").header("x-csrf-token", csrf)
.send().await.unwrap().status(), StatusCode::FORBIDDEN);
assert_eq!(deletion().header("x-csrf-token", csrf).send().await.unwrap().status(), StatusCode::FORBIDDEN);
sqlx::query("UPDATE memberships SET permissions=array_append(permissions,'devices:revoke') WHERE tenant_id=$1 AND principal=$2")
.bind(a).bind(&issuer).execute(&admin).await.unwrap();
@@ -547,25 +537,6 @@ mod tests {
.bind(a).bind(asset).execute(&admin).await.unwrap();
sqlx::query("INSERT INTO agent_installations(tenant_id,agent_id,asset_id,certificate_sha256) VALUES($1,$2,$3,$4)")
.bind(a).bind(id).bind(asset).bind(hash(id.as_bytes())).execute(&admin).await.unwrap();
assert_eq!(update("missing CSRF").send().await.unwrap().status(), StatusCode::FORBIDDEN);
assert_eq!(update(&"ü".repeat(501)).header("x-csrf-token", csrf)
.send().await.unwrap().status(), StatusCode::BAD_REQUEST);
let text = "Dateiserver für Nürnberg\nNur Entwicklung";
let saved: Value = update(" Dateiserver für Nürnberg\r\nNur Entwicklung ")
.header("x-csrf-token", csrf).send().await.unwrap().error_for_status().unwrap().json().await.unwrap();
assert_eq!(saved["purpose"], text);
let device: Value = client.get(&detail).bearer_auth(&token)
.send().await.unwrap().error_for_status().unwrap().json().await.unwrap();
assert_eq!(device["purpose"], text);
let other: Option<String> = sqlx::query_scalar("SELECT purpose FROM assets WHERE tenant_id=$1 AND asset_id=$2")
.bind(b).bind(asset).fetch_one(&admin).await.unwrap();
assert!(other.is_none());
let cleared: Value = update(" \n ").header("x-csrf-token", csrf)
.send().await.unwrap().error_for_status().unwrap().json().await.unwrap();
assert_eq!(cleared["purpose"], Value::Null);
let events: Vec<Value> = sqlx::query_scalar("SELECT data->'decision' FROM audit_events WHERE tenant_id=$1 AND event_type='device_purpose_updated' ORDER BY created_at")
.bind(a).fetch_all(&admin).await.unwrap();
assert_eq!(events, [json!({"asset_id":asset,"cleared":false}), json!({"asset_id":asset,"cleared":true})]);
assert_eq!(deletion().send().await.unwrap().status(), StatusCode::FORBIDDEN);
assert_eq!(deletion().header("x-csrf-token",csrf).send().await.unwrap().status(), StatusCode::CONFLICT);
let revoked = client.post(format!("{base}/{a}/devices/{asset}/revocation?agent_id={id}"))
@@ -0,0 +1,201 @@
{
"native_method": "Three windows with process CPU and logical I/O counters from Win32_Process, plus existing readiness observations. Percentages use both Windows logical processors. I/O counts include cached reads. The data shows the combined effect of each release.",
"source_findings": {
"baseline_revision": "9e957e6d8d4254a01fe215b32ecd6bc8c31b6947",
"agent": "20 ms timer did journal queries and qualified clock reads even with no accepted attempt. Every sync prepared with a complete SQLite integrity scan.",
"helper": "Every snapshot ran a complete SQLite integrity scan. Every ready response rebuilt a denial anchor and revalidated the entire historical decision chain. ORDER BY checkpoint had no supporting index for that replay.",
"idle_runtime_tick_ms": 250,
"active_runtime_tick_ms": 20,
"idle_integrity_audit_interval_seconds": 300,
"full_audits_before_new_system_effect": true,
"full_lineage_audit_before_no_start_record": true
},
"local_sqlite_query_plan": {
"baseline": [
"SCAN helper_sync_decisions",
"USE TEMP B-TREE FOR ORDER BY"
],
"with_checkpoint_index": [
"SCAN helper_sync_decisions USING INDEX helper_sync_decisions_checkpoint"
]
},
"measurements": [
{
"start": "2026-11-19T09:05:49.2782989Z",
"end": "2026-11-19T09:07:20.7135402Z",
"version": "0.1.22",
"cpu_count": 2,
"duration_seconds": 91.127271,
"journal_bytes": 452415488,
"ledger_bytes": 335908864,
"processes": {
"rmm-updater-windows.exe": {
"pid": 2384,
"cpu_seconds": 0.03125,
"cpu_percent": 0.0171,
"read_mib_s": 0.0003,
"write_mib_s": 0.0
},
"rmm-helper-windows.exe": {
"pid": 4700,
"cpu_seconds": 21.546875,
"cpu_percent": 11.8224,
"read_mib_s": 102.0242,
"write_mib_s": 34.4732
},
"rmm-agent-windows.exe": {
"pid": 1908,
"cpu_seconds": 5.75,
"cpu_percent": 3.1549,
"read_mib_s": 38.1056,
"write_mib_s": 0.0482
}
},
"idle_job_authorizations": 0,
"readiness_samples": 19,
"signed_decisions_observed": 6,
"ready_samples": 14
},
{
"start": "2026-11-19T09:13:22.8803140Z",
"end": "2026-11-19T09:14:54.0077643Z",
"version": "0.1.23",
"cpu_count": 2,
"duration_seconds": 90.93767,
"journal_bytes": 455192576,
"ledger_bytes": 337829888,
"processes": {
"rmm-updater-windows.exe": {
"pid": 2384,
"cpu_seconds": 0.015625,
"cpu_percent": 0.0086,
"read_mib_s": 0.0,
"write_mib_s": 0.0
},
"rmm-helper-windows.exe": {
"pid": 8036,
"cpu_seconds": 10.015625,
"cpu_percent": 5.5069,
"read_mib_s": 63.7249,
"write_mib_s": 13.9068
},
"rmm-agent-windows.exe": {
"pid": 832,
"cpu_seconds": 2.640625,
"cpu_percent": 1.4519,
"read_mib_s": 26.3846,
"write_mib_s": 0.0204
}
},
"idle_job_authorizations": 0,
"readiness_samples": 18,
"signed_decisions_observed": 3,
"ready_samples": 10
},
{
"start": "2026-11-19T09:18:45.8146916Z",
"end": "2026-11-19T09:20:16.8017398Z",
"version": "0.1.24",
"cpu_count": 2,
"duration_seconds": 90.814144,
"journal_bytes": 456974336,
"ledger_bytes": 339193856,
"processes": {
"rmm-updater-windows.exe": {
"pid": 2384,
"cpu_seconds": 0.0,
"cpu_percent": 0.0,
"read_mib_s": 0.0,
"write_mib_s": 0.0
},
"rmm-helper-windows.exe": {
"pid": 4168,
"cpu_seconds": 1.53125,
"cpu_percent": 0.8431,
"read_mib_s": 16.1736,
"write_mib_s": 0.0126
},
"rmm-agent-windows.exe": {
"pid": 404,
"cpu_seconds": 1.28125,
"cpu_percent": 0.7054,
"read_mib_s": 12.3686,
"write_mib_s": 0.0294
}
},
"idle_job_authorizations": 0,
"readiness_samples": 19,
"signed_decisions_observed": 4,
"ready_samples": 18
}
],
"candidate_0_1_23_revision": "478ee1fc1a8141845427011e566f5225eeebadd0",
"final_build_revision": "f01e81418e7b36a86bfb686542bd2f5380ecfe82",
"release": {
"release_id": "2032b236-4ab7-4dad-8e74-1144c5a5d165",
"version": "0.1.24",
"platform": "x86_64-pc-windows-gnu",
"manifest_sha256": "311e5df4979904907e54d5d1e08205decaf78fa3e3c6e34a68215f4873c2782d"
},
"activation": {
"method": "Signed automatic Windows GNU release pull in Development A",
"sequence": 25,
"agent_id": "239ffa87-642f-40cd-9cbf-d48557dc0193",
"asset_id": "fab8b229-4eea-4af8-9362-a3aea4a8f709",
"services": [
{
"name": "RmmDiscoveryReleasePull",
"pid": 2384,
"state": "Running",
"sha256": "575ceb6a0b76c835d28646a498dfa73e88fb5de6343b77bf11d5eefea3fc68b1"
},
{
"name": "RmmDiscoverySystemHelper",
"pid": 4168,
"state": "Running",
"sha256": "bcff281db15549381f1fbe530af74ad4b44cefaa94a7c1c30e1f5a6a673ea556"
},
{
"name": "RmmDiscoveryWindows",
"pid": 404,
"state": "Running",
"sha256": "3c4727fd08ffecf3147221826087f125c6d835201b182b8ad1a4280c98ea0954"
}
],
"observed_at_utc": "2026-11-19T09:18:43.8141692Z",
"fresh_gateway_contact": "2026-11-19T09:18:40.275768+00:00"
},
"system_test": {
"operation_id": "e6d139c0-7f29-478d-87e8-38f466d8634f",
"job_id": "512f9311-4ace-4b64-9c60-24bb40719312",
"attempt_id": "d6e4a74a-4a56-4d95-b640-db4267c437eb",
"plan_hash": "7aeffea215d916810af3b7748fb3fb7bc715e5d9470d85e7f669bd20526ff2e7",
"stdout": "Windows-Konto S-1-5-18",
"exit_code": 0,
"state": "succeeded",
"observed_at": "2026-11-19T09:20:39.711Z",
"script_sha256": "8a0c76004a480aa11f6c768b2984e2cf2c01431009ccdbfb1607825133fcbc4f",
"approval": {
"principal": "simulated-testprincipal-a",
"approval_origin": "dev_test_browser_simulation",
"testsimulation": true,
"plan_hash": "7aeffea215d916810af3b7748fb3fb7bc715e5d9470d85e7f669bd20526ff2e7"
},
"preapproval": {
"jobs": 0,
"outbox": 0,
"grants": 0
},
"grants": 1
},
"final_health": {
"auth_contact": "2026-11-19T09:20:39.525258+00:00",
"contact": "2026-11-19T09:20:26.027274+00:00",
"generation": 80,
"active_jobs": 0,
"helper_ready": true,
"ready": true,
"system_run_script": true
},
"targeted_core_tests_passed": 70
}
+1 -5
View File
@@ -11,10 +11,6 @@
| Windows | `discwindowstest`, Windows 11 Pro x64, Agent `0.1.16` aus dem offiziellen GNU-Kanal |
| Quellstand mit Dokumentation | Gitea-Branch `main` |
## Ergänzungen zur Geräteansicht
- **Zweck je Gerät:** Optionale Spalte im Bestand und in der Historie, Freitextpflege im Gerätedetail. WebUI-Build, 80 Komponententests, fünf Browserprüfungen und HTTP-Rundlauf auf isoliertem PostgreSQL mit Schreib-, Lese- und Fremdkundenfällen bestanden. Am 19. November 2026 um 14:10 UTC wurde `2070ae9` mit [Migration 45](../migrations/0045_device_purpose.sql) aktiviert. API, öffentliche API und Gateway bestanden die TLS-Healthchecks; der öffentliche WebUI-Index entsprach dem Build. Angemeldetes Chromium zeigte die Zweck-Spalte für sechs Geräte, den Editor im Gerätedetail und die Spalte bei 390 px Breite. Bei der Live-Sichtprüfung wurde nichts gespeichert; kein Agentwechsel. [Bedienung](public-access.md#zweck-eines-geräts-pflegen) · [Browserregression](../tests/browser/device-purpose.spec.ts)
## Geräteaktionen über MCP
Alle acht Versuche lieferten Exitcode 0. Bei beiden Neustarts wurde die Wiederanmeldung derselben Kopplung nach einem tatsächlichen Bootwechsel geprüft. Der Ping wurde jeweils erst nach dieser Wiederanmeldung eingereicht. Die Zeiten in der Tabelle sind UTC.
@@ -39,7 +35,7 @@ Alle acht Versuche lieferten Exitcode 0. Bei beiden Neustarts wurde die Wiederan
| 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) |
| 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) |
| Windows im Leerlauf | Windows GNU `0.1.20` aus `a4bcebf` aktualisiert den signierten Zeitbeleg des Helpers nach erfolgreicher Abfrage im Abstand von fünf Sekunden. Der Testgast übernahm das Paket mit derselben Geräteidentität. Im Leerlauf sank die CPU-Last des Agenten von 15,20 % auf 2,30 % und die des Helpers von 15,67 % auf 2,72 %. Der in der internen Entwicklungs-WebUI genehmigte PowerShell-Testauftrag meldete `S-1-5-18` mit Exitcode 0 und einem Startgrant. Beide Dienste blieben synchron. [Leerlaufmessung und SYSTEM-Test](evidence/windows-idle-cpu-20261118.json) |
| Windows im Leerlauf | Windows GNU `0.1.20` aus `a4bcebf` aktualisiert den signierten Zeitbeleg des Helpers nach erfolgreicher Abfrage im Abstand von fünf Sekunden. Der Testgast übernahm das Paket mit derselben Geräteidentität. Im Leerlauf sank die CPU-Last des Agenten von 15,20 % auf 2,30 % und die des Helpers von 15,67 % auf 2,72 %. Der in der internen Entwicklungs-WebUI genehmigte PowerShell-Testauftrag meldete `S-1-5-18` mit Exitcode 0 und einem Startgrant. Beide Dienste blieben synchron. [Leerlaufmessung und SYSTEM-Test](evidence/windows-idle-cpu-20261118.json) Am 19.11. senkte `0.1.24` im jeweils 91 Sekunden langen Leerlauftest die Gast-CPU-Last von 3,15 % auf 0,71 % beim Agenten und von 11,82 % auf 0,84 % beim Helper. Die Lastspitzen fielen mit wiederholten Vollprüfungen großer SQLite-Dateien und der kompletten signierten Helperhistorie zusammen. Der Agent prüft im Leerlauf alle 250 ms auf Arbeit. Vollprüfungen bleiben für anstehende SYSTEM-Aufträge und den Nachweis unterbliebener Ausführung erhalten. Der Testgast übernahm das signierte Paket mit denselben Geräte- und Agentenkennungen. Der erneut in der Entwicklungs-WebUI genehmigte SYSTEM-Test meldete `S-1-5-18` mit Exitcode 0 und einem Startgrant. [Folgemessung und Abnahme](evidence/windows-idle-cpu-followup-20261119.json) |
| Wiederanlauf | Nach einem Gatewaywechsel wurde der Windows-Agent ohne manuellen Dienstneustart wieder bereit. Der Helper glich seine bereits quittierte Ergebnismeldung ab. [Gatewaywechsel](evidence/windows-gateway-clock-recovery-20261117.json) · [Helper-Abgleich](evidence/windows-helper-result-recovery-20261118.json) |
| WebUI-Abschluss eines ungeklärten Versuchs | Auf OTRS ARM64 war derselbe Versuch zentral als `closed_unknown` abgeschlossen und lokal wegen unterschiedlicher Befunde noch blockiert. Der Agent hatte eine archivierte Unterbrechungsmeldung, beide Verbrauchsjournale hatten den ursprünglichen Start und kein Ergebnis. 71 Tests zu `915e126` prüfen den signierten Abschluss in Agent und Helper, den Erhalt der Originale und den Wiederanlauf nach unterbrochenen Journalaktualisierungen. Am 18. November um 18:05 UTC startete das bestehende Gerät einmal kontrolliert unter exklusiver Startsperre mit dem über mTLS abgerufenen signierten Paar `0.1.0-arm64.3`. Beide Verbrauchsjournale übernahmen den bereits vorhandenen WebUI-Abschluss. Die archivierte Originalmeldung, die Startbelege und die Geräteidentität waren unverändert nachweisbar. Der native Updater meldete `idle`, Agent und Helper waren nach dem Abgleich bereit und der reguläre Updatetimer war aktiv. Linux x64 übernahm `0.1.0-mvp.9` über den regulären Timer. [Geräteabgleich](../crates/agent-core/tests/reconcile.rs) |
-4
View File
@@ -8,10 +8,6 @@ Die öffentliche WebUI verwendet ein lokales Benutzerkonto mit Passwort und eine
Berechtigte Benutzer können Kunden anlegen und umbenennen. Zur Aufnahme den Zielkunden wählen und unter **Verwaltung → Geräteaufnahme** einen Einmalcode erzeugen. Der Code gilt für diesen Kunden und verfällt bei erfolgreicher Aufnahme oder nach 15 Minuten. Die WebUI zeigt für die veröffentlichten Plattformen Download und Installationsbefehl. Auf dem neuen Gerät das HTTPS-Skript mit Administratorrechten aufrufen und den Code am Prompt eingeben. Für lokale Administrator-Skripte die dafür angebotene Installationsoption wählen. Der Windows-Kanal ist `x86_64-pc-windows-gnu`. [Linux-Installer](https://discovery.ease-technologies.de:8443/install/linux.sh) · [Windows-Installer](https://discovery.ease-technologies.de:8443/install/windows.ps1)
### Zweck eines Geräts pflegen
Unter **Geräte** den Hostnamen öffnen und im Abschnitt **Zweck** auf **Zweck bearbeiten** klicken. Der Freitext darf bis zu 500 Zeichen enthalten. Speichern übernimmt ihn auch in die Übersicht. Zum Entfernen das Feld leeren und erneut speichern. Das Bearbeiten erfordert `inventory:read` und `devices:revoke` im betreffenden Kunden.
### Hypervisor einer VM zuordnen
Eine VM unter **Geräte** öffnen und unter **Gerät verwalten → Hypervisor zuordnen** einen Host aus demselben Kundenbestand auswählen. Die Zuordnung speichern. Der Hostname erscheint unter dem VM-Namen in der Übersicht und öffnet die Details des Hypervisors. **Kein konkreter Hypervisor** entfernt die gespeicherte Zuordnung.
-3
View File
@@ -1,3 +0,0 @@
-- Operator metadata belongs to the asset, not the installation or its inventory.
ALTER TABLE assets ADD COLUMN purpose text CHECK (char_length(purpose) BETWEEN 1 AND 500);
GRANT UPDATE(purpose) ON assets TO rmm_app;
+2 -2
View File
@@ -108,8 +108,8 @@ test('creates and renames a customer, opens its inventory, and hides editing for
const headers = page.locator('.fleet-table thead th[scope="col"]');
await expect(headers.nth(0)).toHaveText('Hostname');
await expect(headers.nth(1)).toHaveText('Type');
await expect(device.locator('[data-label="Type"]')).toHaveText('hypervisor');
await expect(device.locator('[data-label="OS"]')).toHaveText('Proxmox VE');
await expect(device.getByRole('cell').nth(2)).toHaveText('hypervisor');
await expect(device.getByRole('cell').nth(3)).toHaveText('Proxmox VE');
const memory = device.locator('[data-label="RAM frei / gesamt"]');
await expect(memory).toHaveText('6 / 16 GiB');
await expect(memory.locator('.capacity-track')).toHaveAttribute('title', '37,5 % frei');
-98
View File
@@ -1,98 +0,0 @@
import { test, expect } from '../../web/node_modules/@playwright/test/index.js';
import { createServer, type ViteDevServer } from '../../web/node_modules/vite/dist/node/index.js';
import { resolve } from 'node:path';
let server: ViteDevServer;
let origin: string;
test.beforeAll(async () => {
server = await createServer({
root: resolve(__dirname, '../../web'), configFile: false,
server: { host: '127.0.0.1', port: 0 }, logLevel: 'silent'
});
await server.listen();
const address = server.httpServer!.address();
if (!address || typeof address === 'string') throw new Error('Missing local fixture address');
origin = `http://127.0.0.1:${address.port}`;
});
test.afterAll(async () => { await server?.close(); });
test('shows, edits and clears device purpose without giving readers an editor', async ({ page }) => {
const customer = { tenant_id: '11111111-1111-4111-8111-111111111111', name: 'Fixture' };
const path = `/api/v1/tenants/${customer.tenant_id}/devices/device-1`;
const listing = (items: unknown[]) => ({
items, next_cursor: null, truncated: false, completeness: 'complete', as_of: '2026-11-19T12:00:00Z'
});
let purpose: string | null = null;
let writer = true;
let reject = true;
const writes: string[] = [];
const device = () => ({
tenant_id: customer.tenant_id, customer_name: customer.name, asset_id: 'device-1', agent_id: 'agent-1',
lifecycle: 'current', status: 'online', hostname: 'DATEN-SRV', os: 'Linux', purpose
});
await page.route(`${origin}/auth/config`, route => route.fulfill({
json: { local_login_enabled: true, oidc_configured: false, oidc_login_url: null, dev_login_enabled: false }
}));
await page.route(`${origin}/auth/session`, route => route.fulfill({
json: {
principal: writer ? 'device-operator' : 'inventory-reader', testsimulation: false,
tenant_id: customer.tenant_id, csrf_token: 'purpose-csrf',
permissions: writer ? ['inventory:read', 'devices:revoke'] : ['inventory:read']
}
}));
await page.route(`${origin}/api/v1/**`, route => {
const request = route.request();
const pathname = new URL(request.url()).pathname;
if (request.method() === 'GET') {
if (pathname === '/api/v1/tenants') return route.fulfill({ json: listing([customer]) });
if (pathname === '/api/v1/devices') return route.fulfill({ json: listing([device()]) });
if (pathname === path) return route.fulfill({ json: device() });
}
if (request.method() === 'PATCH' && pathname === `${path}/purpose`) {
expect(writer).toBe(true);
expect(request.headers()['x-csrf-token']).toBe('purpose-csrf');
expect(request.headers()['x-rmm-tenant']).toBe(customer.tenant_id);
const text = request.postDataJSON().purpose;
writes.push(text);
if (reject) return route.fulfill({ status: 403, json: { code: 'FORBIDDEN', message: 'Speichern abgelehnt' } });
purpose = text.trim() || null;
return route.fulfill({ json: { asset_id: 'device-1', purpose } });
}
return route.fulfill({ status: 404, json: { code: 'UNEXPECTED_FIXTURE_REQUEST', message: pathname } });
});
await page.goto(`${origin}/#geraete`);
await expect(page.getByRole('columnheader', { name: 'Zweck' })).toBeVisible();
await expect(page.getByRole('cell', { name: 'Nicht hinterlegt' })).toBeVisible();
await page.getByRole('button', { name: 'DATEN-SRV' }).click();
await page.getByRole('button', { name: 'Zweck bearbeiten' }).click();
const editor = page.getByRole('textbox', { name: 'Zweck des Geräts' });
const save = page.getByRole('button', { name: 'Zweck speichern' });
await editor.fill('ü'.repeat(501));
await expect(save).toBeDisabled();
expect(writes).toEqual([]);
const text = 'Dateien für Nürnberg\n<intern>';
await editor.fill(text);
await save.click();
await expect(page.getByRole('alert')).toContainText('Speichern abgelehnt');
await expect(editor).toHaveValue(text);
reject = false;
await save.click();
await expect(page.getByText('Zweck gespeichert.')).toBeVisible();
await page.getByRole('button', { name: 'Zur Geräteliste' }).click();
await expect(page.locator('td[data-label="Zweck"]')).toHaveText(text.replace('\n', ' '));
await page.setViewportSize({ width: 390, height: 844 });
await expect(page.locator('td[data-label="Zweck"]')).toBeVisible();
await page.getByRole('button', { name: 'DATEN-SRV' }).click();
await page.getByRole('button', { name: 'Zweck bearbeiten' }).click();
await expect(editor).toHaveValue(text);
await editor.fill('');
await save.click();
await expect(page.getByText('Nicht hinterlegt', { exact: true })).toBeVisible();
expect(writes).toEqual([text, text, '']);
writer = false;
purpose = text;
await page.reload();
await expect(page.locator('.device-purpose .purpose-text')).toHaveText(text.replace('\n', ' '));
await expect(page.getByRole('button', { name: 'Zweck bearbeiten' })).toHaveCount(0);
});
+3 -77
View File
@@ -29,7 +29,6 @@ import { SyncAlignmentReview } from './sync-alignment-review';
import { SystemNonstartReview } from './system-nonstart-review';
const unknown = 'Nicht gemeldet';
const noPurpose = 'Nicht hinterlegt';
const number = new Intl.NumberFormat('de-DE', { maximumFractionDigits: 1 });
const date = new Intl.DateTimeFormat('de-DE', { dateStyle: 'medium', timeStyle: 'short' });
function label(value: unknown) {
@@ -128,64 +127,6 @@ function devicePath(customer: string, asset: string) {
return tenantPath(customer, '/devices/' + encodeURIComponent(asset));
}
function DevicePurpose({ value, path, customer, editor, success, onSaved }: {
value: string;
path: string;
customer: string;
editor: Session | null;
success: boolean;
onSaved: () => void;
}) {
const [draft, setDraft] = useState<string | null>(null);
const [busy, setBusy] = useState(false);
const [error, setError] = useState<string | null>(null);
const tooLong = Array.from(draft?.trim() ?? '').length > 500;
const close = () => { setDraft(null); setError(null); };
return (
<section className="device-purpose">
<h2>Zweck</h2>
{editor && draft !== null ? (
<form onSubmit={async (e) => {
e.preventDefault();
if (busy || tooLong) return;
setBusy(true);
setError(null);
try {
await request(path + '/purpose', {
method: 'PATCH', tenantId: customer, csrf: editor.csrf_token, body: { purpose: draft }
});
close();
onSaved();
} catch (e) {
setError(errorText(e));
} finally {
setBusy(false);
}
}}>
<label>
Zweck des Geräts
<textarea autoFocus rows={3} value={draft} disabled={busy}
aria-describedby="device-purpose-help" aria-invalid={tooLong}
onChange={(e) => setDraft(e.target.value)} />
</label>
<p id="device-purpose-help" className={tooLong ? 'error' : 'muted'}>
{tooLong ? 'Der Zweck ist zu lang. ' : ''}Maximal 500 Zeichen. Zum Entfernen das Feld leeren.
</p>
<ErrorBox error={error} />
<button type="submit" disabled={busy || tooLong}>{busy ? 'Speichert …' : 'Zweck speichern'}</button>{' '}
<button type="button" className="quiet" disabled={busy} onClick={close}>Abbrechen</button>
</form>
) : (
<>
<p className={'purpose-text' + (value ? '' : ' muted')}>{value || noPurpose}</p>
{editor && <button className="quiet" onClick={() => setDraft(value)}>Zweck bearbeiten</button>}
{success && <p role="status">Zweck gespeichert.</p>}
</>
)}
</section>
);
}
function reportedScriptProfiles(device: RecordValue) {
const os = devicePlatform(device);
if (!os || !Array.isArray(device.capabilities)) return 'Nicht gemeldet';
@@ -235,7 +176,6 @@ function DeviceDetail({
[error, setError] = useState<string | null>(null);
const [confirmDelete, setConfirmDelete] = useState(false);
const [managing, setManaging] = useState(false);
const [purposeSaved, setPurposeSaved] = useState(false);
const d = detail.data;
const scoped = membership.data;
const volumes = Array.isArray(d?.volumes) ? d.volumes.map((v) => record(v)) : [];
@@ -281,14 +221,6 @@ function DeviceDetail({
))}
</dl>
</section>
<DevicePurpose
value={typeof d.purpose === 'string' ? d.purpose : ''}
path={path}
customer={customer}
editor={scoped && allowed(scoped, 'devices:revoke') && allowed(scoped, 'inventory:read') ? scoped : null}
success={purposeSaved}
onSaved={() => { setPurposeSaved(true); detail.reload(); }}
/>
<DeviceInventoryPanels device={d} />
{volumes.length > 0 && (
<section>
@@ -625,9 +557,9 @@ export function Devices({
<span className="sr-only">Ziel auswählen</span>
</th>
)}
{['Hostname', 'Type', 'Zweck', 'OS', 'Status', 'Speicher frei / gesamt', 'RAM frei / gesamt', 'CPU', 'Kunde'].map(
{['Hostname', 'Type', 'OS', 'Status', 'Speicher frei / gesamt', 'RAM frei / gesamt', 'CPU', 'Kunde'].map(
(h) => (
<th scope="col" key={h} className={h === 'Zweck' ? 'purpose-col' : undefined}>
<th scope="col" key={h}>
{h}
</th>
)
@@ -639,8 +571,7 @@ export function Devices({
const asset = objectId(d, 'asset'),
agent = objectId(d, 'agent'),
customer = objectId(d, 'tenant'),
model = cpu(d),
purpose = typeof d.purpose === 'string' ? d.purpose : '';
model = cpu(d);
const show = () => {
setDeletionNotice('');
window.location.hash = ['geraete', customer, asset, agent]
@@ -677,11 +608,6 @@ export function Devices({
<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} />
-5
View File
@@ -97,10 +97,6 @@ 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 .nav-icon { width:13px; height:13px; flex:none; align-self:flex-start; margin-top:2px; }
.fleet-table .target-col { width:35px; }
.fleet-table th.purpose-col { width:17%; }
.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; }
.device-purpose textarea { font-family:inherit; }
.fleet-table td[data-label="Type"] { overflow-wrap:anywhere; }
.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; }
@@ -160,7 +156,6 @@ section.fleet { padding:0; overflow:hidden; }
.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 .hostname {grid-column:1/-1;padding-right:28px;} .host-link {font-size:1rem;}
.fleet-table .purpose-col {grid-column:1/-1;}
.fleet-table .target-col {position:absolute;right:14px;top:14px;width:auto;} .capacity-track {width:76px;}
.list-footer {border-top:1px solid var(--line);flex-wrap:wrap;} .facts {grid-template-columns:1fr 1fr;gap:12px;}
}