Compare commits

..
Author SHA1 Message Date
kevin_janssen bddfb26e67 Record Windows staged image read-only failure before the first replacement
Rust development slice / linux (push) Failing after 6s
2026-11-15 22:05:01 +01:00
kevin_janssen 00ecbb58ac Reference the unchanged helper's original link receipt in profile provenance 2026-11-15 22:02:53 +01:00
kevin_janssen ba43aee4a9 Bind an independent native passive pair witness to the successor Windows time profile
Rust development slice / linux (push) Failing after 6s
2026-11-15 22:02:03 +01:00
kevin_janssen 92b50f25e3 Record native preparation of Windows job binding and passive pair update
Rust development slice / linux (push) Failing after 6s
2026-11-15 22:00:07 +01:00
kevin_janssen cd0257fbe9 Stage a recoverable console-only passive Windows agent and reciprocal pin transition
Rust development slice / linux (push) Failing after 6s
2026-11-15 21:57:55 +01:00
kevin_janssen bd0a426019 Record native Windows profile opt-in qualification on the test VM
Rust development slice / linux (push) Failing after 6s
2026-11-15 21:57:24 +01:00
kevin_janssen eb3fa560d6 Stage and verify the first Windows LocalService job configuration
Rust development slice / linux (push) Failing after 7s
2026-11-15 21:55:46 +01:00
kevin_janssen cf2c1a632b Record the native Cloud Linux proof of the explicit PowerShell profile opt-in
Rust development slice / linux (push) Failing after 6s
2026-11-15 21:55:09 +01:00
kevin_janssen 45ce622370 Check the pinned Windows profile unit and installed PowerShell host
Rust development slice / linux (push) Failing after 7s
2026-11-15 21:51:58 +01:00
kevin_janssen fcec400ec6 Gate LocalService RemoteSigned admission on a protected Windows profile opt-in
Rust development slice / linux (push) Failing after 6s
2026-11-15 21:47:06 +01:00
kevin_janssen dffdd401c5 Verify the live WebUI test principal is available for the Windows acceptance
Rust development slice / linux (push) Failing after 7s
2026-11-15 21:46:47 +01:00
kevin_janssen 97d4f86940 Add the fixed Windows LocalService hello to the cloud acceptance path
Rust development slice / linux (push) Failing after 6s
2026-11-15 21:44:36 +01:00
kevin_janssen 6fb973a247 Verify the fixed Windows LocalService PowerShell plan in the test WebUI
Rust development slice / linux (push) Failing after 7s
2026-11-15 21:41:05 +01:00
kevin_janssen e32f6330a0 Record the Windows MCP plan rejection after successful time checks
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:45:10 +01:00
kevin_janssen c41c8c7286 Verify both Windows service time samples on the project server
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:42:12 +01:00
kevin_janssen 0902a44671 Record native Windows time profile publication and target readback
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:41:25 +01:00
kevin_janssen e7cf1aed73 Bind empty-profile receipts to the file ID recorded before publication
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:37:49 +01:00
kevin_janssen b614b6f5be Resume the verified empty Windows time profile by exclusive handle
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:37:14 +01:00
kevin_janssen 242641de72 Record Windows console evidence for the empty protected profile and exact ACL delta
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:31:51 +01:00
12 changed files with 1220 additions and 27 deletions
+103 -5
View File
@@ -39,6 +39,51 @@ struct Config {
// Explicit protected opt-in only; this flag never qualifies a clock or pins. // Explicit protected opt-in only; this flag never qualifies a clock or pins.
#[serde(default)] #[serde(default)]
enable_jobs: bool, enable_jobs: bool,
#[serde(
default,
deserialize_with = "rmm_domain::jobs::deserialize_windows_execution_profile"
)]
windows_execution_profile: Option<rmm_domain::jobs::WindowsExecutionProfile>,
}
impl Config {
fn profile_enabled(&self, profile: rmm_domain::jobs::WindowsExecutionProfile) -> bool {
self.enable_jobs
&& self.job_binding_file.is_some()
&& cfg!(feature = "system-helper")
&& self.windows_execution_profile == Some(profile)
}
fn read(path: &Path) -> Result<Self> {
let raw = protected_read(path, 32768)?;
let config: Self = serde_json::from_slice(&raw)?;
if let Some(profile) = config.windows_execution_profile {
ensure!(
config.profile_enabled(profile),
"WINDOWS_PROFILE_REQUIRES_JOB_CONFIGURATION"
);
#[cfg(feature = "system-helper")]
{
use rmm_agent_windows::helper_ipc::PinnedFile;
use std::io::Read;
// Verify the exact bytes used for the opt-in under the existing
// administrator-owned, service-read-only file and directory ACLs.
let readers = [native::service_sid()?];
let mut parent = PinnedFile::open(
path.parent().context("CONFIG_PARENT")?,
true,
&readers,
&[],
false,
)?;
let mut pin = PinnedFile::open(path, false, &readers, &[], false)?;
let mut verified = Vec::new();
(&mut pin.file).take(32769).read_to_end(&mut verified)?;
ensure!(verified == raw, "WINDOWS_PROFILE_CONFIGURATION_CHANGED");
pin.check()?;
parent.check()?;
}
}
Ok(config)
}
} }
fn create_private(path: &Path, bytes: &[u8]) -> Result<()> { fn create_private(path: &Path, bytes: &[u8]) -> Result<()> {
use std::io::Write; use std::io::Write;
@@ -830,6 +875,13 @@ impl Agent {
return false; return false;
} }
if rmm_agent_windows::actions::supported(job) { if rmm_agent_windows::actions::supported(job) {
if let rmm_domain::jobs::Action::RunScript {
windows_execution_profile: Some(profile),
..
} = &job.action
{
return self.binding.is_some() && self.config.profile_enabled(*profile);
}
return true; return true;
} }
#[cfg(feature = "system-helper")] #[cfg(feature = "system-helper")]
@@ -859,9 +911,12 @@ impl Agent {
{ {
caps.extend(["rmm.sync.v1", "refresh_inventory"].map(str::to_string)); caps.extend(["rmm.sync.v1", "refresh_inventory"].map(str::to_string));
if rmm_agent_windows::actions::powershell().is_ok() { if rmm_agent_windows::actions::powershell().is_ok() {
// The process_remote_signed profile is implemented but remains
// unpublished until its separate native qualification passes.
caps.extend(["run_script", "script.powershell/1"].map(str::to_string)); caps.extend(["run_script", "script.powershell/1"].map(str::to_string));
if self.config.profile_enabled(
rmm_domain::jobs::WindowsExecutionProfile::PowerShell51RemoteSigned,
) {
caps.push(rmm_agent_windows::actions::REMOTE_SIGNED_PROFILE_CAPABILITY.into());
}
} }
} }
caps caps
@@ -1810,7 +1865,7 @@ fn service_run(stop: &'static AtomicBool) -> Result<()> {
); );
let path = Path::new(&arguments[2]); let path = Path::new(&arguments[2]);
ensure!(path.is_absolute(), "ABSOLUTE_CONFIG_REQUIRED"); ensure!(path.is_absolute(), "ABSOLUTE_CONFIG_REQUIRED");
let config: Config = serde_json::from_slice(&protected_read(path, 32768)?)?; let config = Config::read(path)?;
native::require_local_service()?; native::require_local_service()?;
ensure!( ensure!(
config.state_directory.is_absolute(), config.state_directory.is_absolute(),
@@ -1951,7 +2006,7 @@ pub fn main() -> Result<()> {
args.len() == 3 && args[1] == "--config", args.len() == 3 && args[1] == "--config",
"SERVICE_ARGUMENTS" "SERVICE_ARGUMENTS"
); );
let config: Config = serde_json::from_slice(&protected_read(Path::new(&args[2]), 32768)?)?; let config = Config::read(Path::new(&args[2]))?;
// Shared transport reads its one DNS identity. Set it before SCM dispatch // Shared transport reads its one DNS identity. Set it before SCM dispatch
// creates its service thread and before any Tokio/collector threads exist. // creates its service thread and before any Tokio/collector threads exist.
unsafe { unsafe {
@@ -2053,15 +2108,58 @@ mod tests {
} }
#[test] #[test]
fn old_passive_configuration_cannot_enable_jobs_or_read_the_clock() { fn old_passive_configuration_cannot_enable_jobs_or_read_the_clock() {
let config:Config=serde_json::from_value(serde_json::json!({"server_name":"example.invalid","connect_address":"127.0.0.1:443","ca_file":"C:/fixture/ca.pem","state_directory":"C:/fixture/state","enrollment_token_file":"C:/fixture/token","transport":"auto"})).unwrap(); let config: Config = serde_json::from_value(passive_test_config()).unwrap();
assert!(!config.enable_jobs); assert!(!config.enable_jobs);
assert!(config.job_binding_file.is_none()); assert!(config.job_binding_file.is_none());
assert!(config.windows_execution_profile.is_none());
let clock = JobClock::new(config.enable_jobs); let clock = JobClock::new(config.enable_jobs);
assert_eq!( assert_eq!(
clock.now().unwrap_err().to_string(), clock.now().unwrap_err().to_string(),
"WINDOWS_JOBS_NOT_ENABLED" "WINDOWS_JOBS_NOT_ENABLED"
); );
} }
fn passive_test_config() -> serde_json::Value {
serde_json::json!({
"server_name":"example.invalid","connect_address":"127.0.0.1:443",
"ca_file":"C:/fixture/ca.pem","state_directory":"C:/fixture/state",
"enrollment_token_file":"C:/fixture/token","transport":"auto"
})
}
#[test]
fn remote_signed_requires_explicit_profile_jobs_and_binding() {
let profile = rmm_domain::jobs::WindowsExecutionProfile::PowerShell51RemoteSigned;
let mut config: Config = serde_json::from_value(passive_test_config()).unwrap();
config.enable_jobs = true;
config.job_binding_file = Some("C:/fixture/binding.json".into());
assert!(!config.profile_enabled(profile));
config.windows_execution_profile = Some(profile);
assert_eq!(
config.profile_enabled(profile),
cfg!(feature = "system-helper")
);
config.enable_jobs = false;
assert!(!config.profile_enabled(profile));
config.enable_jobs = true;
config.job_binding_file = None;
assert!(!config.profile_enabled(profile));
let mut value = passive_test_config();
value["windows_execution_profile"] = serde_json::json!("powershell_51_remote_signed");
assert_eq!(
serde_json::from_value::<Config>(value.clone())
.unwrap()
.windows_execution_profile,
Some(profile)
);
for invalid in [
serde_json::Value::Null,
serde_json::json!(true),
serde_json::json!("Bypass"),
] {
value["windows_execution_profile"] = invalid;
assert!(serde_json::from_value::<Config>(value.clone()).is_err());
}
}
#[test] #[test]
fn legacy_inventory_keeps_original_bytes_until_concrete_core_ack() { fn legacy_inventory_keeps_original_bytes_until_concrete_core_ack() {
let directory = let directory =
+28 -3
View File
@@ -2,15 +2,32 @@
const fs = require('node:fs'); const fs = require('node:fs');
const path = require('node:path'); const path = require('node:path');
const crypto = require('node:crypto'); const crypto = require('node:crypto');
const { isDeepStrictEqual } = require('node:util');
const { chromium } = require('../../web/node_modules/playwright'); const { chromium } = require('../../web/node_modules/playwright');
const root = path.resolve(__dirname, '../..'); const root = path.resolve(__dirname, '../..');
const assert = (value) => { if (!value) throw new Error('UI contract mismatch'); }; const assert = (value) => { if (!value) throw new Error('UI contract mismatch'); };
function checkWindowsHello(job, planBytes) {
const payload = job.payload;
const action = {
action: 'run_script', interpreter: 'powershell', script_utf8: "Write-Output 'Zeitprofil-Test'\r\n",
arguments: [], expected_stdout: 'Zeitprofil-Test\r\n', windows_execution_profile: 'powershell_51_remote_signed',
};
const stored = JSON.parse(Buffer.from(planBytes).toString('utf8'));
assert(stored.jobs.length === 1 && isDeepStrictEqual(stored.jobs[0].payload, payload));
assert(payload.tenant_id === '11111111-1111-4111-8111-111111111111'
&& payload.agent_id === '63ea15b2-0643-403d-b5b4-cba1288dbea3'
&& payload.asset_id === 'a176520e-8a91-4e93-a78b-8e7620f430e0'
&& payload.execution_identity === 'agent_service' && isDeepStrictEqual(payload.action, action));
assert(stored.jobs[0].job_payload_hash === job.job_payload_hash
&& stored.jobs[0].script_sha256 === job.script_sha256
&& crypto.createHash('sha256').update(action.script_utf8, 'utf8').digest('hex') === job.script_sha256);
}
(async () => { (async () => {
const file = path.resolve(process.argv[2]); const file = path.resolve(process.argv[2]);
const stat = fs.lstatSync(file); const stat = fs.lstatSync(file);
assert(stat.isFile() && !stat.isSymbolicLink() && stat.uid === process.getuid() && (stat.mode & 0o777) === 0o600); assert(stat.isFile() && !stat.isSymbolicLink() && stat.uid === process.getuid() && (stat.mode & 0o777) === 0o600);
const expected = JSON.parse(fs.readFileSync(file, 'utf8')); const expected = JSON.parse(fs.readFileSync(file, 'utf8'));
assert(expected.profile === 'dev/test' && ['hello', 'refresh_inventory', 'cancel_queued'].includes(expected.case)); assert(expected.profile === 'dev/test' && ['hello', 'refresh_inventory', 'cancel_queued', 'windows_hello'].includes(expected.case));
assert(expected.expected_principal === 'simulated-testprincipal-a'); assert(expected.expected_principal === 'simulated-testprincipal-a');
const loginFile = path.join(root, 'credentials/server-browser-login.json'); const loginFile = path.join(root, 'credentials/server-browser-login.json');
const loginStat = fs.lstatSync(loginFile); const loginStat = fs.lstatSync(loginFile);
@@ -38,7 +55,7 @@ const assert = (value) => { if (!value) throw new Error('UI contract mismatch');
assert(pending.approval_state === 'pending_approval' && pending.job_count === 0 && pending.execution_state === null); assert(pending.approval_state === 'pending_approval' && pending.job_count === 0 && pending.execution_state === null);
await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen', exact: true }).click(); await op.getByRole('button', { name: 'Unveränderlichen Plan zur Prüfung öffnen', exact: true }).click();
const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) }); const detail = page.locator('section').filter({ has: page.getByRole('heading', { name: 'Unveränderlicher Plan / Genehmigungsdetail', exact: true }) });
const rendered = JSON.parse(await detail.locator('pre').first().innerText()); const rendered = JSON.parse(await detail.getByLabel('Alle festen Zielpreviews, exakte Skriptinhalte/Hashes, Parameter, Rechte, Fristen, Rollout und Nachbedingungen', { exact: true }).innerText());
assert(rendered.plan_hash === expected.plan.plan_hash && crypto.createHash('sha256').update(Buffer.from(rendered.plan_payload_bytes)).digest('hex') === expected.plan.plan_hash); assert(rendered.plan_hash === expected.plan.plan_hash && crypto.createHash('sha256').update(Buffer.from(rendered.plan_payload_bytes)).digest('hex') === expected.plan.plan_hash);
assert(JSON.stringify(rendered.plan_payload_bytes) === JSON.stringify(expected.plan.plan_payload_bytes)); assert(JSON.stringify(rendered.plan_payload_bytes) === JSON.stringify(expected.plan.plan_payload_bytes));
assert(rendered.jobs.length === 1 && rendered.resolved_targets.length === 1); assert(rendered.jobs.length === 1 && rendered.resolved_targets.length === 1);
@@ -47,7 +64,15 @@ const assert = (value) => { if (!value) throw new Error('UI contract mismatch');
assert(payload.agent_id === expected.agent_id && payload.asset_id === expected.asset_id && payload.tenant_id === expected.tenant_id); assert(payload.agent_id === expected.agent_id && payload.asset_id === expected.asset_id && payload.tenant_id === expected.tenant_id);
assert(payload.execution_identity === 'agent_service' && payload.max_runtime_seconds === 60 && payload.max_output_bytes <= 65536); assert(payload.execution_identity === 'agent_service' && payload.max_runtime_seconds === 60 && payload.max_output_bytes <= 65536);
assert(Date.parse(payload.start_before) > Date.now()); assert(Date.parse(payload.start_before) > Date.now());
if (expected.case === 'hello' || expected.case === 'cancel_queued') assert(payload.action.action === 'run_script' && payload.action.interpreter === 'posix_sh' && payload.action.script_utf8 === "printf '%s\\n' 'Hello World'\n" && payload.action.expected_stdout === 'Hello World\n'); if (expected.case === 'windows_hello') {
checkWindowsHello(job, rendered.plan_payload_bytes);
assert(expected.stage === 'pending_approval' && expected.preapproval.jobs === 0
&& expected.preapproval.outbox === 0 && expected.preapproval.permits === 0);
assert(pending.plan_id === rendered.plan_id && pending.operation_id === expected.operation_id);
await detail.getByLabel('Feste PowerShell-Prozessprofile', { exact: true })
.getByText('Asset: ' + payload.asset_id + ' · Windows PowerShell5.1 · agent_service · RemoteSigned · nur Jobprozess', { exact: true }).waitFor();
}
else if (expected.case === 'hello' || expected.case === 'cancel_queued') assert(payload.action.action === 'run_script' && payload.action.interpreter === 'posix_sh' && payload.action.script_utf8 === "printf '%s\\n' 'Hello World'\n" && payload.action.expected_stdout === 'Hello World\n');
else assert(payload.action.action === 'refresh_inventory' && payload.action.scope === 'linux.base'); else assert(payload.action.action === 'refresh_inventory' && payload.action.scope === 'linux.base');
const approve = detail.getByRole('button', { name: 'SIMULIERT: Diesen festen Plan ausdrücklich genehmigen', exact: true }); const approve = detail.getByRole('button', { name: 'SIMULIERT: Diesen festen Plan ausdrücklich genehmigen', exact: true });
assert(await approve.isDisabled()); assert(await approve.isDisabled());
+52 -5
View File
@@ -6,6 +6,7 @@ Credentials stay on the cloud server; the browser reads its protected login
file. All SQL is fixed read-only evidence, scoped to the one cloud VM. file. All SQL is fixed read-only evidence, scoped to the one cloud VM.
""" """
import argparse import argparse
from datetime import timedelta
import hashlib import hashlib
import http.client import http.client
import json import json
@@ -24,6 +25,38 @@ import vm_mvp_acceptance as contract
ROOT = bootstrap.ROOT ROOT = bootstrap.ROOT
TENANT = bootstrap.TENANT TENANT = bootstrap.TENANT
require = bootstrap.require require = bootstrap.require
WINDOWS_AGENT = '63ea15b2-0643-403d-b5b4-cba1288dbea3'
WINDOWS_ASSET = 'a176520e-8a91-4e93-a78b-8e7620f430e0'
WINDOWS_SCRIPT = "Write-Output 'Zeitprofil-Test'\r\n"
WINDOWS_STDOUT = 'Zeitprofil-Test\r\n'
def windows_hello_input():
start = contract.now()
return dict(
tenant_id=TENANT, action='run_script', targets=dict(asset_ids=[WINDOWS_ASSET]),
parameters=dict(
execution_identity='agent_service', timeout_seconds=60, max_output_bytes=65536,
arguments=[], expected_stdout=WINDOWS_STDOUT,
variants=[dict(os_family='windows', interpreter='powershell', encoding='utf-8',
script_utf8=WINDOWS_SCRIPT, windows_execution_profile='powershell_51_remote_signed')]),
schedule=contract.schedule(start, start + timedelta(minutes=15)),
rollout=dict(max_parallel=1, halt_after_failures=1),
reason='Erste genehmigte PowerShell-Textausgabe auf der Windows-Test-VM')
def verify_windows_hello(result):
report = result['result']
proof = report['evidence']
contract.require(result['state'] == 'succeeded' and report['exit_code'] == 0
and bytes(report['stdout']) == WINDOWS_STDOUT.encode() and bytes(report['stderr']) == b''
and report['output_truncated'] is False and proof['postconditions_passed'] is True
and proof['execution_sid'] == 'S-1-5-19' and proof['interpreter'] == 'powershell'
and proof['script_sha256'] == hashlib.sha256(WINDOWS_SCRIPT.encode()).hexdigest()
and proof['windows_execution_profile'] == 'powershell_51_remote_signed'
and proof['execution_policy'] == 'process_remote_signed_requested'
and proof['execution_policy_requested'] == 'RemoteSigned'
and proof['execution_policy_scope'] == 'process', 'windows_hello_evidence')
def prepare_browser(): def prepare_browser():
@@ -147,13 +180,18 @@ class Backend:
def main(): def main():
parser=argparse.ArgumentParser(description=__doc__) parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--execute-dev-test-ui',action='store_true',required=True) parser.add_argument('--execute-dev-test-ui',action='store_true',required=True)
parser.add_argument('--case',choices=('hello','refresh_inventory','cancel_queued'),default='hello') parser.add_argument('--case',choices=('hello','refresh_inventory','cancel_queued','windows_hello'),default='hello')
parser.add_argument('--transport',choices=('wss','https')) parser.add_argument('--transport',choices=('wss','https'))
args=parser.parse_args();os.umask(0o077) args=parser.parse_args();os.umask(0o077)
contract.require(not (Path.home()/'.local/share/rust-discovery/remote-agent').exists(),'notebook_must_not_have_client') contract.require(not (Path.home()/'.local/share/rust-discovery/remote-agent').exists(),'notebook_must_not_have_client')
prepare_browser() windows = args.case == 'windows_hello'
installed=contract.protected_json(ROOT/'devstate/remote-vm.json') if windows:
identity=installed['identity'] contract.require(args.transport is None, 'windows_keep_current_transport')
identity = dict(agent_id=WINDOWS_AGENT, asset_id=WINDOWS_ASSET)
else:
prepare_browser()
installed=contract.protected_json(ROOT/'devstate/remote-vm.json')
identity=installed['identity']
settings=dict(tenant_id=TENANT,**identity) settings=dict(tenant_id=TENANT,**identity)
def evidence(kind,**extra): def evidence(kind,**extra):
return bootstrap.rpc('server.conf',server,dict(kind=kind,tenant_id=TENANT,agent_id=identity['agent_id'],**extra)) return bootstrap.rpc('server.conf',server,dict(kind=kind,tenant_id=TENANT,agent_id=identity['agent_id'],**extra))
@@ -172,11 +210,18 @@ def main():
observed=bootstrap.rpc('server.conf',bootstrap.server,dict(action='observe',agent_id=identity['agent_id'])) observed=bootstrap.rpc('server.conf',bootstrap.server,dict(action='observe',agent_id=identity['agent_id']))
contract.require(observed['sync_ready'] and not observed['restore_blocked'],'signed_sync_gate_required') contract.require(observed['sync_ready'] and not observed['restore_blocked'],'signed_sync_gate_required')
needed={'refresh_inventory' if args.case=='refresh_inventory' else 'run_script','rmm.sync.v1'} needed={'refresh_inventory' if args.case=='refresh_inventory' else 'run_script','rmm.sync.v1'}
if windows:
needed.update(('windows.base/1', 'script.powershell/1', 'script.powershell.process_remote_signed/1'))
contract.require(needed<=set(device['capabilities']),'actual_vm_capability_required') contract.require(needed<=set(device['capabilities']),'actual_vm_capability_required')
request=contract.case_input(args.case,settings) if windows:
prepare_browser()
request=windows_hello_input() if windows else contract.case_input(args.case,settings)
plan=backend.call('operations.plan',dict(tenant_id=TENANT,input=request)) plan=backend.call('operations.plan',dict(tenant_id=TENANT,input=request))
contract.require(hashlib.sha256(bytes(plan['plan_payload_bytes'])).hexdigest()==plan['plan_hash'] and len(plan['jobs'])==1,'immutable_plan') contract.require(hashlib.sha256(bytes(plan['plan_payload_bytes'])).hexdigest()==plan['plan_hash'] and len(plan['jobs'])==1,'immutable_plan')
job=plan['jobs'][0] job=plan['jobs'][0]
if windows:
contract.require(job['payload']['agent_id']==WINDOWS_AGENT and job['payload']['asset_id']==WINDOWS_ASSET
and job['payload']['tenant_id']==TENANT, 'fixed_windows_target_required')
folder=ROOT/'devstate/cloud-acceptance'/uuid.uuid4().hex;folder.mkdir(mode=0o700,parents=True) folder=ROOT/'devstate/cloud-acceptance'/uuid.uuid4().hex;folder.mkdir(mode=0o700,parents=True)
checkpoint=dict(profile='dev/test',case=args.case,expected_principal='simulated-testprincipal-a',**settings, checkpoint=dict(profile='dev/test',case=args.case,expected_principal='simulated-testprincipal-a',**settings,
plan=plan,job=job,stage='planned',no_retry=True,transport=observed['transport'],server_connection=observed) plan=plan,job=job,stage='planned',no_retry=True,transport=observed['transport'],server_connection=observed)
@@ -205,6 +250,8 @@ def main():
contract.require(result['state']=='succeeded' and result['result']['evidence']['postconditions_passed'],'native_postconditions_required') contract.require(result['state']=='succeeded' and result['result']['evidence']['postconditions_passed'],'native_postconditions_required')
if args.case=='hello': if args.case=='hello':
contract.require(result['result']['exit_code']==0 and bytes(result['result']['stdout'])==b'Hello World\n','exact_stdout_required') contract.require(result['result']['exit_code']==0 and bytes(result['result']['stdout'])==b'Hello World\n','exact_stdout_required')
elif windows:
verify_windows_hello(result)
elif args.case=='refresh_inventory': elif args.case=='refresh_inventory':
contract.require(contract.timestamp(result['result']['evidence']['observed_at'])>=contract.timestamp(request['schedule']['not_before']),'fresh_inventory_required') contract.require(contract.timestamp(result['result']['evidence']['observed_at'])>=contract.timestamp(request['schedule']['not_before']),'fresh_inventory_required')
gate=evidence('gate',job_id=job['job_id']);audit=evidence('audit',operation_id=pending['operation_id']) gate=evidence('gate',job_id=job['job_id']);audit=evidence('audit',operation_id=pending['operation_id'])
@@ -1,13 +1,13 @@
#requires -Version 5.1 #requires -Version 5.1
#requires -RunAsAdministrator #requires -RunAsAdministrator
# The relay receives a fixed public receipt. There is no command reader. # The relay receives a fixed public receipt. There is no command reader.
param([Parameter(Mandatory)][DateTimeOffset]$Until) param([Parameter(Mandatory)][DateTimeOffset]$Until, [switch]$ResumeEmpty)
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
$deadline = [DateTimeOffset]::UtcNow.AddMinutes(12) $deadline = [DateTimeOffset]::UtcNow.AddMinutes(12)
if ($deadline -gt $until) { $deadline = $until } if ($deadline -gt $until) { $deadline = $until }
if ($deadline -le [DateTimeOffset]::UtcNow) { throw 'Das Wartungsfenster ist abgelaufen.' } if ($deadline -le [DateTimeOffset]::UtcNow) { throw 'Das Wartungsfenster ist abgelaufen.' }
$base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/38e6df51ea57a76ec2d5462513d59e855f36c0f4/deploy/windows' $base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/b614b6f5be9d700eef20586a038aa9643356049a/deploy/windows'
$bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap' $bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap'
$caseId = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf' $caseId = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf'
$case = Join-Path $bootstrap "time-profile-$caseId" $case = Join-Path $bootstrap "time-profile-$caseId"
@@ -24,7 +24,7 @@ $null = New-Item -ItemType Directory -Path $work
$listener = $null $listener = $null
$ssh = $null $ssh = $null
$scripts = [ordered]@{ $scripts = [ordered]@{
'Complete-OriginalTimeProfile.ps1' = 'c2fb92ebd0f4ab19545b55ad92d7a9b21ec6e3604d33107d0dd78882162be131' 'Complete-OriginalTimeProfile.ps1' = 'aacc56321dccc6efe496a782d4cf67defba5b0be6759cba08d9e0b775913210b'
'Read-PassiveTimeSamples.ps1' = 'd9e2b9344c19af1296b86ec70ba754ef820f369ac5ec897979bd4233e0722d04' 'Read-PassiveTimeSamples.ps1' = 'd9e2b9344c19af1296b86ec70ba754ef820f369ac5ec897979bd4233e0722d04'
} }
try { try {
@@ -45,17 +45,25 @@ try {
$ssh = Start-Process -FilePath "$sshBin\ssh.exe" -ArgumentList $options -PassThru -NoNewWindow $ssh = Start-Process -FilePath "$sshBin\ssh.exe" -ArgumentList $options -PassThru -NoNewWindow
if ($ssh.WaitForExit(1800)) { throw "SSH Exit $($ssh.ExitCode)" } if ($ssh.WaitForExit(1800)) { throw "SSH Exit $($ssh.ExitCode)" }
Write-Host 'Wartungsfenster aktiv. Dieses Fenster offen lassen. Strg+C beendet es.' Write-Host 'Wartungsfenster aktiv. Dieses Fenster offen lassen. Strg+C beendet es.'
$receipt = [ordered]@{session=$session; case_id=$caseId; method='initial_create'; phase='preflight'; read_only_channel=$true} $method = 'initial_create'
$result = Join-Path $case 'console-initial-create-result.json' $prefix = 'console-initial-create'
$intentPath = Join-Path $case 'console-initial-create-intent.json' $arguments = @{ InitialCreate=$true }
$failurePath = Join-Path $case 'console-initial-create-error.json' if ($ResumeEmpty) {
$method = 'resume_empty'
$prefix = 'console-resume-empty'
$arguments = @{ ResumeEmpty=$true }
}
$receipt = [ordered]@{session=$session; case_id=$caseId; method=$method; phase='preflight'; read_only_channel=$true}
$result = Join-Path $case "$prefix-result.json"
$intentPath = Join-Path $case "$prefix-intent.json"
$failurePath = Join-Path $case "$prefix-error.json"
$receipt.finalizer_invoked = $false $receipt.finalizer_invoked = $false
try { try {
if (Test-Path -LiteralPath $failurePath) { throw 'Previous profile finalization error recorded' } if (Test-Path -LiteralPath $failurePath) { throw 'Previous profile finalization error recorded' }
if (!(Test-Path -LiteralPath $result)) { if (!(Test-Path -LiteralPath $result)) {
if (Test-Path -LiteralPath $intentPath) { throw 'Previous profile finalization intent without result' } if (Test-Path -LiteralPath $intentPath) { throw 'Previous profile finalization intent without result' }
$receipt.finalizer_invoked = $true $receipt.finalizer_invoked = $true
$null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1') -InitialCreate $null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1') @arguments
} }
$record = Get-Content -LiteralPath $result -Raw | ConvertFrom-Json $record = Get-Content -LiteralPath $result -Raw | ConvertFrom-Json
$actual = Get-FileHash -LiteralPath 'C:\ProgramData\RustDiscoverySystem\time-attestation.json' $actual = Get-FileHash -LiteralPath 'C:\ProgramData\RustDiscoverySystem\time-attestation.json'
@@ -68,6 +76,13 @@ try {
$marker.config_sha256 -ne $actual.Hash -or $record.configuration.sha256 -ne $actual.Hash -or $marker.config_sha256 -ne $actual.Hash -or $record.configuration.sha256 -ne $actual.Hash -or
$record.original_candidate.file_id -cne '6d990300000003000000000000000000' -or $record.original_candidate.file_id -cne '6d990300000003000000000000000000' -or
$record.configuration.file_id -cnotmatch '^[0-9a-f]{32}$' -or $record.configuration.file_id -ceq '6d990300000003000000000000000000') { throw 'Unexpected finalization intent' } $record.configuration.file_id -cnotmatch '^[0-9a-f]{32}$' -or $record.configuration.file_id -ceq '6d990300000003000000000000000000') { throw 'Unexpected finalization intent' }
if ($ResumeEmpty) {
if ($record.resumed_empty -ne $true -or $marker.target_id -cne $record.configuration.file_id) {
throw 'Recovered profile file identity differs from the recovery intent'
}
$receipt.resumed_empty = $true
$receipt.reserved_target_id = $marker.target_id
}
$receipt.phase = 'published' $receipt.phase = 'published'
$receipt.publication_since = $record.publication_since $receipt.publication_since = $record.publication_since
$receipt.initial_create = $record.initial_create $receipt.initial_create = $record.initial_create
@@ -0,0 +1,212 @@
#requires -Version 5.1
#requires -RunAsAdministrator
# Publish the next trusted-OS profile from actual passive service observations.
[CmdletBinding()]
param([Parameter(Mandatory)][ValidateSet('Prepare','Publish','Read','FinishStarts')][string]$Action)
$ErrorActionPreference='Stop'
$commonHash='c54e36b32a2fcccb072f2cca52a38b6c4da31755d86205599016c5d180f5cec4'
$common=Join-Path $PSScriptRoot 'Set-PassiveJobPair.ps1'
if ((Get-FileHash -LiteralPath $common -Algorithm SHA256).Hash -ne $commonHash) {
throw 'The reviewed passive-pair controller must be next to this script'
}
$text=[Text.Encoding]::UTF8.GetString([IO.File]::ReadAllBytes($common))
$first="`n`$originalCase = "
$last="`nif (`$Mode -eq 'Read') {"
$i=$text.IndexOf($first,[StringComparison]::Ordinal)
$j=$text.IndexOf($last,[StringComparison]::Ordinal)
if ($i -lt 0 -or $j -le $i -or $i -ne $text.LastIndexOf($first,[StringComparison]::Ordinal) -or
$j -ne $text.LastIndexOf($last,[StringComparison]::Ordinal)) { throw 'Passive-pair definition boundary' }
# Fixed declarations and functions only. Its Prepare, Install and Restore bodies are excluded.
. ([scriptblock]::Create($text.Substring($i,$j-$i)))
CheckControl $work $true
$activation=(Marker 'profile-publish-intent')
$ready=(Marker 'profile-prepared')
$success=(Marker 'profile-published')
function RequireNewPassivePair {
if ((Hash $config) -cne $configHash -or (Hash $helperBinary) -cne $helperHash -or
(Test-Path -LiteralPath (Marker 'restore-intent'))) { throw 'Passive successor pair required' }
VerifyFiles (CurrentFiles) $newHashes
}
function RoleDigests($platformHash,$installedHash,$independentHash,$previous) {
$out=@{}
foreach ($name in @('agent','system_helper')) {
$bound=$installed.agent
if ($name -ceq 'system_helper') { $bound=$installed.helper }
$old=@($previous.trusted_os_active_guest.qualifications | Where-Object { $_.role -ceq $name })
if ($old.Count -ne 1) { throw 'Expected one predecessor witness per role' }
$archive=Join-Path $oldFolder ($name+'-qualification.json')
CheckControl $archive $false
if ((Hash $archive) -cne $old[0].qualification_sha256) { throw 'Original role provenance changed' }
$archived=Get-Content -LiteralPath $archive -Raw | ConvertFrom-Json
$build='a003dfa8cc2397a99933aceeb2d8dab51f883ab9cdf27876fbfc94a78873044c'
if ($name -ceq 'system_helper') {
# The old pair receipt linked the later agent and referenced the
# separately built helper. Identify the actual helper link itself.
$build='04ed34e6e850aca77c1fd4677ddb271f7ccd9492a97f5d4e00ead4c1f032f29d'
}
Record ('profile-role-'+$name) ([ordered]@{
profile='rmm.windows.trusted-os.product-role-prerequisite.v1';role=$name
binary_sha256=$bound.image_file.sha256; service=$bound.service; kernel=$bound.kernel
image_file=$bound.image_file; predecessor_qualification_sha256=$old[0].qualification_sha256
pair_case_id=$id; pair_result_sha256=$installedHash; independent_pair_readback_sha256=$independentHash
product_build_receipt_sha256=$build; platform_provenance_sha256=$platformHash
raw_capture=$archived.raw_capture; signed_runtime_verified=$false; physical_calibration_claimed=$false
})
$out[$name]=Hash (Marker ('profile-role-'+$name))
}
return $out
}
function BuildSuccessor {
$installedHash=Hash (Marker 'installed')
$unit=Join-Path $boot 'profile-unit-fcec400-result.json'
if ((Hash $unit) -cne '48de474d842ebc87550ba2e27b66086e6aa573973f252f4b8e19ac7b12b75a63') { throw 'Windows unit evidence changed' }
$independent=[ordered]@{agent=(LiveRole 'agent' $newHashes.agent);helper=(LiveRole 'helper' $helperHash);files=(CurrentFiles);device=(PreservedDevice)}
foreach ($field in $independent.Keys) {
if (!(JsonEqual $installed.$field $independent.$field)) { throw "Independent native pair read differs: $field" }
}
$independent.utc=[DateTime]::UtcNow.ToString('o')
$independent.pair_case=$id
Record 'profile-independent-native-read' $independent
$independentHash=Hash (Marker 'profile-independent-native-read')
$old=Get-Content -LiteralPath $target -Raw | ConvertFrom-Json
if ($old.schema_version -ne 2 -or $old.key_generation -ne 1 -or
$old.server_instance -cne 'c6f9657a-446f-49af-8fb8-bd8932939568' -or
$old.trusted_os_active_guest.operating_assumption -cne 'active_guest_no_pause_save_restore_snapshot_migration_host_suspend' -or
$old.trusted_os_active_guest.platform -cne 'kvm_qemu_hypervclock' -or
@($old.trusted_os_active_guest.qualifications).Count -ne 2) { throw 'Unexpected original V2 contract' }
$platform=Join-Path $oldFolder 'platform-provenance.json'
CheckControl $platform $false
$oldPlatformHash=Hash $platform
if ($oldPlatformHash -cne $old.trusted_os_active_guest.platform_provenance_sha256) { throw 'Original platform provenance changed' }
Record 'profile-platform' ([ordered]@{
profile='rmm.windows.trusted-os.platform-provenance.v1';operating_assumption=$old.trusted_os_active_guest.operating_assumption
platform=$old.trusted_os_active_guest.platform;previous_platform_provenance_sha256=$oldPlatformHash
predecessor_profile_sha256=$profileHash;pair_case_id=$id;pair_result_sha256=$installedHash
independent_pair_readback_sha256=$independentHash;independent_physical_calibration_claimed=$false
agent_build_receipt_sha256='a003dfa8cc2397a99933aceeb2d8dab51f883ab9cdf27876fbfc94a78873044c'
linux_profile_unit_sha256='ee3a2c99651491a2fd876f1a3463919dc32d9509d9f9ef4eb73a36aa848bb56d'
windows_profile_unit_sha256=(Hash $unit)
})
$platformHash=Hash (Marker 'profile-platform')
$roles=RoleDigests $platformHash $installedHash $independentHash $old
$profileText=[Text.Encoding]::UTF8.GetString([IO.File]::ReadAllBytes($target))
$changes=[ordered]@{}
$changes[$oldHashes.agent]=$newHashes.agent
$changes[$oldPlatformHash]=$platformHash
foreach ($r in $old.trusted_os_active_guest.qualifications) {
$changes[$r.qualification_sha256]=$roles[$r.role]
}
if ($changes.Count -ne 4) { throw 'Expected four independent substitutions' }
foreach ($oldValue in $changes.Keys) {
$pos=$profileText.IndexOf($oldValue,[StringComparison]::Ordinal)
if ($pos -lt 0 -or $pos -ne $profileText.LastIndexOf($oldValue,[StringComparison]::Ordinal)) { throw 'Cannot uniquely bind successor' }
$profileText=$profileText.Replace($oldValue,$changes[$oldValue])
}
$updated=$profileText | ConvertFrom-Json
if ($updated.key_generation -ne $old.key_generation -or $updated.server_instance -cne $old.server_instance -or
!(JsonEqual $old.binding $updated.binding) -or !(JsonEqual $old.public_keys_hex $updated.public_keys_hex)) {
throw 'Unexpected trust-root changes'
}
$draft=Join-Path $work 'new-time-profile'
WriteBytes $draft ([Text.UTF8Encoding]::new($false).GetBytes($profileText))
CheckControl $draft $false
$oldCopy=Join-Path $work 'old-time-profile'
WriteBytes $oldCopy ([IO.File]::ReadAllBytes($target))
if ((Hash $oldCopy) -cne $profileHash) { throw 'Time profile predecessor changed' }
Record 'profile-prepared' ([ordered]@{
id=$id;utc=[DateTime]::UtcNow.ToString('o');predecessor=(FileIdentity $target);successor_sha256=(Hash $draft)
source_sha256=$installedHash;independent_sha256=$independentHash;platform_sha256=$platformHash;role_sha256=$roles
original_publish_result_sha256='62a04be9c7d08d3687b51eacd6adbe290b91e16ba934d6b5bb531e8764a56cf5'
predecessor_revision=1;successor_revision=2;signing_key_generation=$old.key_generation;clock_qualified=$false
})
}
function CheckPrepared {
if ($prepared.id -cne $id -or $prepared.predecessor.sha256 -cne $profileHash -or
$prepared.successor_revision -ne 2 -or $prepared.predecessor_revision -ne 1 -or $prepared.signing_key_generation -ne 1 -or
$prepared.source_sha256 -cne (Hash (Marker 'installed')) -or
$prepared.independent_sha256 -cne (Hash (Marker 'profile-independent-native-read')) -or
$prepared.platform_sha256 -cne (Hash (Marker 'profile-platform')) -or
$prepared.successor_sha256 -cne (Hash (Join-Path $work 'new-time-profile')) -or
$prepared.successor_sha256 -ceq $profileHash -or
(Hash (Join-Path $work 'old-time-profile')) -cne $profileHash) { throw 'Successor preparation inconsistent' }
foreach ($name in @('agent','system_helper')) {
if ($prepared.role_sha256.$name -cne (Hash (Marker ('profile-role-'+$name)))) { throw 'Role proof changed' }
}
}
function FinishPublication {
$intent=LoadRecord 'profile-publish-intent'
$actual=FileIdentity $target
if ($intent.id -cne $id -or $intent.prepared_sha256 -cne (Hash $ready) -or
$actual.sha256 -cne $prepared.successor_sha256 -or
$actual.acl_sha256 -cne $prepared.predecessor.acl_sha256) { throw 'Successor readback failed' }
if (Test-Path -LiteralPath (Marker 'time-installed-time')) {
if (!(JsonEqual (LoadRecord 'time-installed-time') $actual)) { throw 'Installed profile identity changed' }
} else {
# An interrupted Replace can finish before the final journal write.
# Recognize the recorded candidate and native backup without another Replace.
StopCheck
$attempt=LoadRecord 'time-replace-time'
$previous=FileIdentity (Join-Path $work 'time-replaced-time')
if (!(JsonEqual $attempt.previous $prepared.predecessor) -or
$previous.sha256 -cne $prepared.predecessor.sha256 -or $previous.file_id -cne $prepared.predecessor.file_id -or
$actual.file_id -cne $attempt.candidate.file_id -or $actual.volume_serial -cne $attempt.candidate.volume_serial) {
throw 'Unconfirmed profile replacement: inspect current state'
}
Record 'time-installed-time' $actual
}
if (Test-Path -LiteralPath $success) { throw 'Already published: use Read' }
foreach ($role in @('helper','agent')) {
$hash=$newHashes.agent;$name=$agentName
if ($role -eq 'helper') { $hash=$helperHash;$name=$helperName }
$s=Service $role
if ($s.state -ceq 'Stopped') {
if (Test-Path -LiteralPath (Marker ('time-start-'+$role))) { throw "Existing unconfirmed $role start; read current state" }
StartKnownRole $role $name $hash 'time'
} elseif ($s.state -ceq 'Running') {
if (!(Test-Path -LiteralPath (Marker ('time-start-'+$role)))) { throw "Unexpected independently started $role" }
$null=LiveRole $role $hash
} else { throw "Unexpected state $role" }
}
Record 'profile-published' ([ordered]@{
id=$id;utc=[DateTime]::UtcNow.ToString('o');configuration=(FileIdentity $target)
predecessor=$prepared.predecessor; successor_revision=2; signing_key_generation=1
role_proofs=$prepared.role_sha256; publication_since=$intent.utc
agent=(LiveRole 'agent' $newHashes.agent); helper=(LiveRole 'helper' $helperHash)
signed_runtime_verified=$false; job_mode=$false;privileged_effects=$false
})
Write-Output "Published successor profile $id"
}
if ($Action -ceq 'Read') {
$o=[ordered]@{id=$id;read_only=$true;configuration=(FileIdentity $target);agent=(Service 'agent');helper=(Service 'helper');marks=@()}
$o.marks=@(Get-ChildItem -LiteralPath $work -Filter 'profile-*.json' -File | Select-Object -ExpandProperty Name)
if (Test-Path -LiteralPath $success) { $o.published=LoadRecord 'profile-published' }
$o|ConvertTo-Json -Depth 15 -Compress
return
}
RequireNewPassivePair
$installed=LoadRecord 'installed'
if ($installed.id -cne $id -or $installed.job_mode -ne $false -or $installed.clock_qualified -ne $false) { throw 'Expected passive installation' }
if ($Action -ceq 'Prepare') {
VerifyPassiveContext
if (Test-Path -LiteralPath $activation) { throw 'Already began publication' }
BuildSuccessor
Write-Output "Prepared successor profile from independent passive service proofs $id"
return
}
$prepared=LoadRecord 'profile-prepared'
CheckPrepared
if ($Action -ceq 'FinishStarts') { FinishPublication;return }
VerifyPassiveContext
$held=LoadRecord 'profile-independent-native-read'
if (!(JsonEqual $held.agent (LiveRole 'agent' $newHashes.agent)) -or
!(JsonEqual $held.helper (LiveRole 'helper' $helperHash)) -or
!(JsonEqual $held.device (PreservedDevice)) -or !(JsonEqual $prepared.predecessor (FileIdentity $target))) {
throw 'Positive, unchanged passive pair and original time profile required before publication'
}
Record 'profile-publish-intent' ([ordered]@{id=$id;utc=[DateTime]::UtcNow.ToString('o');prepared_sha256=(Hash $ready)})
StopKnownRole 'agent' $agentName $held.agent 'time'
StopKnownRole 'helper' $helperName $held.helper 'time'
$locations.Add('time',$target)
SwapFile 'time' (Join-Path $work 'new-time-profile') $prepared.predecessor $prepared.successor_sha256 'time'
$locations.Remove('time')
FinishPublication
@@ -0,0 +1,215 @@
#requires -Version 5.1
#requires -RunAsAdministrator
[CmdletBinding()]
param([Parameter(Mandatory)][ValidateSet('Inspect','Prepare','Activate','Readback')][string]$Mode)
$ErrorActionPreference = 'Stop'
$caseId = '49c230d8-fb5d-4c64-96b6-e0edce03ed90'
$boot = 'C:\ProgramData\RustDiscoveryBootstrap'
$case = Join-Path $boot "job-config-$caseId"
$root = 'C:\ProgramData\RustDiscovery'
$state = Join-Path $root 'state'
$config = Join-Path $root 'config.json'
$binding = Join-Path $root 'binding.json'
$jobs = Join-Path $state 'jobs'
$systemRoot = 'C:\ProgramData\RustDiscoverySystem'
$pin = Join-Path $systemRoot 'agent-pin.json'
$clock = Join-Path $systemRoot 'time-attestation.json'
$image = 'C:\Program Files\RustDiscovery\rmm-agent-windows.exe'
$helperImage = 'C:\Program Files\RustDiscovery\rmm-helper-windows.exe'
$oldConfig = '7c9f6f3642ef84337c3cd761d8a4788c4babe81522fdd987a3eb9b819bc8d851'
$oldConfigAcl = '014e89cc8674259dd9ac7f490ffef056b85ada96c6e3574c23f27668b7a9b991'
$expectedBinding = '9239ee9f4142735867e77451478bf309fbf449d730a0ede6c958bc8018830dde'
$oldAgent = '0549d9ebea73cff996938f859b92192cc333de194128d7c6859a3f1d2e85893c'
$newAgent = 'df80b00fc2119b973d690053b9f9e4bdedd8fbc211f67599c3301eeb42e7702f'
$helper = '59675a3cbb3a5d213fc764f38379d6b81baaf9d47a7124470cc2767d4985763e'
$agentSid = ([Security.Principal.NTAccount]::new('NT SERVICE','RmmDiscoveryWindows')).Translate([Security.Principal.SecurityIdentifier]).Value
$utf8 = [Text.UTF8Encoding]::new($false,$true)
$sidType = [Security.Principal.SecurityIdentifier]
$admins = @('S-1-5-18','S-1-5-32-544')
$ready = Join-Path $case 'prepared.json'
$entered = Join-Path $case 'activation-intent.json'
$done = Join-Path $case 'activated.json'
$candidate = Join-Path $case 'job-config.candidate.json'
$original = Join-Path $case 'passive-config.original.json'
$publicBinding = Join-Path $case 'public-binding.json'
$next = Join-Path $root "config-$caseId.next"
$backup = Join-Path $case 'replaced.original.json'
function Assert-NormalPath([string]$Path,[bool]$Directory) {
$item = Get-Item -LiteralPath $Path -Force
if ($item.PSIsContainer -ne $Directory) { throw "Unerwarteter Pfadtyp: $Path" }
while ($null -ne $item) {
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -ne 0) { throw "Reparsepunkt: $Path" }
if ($item -is [IO.FileInfo]) { $item = $item.Directory } else { $item = $item.Parent }
}
}
function Get-PublicHash([string]$Path) {
Assert-NormalPath $Path $false
return (Get-FileHash -LiteralPath $Path -Algorithm SHA256).Hash.ToLowerInvariant()
}
function Get-BytesDigest([byte[]]$Bytes) {
$alg = [Security.Cryptography.SHA256]::Create()
try { return [BitConverter]::ToString($alg.ComputeHash($Bytes)).Replace('-','').ToLowerInvariant() }
finally { $alg.Dispose() }
}
function Assert-DirectoryAcl([string]$Path,[bool]$AgentCanRead) {
Assert-NormalPath $Path $true
$acl = Get-Acl -LiteralPath $Path
if ($acl.GetOwner($sidType).Value -notin $admins) { throw "Verzeichniseigentuemer: $Path" }
$rules = @($acl.GetAccessRules($true,$true,$sidType))
if (!$rules.Count) { throw "Leere DACL: $Path" }
foreach ($rule in $rules) {
$sid = $rule.IdentityReference.Value
if ($rule.AccessControlType -ne 'Allow' -or
($sid -notin $admins -and !($AgentCanRead -and $sid -ceq $agentSid -and
(([long]$rule.FileSystemRights -band (-bnot 0x1200a9)) -eq 0)))) { throw "Verzeichnisrechte: $Path" }
}
}
function Write-Once([string]$Path,[byte[]]$Bytes,[Security.AccessControl.FileSecurity]$Acl) {
if ($null -eq $Acl) {
$stream = [IO.File]::Open($Path,'CreateNew','Write','None')
} else {
$stream = [IO.FileStream]::new($Path,[IO.FileMode]::CreateNew,[Security.AccessControl.FileSystemRights]::Write,
[IO.FileShare]::None,4096,[IO.FileOptions]::WriteThrough,$Acl)
}
try { $stream.Write($Bytes,0,$Bytes.Length); $stream.Flush($true) } finally { $stream.Dispose() }
}
function Save-Record([string]$Path,$Record) {
Write-Once $Path ($utf8.GetBytes(($Record | ConvertTo-Json -Depth 8 -Compress))) $null
}
function Read-PublicJson([string]$Path) {
Assert-NormalPath $Path $false
if ((Get-Item -LiteralPath $Path).Length -gt 32768) { throw "Datei zu gross: $Path" }
return ($utf8.GetString([IO.File]::ReadAllBytes($Path)) | ConvertFrom-Json)
}
function Get-OriginalAcl {
$acl = Get-Acl -LiteralPath $config
if ((Get-BytesDigest ($utf8.GetBytes($acl.Sddl))) -cne $oldConfigAcl) { throw 'Originale Konfigurations-DACL abweichend' }
return $acl
}
function Assert-FileAcl([string]$Path,$Expected) {
$sections = [Security.AccessControl.AccessControlSections]'Owner,Group,Access'
$actual = (Get-Acl -LiteralPath $Path).GetSecurityDescriptorSddlForm($sections)
$wanted = $Expected.GetSecurityDescriptorSddlForm($sections)
# File creation can omit the auto-inherited marker on this VM. Owner,
# group, protected DACL, access masks and ACE sequence must all match.
if ($actual -cne $wanted -and $actual -cne $wanted.Replace('D:PAI(', 'D:P(')) {
throw "Dateiberechtigungen abweichend: $Path"
}
}
function Get-ConfigurationInputs {
if ((Get-PublicHash $config) -cne $oldConfig) { throw 'Passive Originalkonfiguration abweichend' }
$null = Get-OriginalAcl
$value = Read-PublicJson $config
$names = @($value.PSObject.Properties.Name | Sort-Object)
if (($names -join ',') -cne 'ca_file,connect_address,enrollment_token_file,server_name,state_directory,transport' -or
$value.server_name -cne 'discovery.ease-technologies.de' -or $value.state_directory -ine $state -or $value.transport -cne 'auto') {
throw 'Unerwartete passive Konfigurationsfelder'
}
$value | Add-Member -NotePropertyName job_binding_file -NotePropertyValue $binding
$value | Add-Member -NotePropertyName enable_jobs -NotePropertyValue $true
$value | Add-Member -NotePropertyName windows_execution_profile -NotePropertyValue 'powershell_51_remote_signed'
$peer = Read-PublicJson $pin
$b = $peer.binding
$canonical = [ordered]@{agent_id=$b.agent_id;asset_id=$b.asset_id;assignment_version=$b.assignment_version;
enrollment_generation=$b.enrollment_generation;public_key_hex=$b.public_key_hex;tenant_id=$b.tenant_id}
$bindingBytes = $utf8.GetBytes(($canonical | ConvertTo-Json -Compress))
if ((Get-BytesDigest $bindingBytes) -cne $expectedBinding) { throw 'Oeffentliche Jobbindung abweichend' }
return @{config=$utf8.GetBytes(($value | ConvertTo-Json -Compress)); binding=$bindingBytes}
}
function Get-JobsAcl {
$acl = [Security.AccessControl.DirectorySecurity]::new()
$acl.SetSecurityDescriptorSddlForm("O:BAG:BAD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1301bf;;;$agentSid)")
return $acl
}
function Assert-JobsAcl {
Assert-NormalPath $jobs $true
$acl = Get-Acl -LiteralPath $jobs
if (!$acl.AreAccessRulesProtected -or $acl.GetOwner($sidType).Value -notin $admins) { throw 'Jobverzeichnis nicht geschuetzt' }
$expected = (Get-JobsAcl).GetAccessRules($true,$false,$sidType)
$rules = $acl.GetAccessRules($true,$true,$sidType)
if ($rules.Count -ne $expected.Count) { throw 'Job-DACL Anzahl' }
foreach ($e in $expected) {
$match = @($rules | Where-Object { !$_.IsInherited -and $_.IdentityReference.Value -ceq $e.IdentityReference.Value -and
$_.FileSystemRights -eq $e.FileSystemRights -and $_.AccessControlType -eq $e.AccessControlType -and
$_.InheritanceFlags -eq $e.InheritanceFlags -and $_.PropagationFlags -eq $e.PropagationFlags })
if ($match.Count -ne 1) { throw 'Job-DACL abweichend' }
}
}
function Get-Readback {
$files = [ordered]@{}
foreach ($p in @($config,$binding,$candidate,$publicBinding,$original,$next,$backup,$ready,$entered,$done,$image,$helperImage,$clock)) {
$files[$p] = if ([IO.File]::Exists($p)) { Get-PublicHash $p } else { $null }
}
$jobsAcl = $null
if (Test-Path -LiteralPath $jobs) {
try { Assert-JobsAcl; $jobsAcl = $true } catch { $jobsAcl = $false }
}
$aclHashes = [ordered]@{}
foreach ($p in @($root,$state,$config,$binding,$jobs,$case)) {
if (Test-Path -LiteralPath $p) {
Assert-NormalPath $p ([IO.Directory]::Exists($p))
$aclHashes[$p] = Get-BytesDigest ($utf8.GetBytes((Get-Acl -LiteralPath $p).Sddl))
}
}
$live = Read-PublicJson $config
return [ordered]@{case_id=$caseId; agent_state=[string](Get-Service RmmDiscoveryWindows).Status;
helper_state=[string](Get-Service RmmDiscoverySystemHelper).Status; files=$files;
acl_sha256=$aclHashes; job_profile=$live.windows_execution_profile; jobs_enabled=($live.enable_jobs -eq $true);
binding_path_matches=($live.job_binding_file -ceq $binding);
jobs_directory=[IO.Directory]::Exists($jobs); jobs_acl_verified=$jobsAcl}
}
Assert-DirectoryAcl $boot $false
Assert-DirectoryAcl $root $true
Assert-NormalPath $state $true
if (Test-Path -LiteralPath $case) { Assert-DirectoryAcl $case $false }
if ($Mode -in @('Inspect','Readback')) { Get-Readback | ConvertTo-Json -Depth 5; return }
if ((Get-PublicHash $helperImage) -cne $helper) { throw 'Helper-Build abweichend' }
$inputs = Get-ConfigurationInputs
$configHash = Get-BytesDigest $inputs.config
foreach ($p in @($jobs,$binding,$next,$backup,$entered,$done)) {
if (Test-Path -LiteralPath $p) { throw 'Frueherer oder teilweiser Wechsel: Readback verwenden' }
}
if ($Mode -eq 'Prepare') {
if ((Get-PublicHash $image) -cne $oldAgent -or (Get-Service RmmDiscoveryWindows).Status -ne 'Running') { throw 'Passiver Ausgangsagent erforderlich' }
if (Test-Path -LiteralPath $case) { throw 'Vorhandener Vorbereitungsfall: Readback verwenden' }
$caseAcl = [Security.AccessControl.DirectorySecurity]::new()
$caseAcl.SetSecurityDescriptorSddlForm('O:BAG:BAD:P(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)')
$null = [IO.Directory]::CreateDirectory($case,$caseAcl)
Assert-DirectoryAcl $case $false
Write-Once $original ([IO.File]::ReadAllBytes($config)) $null
Write-Once $candidate $inputs.config $null
Write-Once $publicBinding $inputs.binding $null
if ((Get-PublicHash $candidate) -cne $configHash -or (Get-PublicHash $original) -cne $oldConfig -or
(Get-PublicHash $publicBinding) -cne $expectedBinding) { throw 'Vorbereitungsdateien abweichend' }
Save-Record $ready @{case_id=$caseId; config_sha256=$configHash; original_sha256=$oldConfig; binding_sha256=$expectedBinding}
Get-Readback | ConvertTo-Json -Depth 5
return
}
$prepared = Read-PublicJson $ready
if ($prepared.case_id -cne $caseId -or $prepared.config_sha256 -cne $configHash -or
(Get-PublicHash $candidate) -cne $configHash -or (Get-PublicHash $original) -cne $oldConfig -or
(Get-PublicHash $publicBinding) -cne $expectedBinding) { throw 'Vorbereitungsbeleg abweichend' }
if ((Get-PublicHash $image) -cne $newAgent -or (Get-Service RmmDiscoveryWindows).Status -ne 'Stopped') { throw 'Neues Agentimage und gestoppter Dienst erforderlich' }
$peer = Read-PublicJson $pin
$time = Read-PublicJson $clock
$roles = @($time.trusted_os_active_guest.qualifications)
if ($peer.agent.binary_sha256 -cne $newAgent -or $peer.helper.binary_sha256 -cne $helper -or
$roles.Count -ne 2 -or @($roles | Where-Object { $_.role -ceq 'agent' -and $_.binary_sha256 -ceq $newAgent }).Count -ne 1 -or
@($roles | Where-Object { $_.role -ceq 'system_helper' -and $_.binary_sha256 -ceq $helper }).Count -ne 1) { throw 'Paar-Pins und Zeitprofil abweichend' }
$acl = Get-OriginalAcl
Save-Record $entered @{case_id=$caseId; utc=[DateTime]::UtcNow.ToString('o'); config_sha256=$configHash; binding_sha256=$expectedBinding}
Write-Once $binding $inputs.binding $acl
Assert-FileAcl $binding $acl
$null = [IO.Directory]::CreateDirectory($jobs,(Get-JobsAcl))
Assert-JobsAcl
Write-Once $next $inputs.config $acl
Assert-FileAcl $next $acl
if ((Get-PublicHash $binding) -cne $expectedBinding -or (Get-PublicHash $next) -cne $configHash -or
(Get-PublicHash $config) -cne $oldConfig) { throw 'Vor Austausch unerwartete Dateien' }
[IO.File]::Replace($next,$config,$backup,$false)
Assert-FileAcl $config $acl
if ((Get-PublicHash $config) -cne $configHash -or (Get-PublicHash $backup) -cne $oldConfig) { throw 'Konfigurationswechsel nicht bestaetigt' }
Save-Record $done @{case_id=$caseId; utc=[DateTime]::UtcNow.ToString('o'); config_sha256=$configHash; binding_sha256=$expectedBinding}
Get-Readback | ConvertTo-Json -Depth 5
+278
View File
@@ -0,0 +1,278 @@
#requires -Version 5.1
#requires -RunAsAdministrator
# Fixed console maintenance of the passive test guest. No queue, network, or script job.
[CmdletBinding()]
param([Parameter(Mandatory)][ValidateSet('Prepare','InstallPassive','Read','RestorePrevious')][string]$Mode)
$ErrorActionPreference = 'Stop'
$originalCase = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf'
$originalHash = 'd8b4fd4fd9ca5310cc1591ce3c2ccae5bd72a2ade43b21a8187cfdfb960b3427'
$bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap'
$oldFolder = Join-Path $bootstrap "time-profile-$originalCase"
$original = Join-Path (Join-Path $bootstrap $originalHash) 'InstallPublicTimeProfile.ps1'
$raw = [IO.File]::ReadAllBytes($original)
$digest = [Security.Cryptography.SHA256]::Create()
try { $actual = [BitConverter]::ToString($digest.ComputeHash($raw)).Replace('-','') }
finally { $digest.Dispose() }
if ($actual -ne $originalHash) { throw 'Original controller hash changed' }
$src = [Text.Encoding]::UTF8.GetString($raw)
$boundary = "`nCheckControl `$boot `$true`n"
$end = $src.IndexOf($boundary,[StringComparison]::Ordinal)
if ($end -le 0 -or $end -ne $src.LastIndexOf($boundary,[StringComparison]::Ordinal)) {
throw 'Expected the original fixed definition boundary'
}
$originalIntent = Get-Content -LiteralPath (Join-Path $oldFolder 'intent.json') -Raw | ConvertFrom-Json
if ($originalIntent.id -cne $originalCase -or $originalIntent.request.script_sha256 -cne $originalHash) {
throw 'Unexpected original case'
}
$global:RmmTimeProfilePayload = $originalIntent.request
. ([scriptblock]::Create($src.Substring(0,$end)))
$id = '49c230d8-fb5d-4c64-96b6-e0edce03ed90'
$work = Join-Path $boot "job-passive-pair-$id"
$oldHashes = [ordered]@{
agent='0549d9ebea73cff996938f859b92192cc333de194128d7c6859a3f1d2e85893c'
settings='bbccd710fd564eb5ad57eec5732b413359d09bcb5953f5de9501ccfe826bd3c2'
pin='66ef481bd9ded320d6f3dcc82b0ddaf34fdef7d80ac15d06820ff7da75a18c56'
}
$newHashes = [ordered]@{
agent='df80b00fc2119b973d690053b9f9e4bdedd8fbc211f67599c3301eeb42e7702f'
settings='7172456d56a55cced2f6ed4af1e9141499f09e67cbb16db32e2308396f9de929'
pin='b9517517cec801b10adb5d53e470fc143b8909c45e3bb95b8e4a34281f303623'
}
$locations = [ordered]@{agent=$agentBinary;settings=$settings;pin=$pin}
$profileHash = '2b4a8a7080770304b80e2a665fa5f5ee1ebbd9182e7c80b184e75b114575b42b'
$helperHash = '59675a3cbb3a5d213fc764f38379d6b81baaf9d47a7124470cc2767d4985763e'
$configHash = '7c9f6f3642ef84337c3cd761d8a4788c4babe81522fdd987a3eb9b819bc8d851'
$source = Join-Path (Join-Path $boot $newHashes.agent) 'rmm-agent-windows.exe'
CheckControl $boot $true
CheckControl $oldFolder $true
if ((Hash (Join-Path $oldFolder 'console-resume-empty-result.json')) -cne '62a04be9c7d08d3687b51eacd6adbe290b91e16ba934d6b5bb531e8764a56cf5') {
throw 'Unexpected original publication result'
}
function Marker($name) { Join-Path $work ($name+'.json') }
function Record($name,$value) { WriteNew (Marker $name) $value }
function LoadRecord($name) {
$path = Marker $name
CheckControl $path $false
return (Get-Content -LiteralPath $path -Raw | ConvertFrom-Json)
}
function VerifyPassiveContext {
if ((Hash $config) -cne $configHash -or (Hash $target) -cne $profileHash -or
(Hash $helperBinary) -cne $helperHash) { throw 'Passive config, predecessor time profile or unchanged helper differs' }
foreach ($dir in @((Split-Path $agentBinary),$agentRoot,$helperRoot)) { $null=ReadAcl $dir $true }
foreach ($file in @($config,$settings,$pin,$target,$agentBinary,$helperBinary)) { $null=ReadAcl $file $false }
$unitProof=Join-Path $boot 'profile-unit-fcec400-result.json'
CheckControl $unitProof $false
if ((Hash $unitProof) -cne '48de474d842ebc87550ba2e27b66086e6aa573973f252f4b8e19ac7b12b75a63') {
throw 'Current native Windows profile unit receipt differs'
}
}
function CurrentFiles {
$files=[ordered]@{}
foreach ($name in $locations.Keys) { $files[$name]=FileIdentity $locations[$name] }
return $files
}
function VerifyFiles($files,$hashes) {
foreach ($name in $locations.Keys) {
if ($files.$name.sha256 -cne $hashes.$name) { throw "Unexpected $name bytes" }
}
}
function LiveRole($role,$expectedHash) {
$s=Service $role
if ($s.state -cne 'Running') { throw "$role must be running" }
$handle=[RmmPipeNative]::Open([int]$s.pid)
try {
$k=Kernel $role $s $handle
$f=FileIdentity $k.image
if ($f.sha256 -cne $expectedHash -or !(JsonEqual $s (Service $role)) -or ![RmmPipeNative]::Alive($handle)) {
throw "$role generation or image changed"
}
return [ordered]@{service=$s; kernel=$k; image_file=$f}
} finally { $handle.Dispose() }
}
function PreservedDevice {
return [ordered]@{
config=(FileIdentity $config)
identity=(FileIdentity (Join-Path $agentState 'identity.json') $true)
certificate=(FileIdentity (Join-Path $agentState 'device.pem') $true)
private_key_metadata=(FileIdentityMetadata (Join-Path $agentState 'device.key'))
helper=(FileIdentity $helperBinary)
time_profile=(FileIdentity $target)
}
}
function FlushFile($path) {
$f=[IO.File]::Open($path,'Open','ReadWrite','Read')
try { $f.Flush($true) } finally { $f.Dispose() }
}
function StopKnownRole($role,$name,$bound,$prefix) {
$s=Service $role
if (!(JsonEqual $s $bound.service)) { throw "$role changed before stop" }
$h=[RmmPipeNative]::Open([int]$s.pid)
try {
if (!(JsonEqual (Kernel $role $s $h) $bound.kernel)) { throw 'Kernel role changed' }
Record ($prefix+'-stop-'+$role) $bound
Stop-Service -Name $name
(Get-Service -Name $name).WaitForStatus('Stopped',[TimeSpan]::FromSeconds(30))
if (![RmmPipeNative]::Exited($h,5000)) { throw "$role did not exit" }
} finally { $h.Dispose() }
}
function StopCheck {
if ((Service 'agent').state -cne 'Stopped' -or (Service 'helper').state -cne 'Stopped') {
throw 'Both services must be stopped'
}
}
function SwapFile($name,$inputPath,$oldId,$newHash,$prefix) {
StopCheck
$dest=$locations[$name]
$backup=Join-Path $work ($prefix+'-replaced-'+$name)
$stage=Join-Path $work ($prefix+'-stage-'+$name)
CheckControl $inputPath $false
if (!(JsonEqual $oldId (FileIdentity $dest)) -or (Hash $inputPath) -cne $newHash -or (Test-Path -LiteralPath $backup)) {
throw "Replacement precondition $name"
}
[IO.File]::Copy($inputPath,$stage,$false)
FlushFile $stage
$candidate=FileIdentity $stage
if ($candidate.sha256 -cne $newHash -or $candidate.volume_serial -cne $oldId.volume_serial) { throw 'Invalid same-volume candidate' }
$originalAcl=Get-Acl -LiteralPath $dest
Record ($prefix+'-replace-'+$name) ([ordered]@{previous=$oldId;candidate=$candidate})
if (!(JsonEqual $oldId (FileIdentity $dest)) -or !(JsonEqual $candidate (FileIdentity $stage))) { throw 'Changed replacement identities' }
[IO.File]::Replace($stage,$dest,$backup)
$privateAcl=New-Object Security.AccessControl.FileSecurity
$privateAcl.SetSecurityDescriptorSddlForm('O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)')
Set-Acl -LiteralPath $backup -AclObject $privateAcl
CheckControl $backup $false
if ((AclHash $dest) -cne $oldId.acl_sha256) {
Set-Acl -LiteralPath $dest -AclObject $originalAcl
}
FlushFile $dest
$new=FileIdentity $dest
if ($new.sha256 -cne $newHash -or $new.acl_sha256 -cne $oldId.acl_sha256 -or (Hash $backup) -cne $oldId.sha256) {
throw "Replacement readback $name"
}
Record ($prefix+'-installed-'+$name) $new
}
function StartKnownRole($role,$name,$hash,$prefix) {
if ((Service $role).state -cne 'Stopped') { throw "$role not stopped" }
Record ($prefix+'-start-'+$role) @{old_state='Stopped';expected_hash=$hash}
Start-Service -Name $name
(Get-Service -Name $name).WaitForStatus('Running',[TimeSpan]::FromSeconds(30))
Record ($prefix+'-started-'+$role) (LiveRole $role $hash)
}
function PrepareFiles($before) {
CheckControl (Split-Path $source) $true
CheckControl $source $false
if ((FileIdentity $source).sha256 -cne $newHashes.agent) { throw 'New agent hash' }
foreach ($name in $locations.Keys) {
$copy=Join-Path $work ('old-'+$name)
[IO.File]::Copy($locations[$name],$copy,$false)
# Copy can retain the source descriptor. Restrict backups to the case.
$acl=New-Object Security.AccessControl.FileSecurity
$acl.SetSecurityDescriptorSddlForm('O:BAG:BAD:P(A;;FA;;;SY)(A;;FA;;;BA)')
Set-Acl -LiteralPath $copy -AclObject $acl
CheckControl $copy $false
FlushFile $copy
if ((Hash $copy) -cne $oldHashes.$name) { throw "Backup $name" }
}
$utf8=[Text.UTF8Encoding]::new($false,$true)
foreach ($name in @('settings','pin')) {
$data=$utf8.GetString([IO.File]::ReadAllBytes($locations[$name])).Replace($oldHashes.agent,$newHashes.agent)
if ($name -eq 'pin') { $data=$data.Replace($oldHashes.settings,$newHashes.settings) }
$path=Join-Path $work ('new-'+$name)
WriteBytes $path ($utf8.GetBytes($data))
if ((Hash $path) -cne $newHashes.$name) { throw "Closed successor bytes $name" }
}
if (!(JsonEqual $before (CurrentFiles))) { throw 'Original inputs changed during copy' }
}
if ($Mode -eq 'Read') {
$r=[ordered]@{id=$id;mode='read_only';files=(CurrentFiles);agent=(Service 'agent');helper=(Service 'helper');markers=@()}
if (Test-Path -LiteralPath $work) {
CheckControl $work $true
$r.markers=@(Get-ChildItem -LiteralPath $work -Filter '*.json' -File | Select-Object -ExpandProperty Name)
if ((Test-Path -LiteralPath (Marker 'installed')) -and $r.files.agent.sha256 -ceq $newHashes.agent -and
$r.agent.state -ceq 'Running' -and $r.helper.state -ceq 'Running') {
$r.new_agent=LiveRole 'agent' $newHashes.agent
$r.unchanged_helper=LiveRole 'helper' $helperHash
}
}
$r|ConvertTo-Json -Depth 12 -Compress
return
}
VerifyPassiveContext
if ($Mode -eq 'Prepare') {
$before=CurrentFiles
VerifyFiles $before $oldHashes
$agent=LiveRole 'agent' $oldHashes.agent
$helper=LiveRole 'helper' $helperHash
$device=PreservedDevice
CheckControl (Split-Path $source) $true
CheckControl $source $false
if ((Hash $source) -cne $newHashes.agent) { throw 'Candidate absent or incorrect before preparation' }
[RmmTimeProfileCase]::CreatePrivateOnce($work)
CheckControl $work $true
PrepareFiles $before
Record 'prepared' ([ordered]@{id=$id;utc=[DateTime]::UtcNow.ToString('o');files=$before;device=$device;agent=$agent;helper=$helper})
Write-Output "Prepared passive pair $id"
return
}
CheckControl $work $true
$prep=LoadRecord 'prepared'
if ($prep.id -cne $id -or !(JsonEqual $prep.device (PreservedDevice))) { throw 'Prepared case or preserved device changed' }
if ($Mode -eq 'InstallPassive') {
if (!(JsonEqual $prep.files (CurrentFiles)) -or !(JsonEqual $prep.agent (LiveRole 'agent' $oldHashes.agent)) -or
!(JsonEqual $prep.helper (LiveRole 'helper' $helperHash))) { throw 'Prepared baseline changed' }
foreach ($name in $locations.Keys) {
if ((Hash (Join-Path $work ('old-'+$name))) -cne $oldHashes.$name) { throw 'Recovery backup changed' }
}
foreach ($name in @('settings','pin')) {
if ((Hash (Join-Path $work ('new-'+$name))) -cne $newHashes.$name) { throw 'Prepared successor changed' }
}
CheckControl $source $false
if ((Hash $source) -cne $newHashes.agent) { throw 'New binary changed' }
Record 'install-intent' @{id=$id;utc=[DateTime]::UtcNow.ToString('o')}
StopKnownRole 'agent' $agentName $prep.agent 'install'
StopKnownRole 'helper' $helperName $prep.helper 'install'
foreach ($name in $locations.Keys) {
$inputPath=Join-Path $work ('new-'+$name)
if ($name -eq 'agent') { $inputPath=$source }
SwapFile $name $inputPath $prep.files.$name $newHashes.$name 'install'
}
VerifyFiles (CurrentFiles) $newHashes
StartKnownRole 'helper' $helperName $helperHash 'install'
StartKnownRole 'agent' $agentName $newHashes.agent 'install'
$a=LiveRole 'agent' $newHashes.agent
$h=LiveRole 'helper' $helperHash
if (!(JsonEqual $prep.device (PreservedDevice))) { throw 'Device changed after passive restart' }
Record 'installed' ([ordered]@{id=$id;utc=[DateTime]::UtcNow.ToString('o');agent=$a;helper=$h;files=(CurrentFiles);device=$prep.device;job_mode=$false;clock_qualified=$false})
Write-Output "Installed passive pair $id"
return
}
# An explicit recovery is valid only before publishing any successor time profile
# or enabling jobs. Verify all present files against the two known generations.
$null=LoadRecord 'install-intent'
$observed=CurrentFiles
foreach ($name in $locations.Keys) {
$hash=$observed.$name.sha256
if ($hash -cnotin @($oldHashes.$name,$newHashes.$name) -or
(Hash (Join-Path $work ('old-'+$name))) -cne $oldHashes.$name) { throw "Unknown recovery input $name" }
}
Record 'restore-intent' @{id=$id;utc=[DateTime]::UtcNow.ToString('o')}
foreach ($role in @('agent','helper')) {
$service=(Service $role)
$name=$agentName
$imageHash=$observed.agent.sha256
if ($role -eq 'helper') { $name=$helperName; $imageHash=$helperHash }
if ($service.state -ceq 'Running') { StopKnownRole $role $name (LiveRole $role $imageHash) 'restore' }
elseif ($service.state -cne 'Stopped') { throw "Unknown service transition $role" }
}
StopCheck
foreach ($name in $locations.Keys) {
if ($observed.$name.sha256 -cne $oldHashes.$name) {
SwapFile $name (Join-Path $work ('old-'+$name)) $observed.$name $oldHashes.$name 'restore'
}
}
VerifyFiles (CurrentFiles) $oldHashes
StartKnownRole 'helper' $helperName $helperHash 'restore'
StartKnownRole 'agent' $agentName $oldHashes.agent 'restore'
Record 'restored' @{id=$id;agent=(LiveRole 'agent' $oldHashes.agent);helper=(LiveRole 'helper' $helperHash)}
Write-Output "Restored passive predecessor $id"
@@ -0,0 +1,100 @@
#requires -Version 5.1
#requires -RunAsAdministrator
[CmdletBinding()]
param()
$ErrorActionPreference = 'Stop'
function Assert-PrivateUnitPath([string]$Path, [bool]$Directory) {
$item = Get-Item -LiteralPath $Path -Force
if ($item.PSIsContainer -ne $Directory -or ($item.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
throw 'Unexpected unit path type'
}
$acl = Get-Acl -LiteralPath $Path
$trusted = @('S-1-5-18', 'S-1-5-32-544')
$sidType = [Security.Principal.SecurityIdentifier]
if ($acl.GetOwner($sidType).Value -notin $trusted) { throw 'Unexpected unit path owner' }
$rules = @($acl.GetAccessRules($true, $true, $sidType))
if (!$rules.Count) { throw 'Missing unit path ACL' }
foreach ($rule in $rules) {
if ($rule.AccessControlType -ne 'Allow' -or $rule.IdentityReference.Value -notin $trusted) {
throw 'Unexpected unit path ACL'
}
}
}
$bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap'
$unit = Join-Path $PSScriptRoot 'rmm_agent_windows-9b3e91d827c6ff16.exe'
$unitHash = '7d1715dc105c1eb482405511e1b3abf4437c448e186e73923c43dd3c7938710e'
$test = 'runtime::tests::remote_signed_requires_explicit_profile_jobs_and_binding'
if ((Split-Path -Parent $PSScriptRoot) -ne $bootstrap) { throw 'Private bootstrap directory required' }
Assert-PrivateUnitPath $bootstrap $true
Assert-PrivateUnitPath $PSScriptRoot $true
Assert-PrivateUnitPath $PSCommandPath $false
Assert-PrivateUnitPath $unit $false
foreach ($entry in (Get-ChildItem -LiteralPath $PSScriptRoot -Force)) {
if ($entry.Name -notin @([IO.Path]::GetFileName($PSCommandPath), [IO.Path]::GetFileName($unit))) {
throw 'Unit staging directory must contain only the runner and the unit executable'
}
}
$system32 = [Environment]::SystemDirectory
$shell = Join-Path $system32 'WindowsPowerShell\v1.0\powershell.exe'
if (![Environment]::Is64BitProcess -or [Diagnostics.Process]::GetCurrentProcess().MainModule.FileName -ne $shell -or
$PSVersionTable.PSEdition -ne 'Desktop' -or $PSVersionTable.PSVersion.Major -ne 5 -or $PSVersionTable.PSVersion.Minor -ne 1) {
throw 'Run with the installed 64-bit Windows PowerShell 5.1'
}
$policies = [ordered]@{}
foreach ($scope in 'MachinePolicy','UserPolicy','Process','CurrentUser','LocalMachine') {
$policies[$scope] = [string](Microsoft.PowerShell.Security\Get-ExecutionPolicy -Scope $scope)
}
$handle = [IO.File]::Open($unit, 'Open', 'Read', 'Read')
try {
$hasher = [Security.Cryptography.SHA256]::Create()
try { $actual = [BitConverter]::ToString($hasher.ComputeHash($handle)).Replace('-','').ToLowerInvariant() }
finally { $hasher.Dispose() }
if ($actual -cne $unitHash -or $handle.Length -ne 18608199) { throw 'Unexpected unit executable' }
$start = New-Object Diagnostics.ProcessStartInfo
$start.FileName = $unit
$start.Arguments = "--exact $test --test-threads=1 --color never"
$start.WorkingDirectory = $PSScriptRoot
$start.UseShellExecute = $false
$start.CreateNoWindow = $true
$start.RedirectStandardOutput = $true
$start.RedirectStandardError = $true
$start.EnvironmentVariables.Clear()
$windows = Split-Path -Parent $system32
$start.EnvironmentVariables['SystemRoot'] = $windows
$start.EnvironmentVariables['WINDIR'] = $windows
$start.EnvironmentVariables['SystemDrive'] = [IO.Path]::GetPathRoot($windows).TrimEnd('\')
$start.EnvironmentVariables['PATH'] = $system32
$proc = [Diagnostics.Process]::Start($start)
try {
$stdout = $proc.StandardOutput.ReadToEndAsync()
$stderr = $proc.StandardError.ReadToEndAsync()
if (!$proc.WaitForExit(30000)) {
$proc.Kill()
throw 'Fixed unit test timed out'
}
if (!$stdout.Wait(2000) -or !$stderr.Wait(2000) -or $proc.ExitCode -ne 0 -or $stderr.Result.Length -gt 0) {
throw 'Fixed unit test failed'
}
$lines = @($stdout.Result -split '\r?\n' | Where-Object { $_ })
if ($lines.Count -ne 3 -or $lines[0] -cne 'running 1 test' -or $lines[1] -cne "test $test ... ok" -or
$lines[2] -cnotmatch '^test result: ok\. 1 passed; 0 failed; 0 ignored; 0 measured; (\d+) filtered out; finished in \d+(?:\.\d+)?s$') {
throw 'Unexpected test result or filter count'
}
$filtered = [int]$Matches[1]
} finally { $proc.Dispose() }
} finally { $handle.Dispose() }
[ordered]@{
observed_at = [DateTimeOffset]::UtcNow.ToString('o')
unit_sha256 = $actual
test_name = $test
passed = 1
filtered_out = $filtered
powershell_path = $shell
powershell_sha256 = (Get-FileHash -LiteralPath $shell -Algorithm SHA256).Hash.ToLowerInvariant()
powershell_version = $PSVersionTable.PSVersion.ToString()
admin_host_policy_scopes = $policies
} | ConvertTo-Json -Depth 3 -Compress
+11 -5
View File
@@ -22,7 +22,7 @@ Image. MCP bestätigte zwei neue Windows-Heartbeats um **16:39:46 und
vor dem Dienstwechsel. Die Cloud-Linux-VM meldete sich weiterhin als online. vor dem Dienstwechsel. Die Cloud-Linux-VM meldete sich weiterhin als online.
[Dienstwechsel und Telemetrienachweis](windows-signed-clock-upgrade-plan.md) [Dienstwechsel und Telemetrienachweis](windows-signed-clock-upgrade-plan.md)
Die Erstinstallation des Windows-Zeitprofils ist offen. Der Server empfing um Die Erstinstallation des Windows-Zeitprofils ist auf der VM belegt. Der Server empfing zunächst um
17:05:36 Uhr MEZ den Fehlercode `0x80070020` beim Verschieben in das 17:05:36 Uhr MEZ den Fehlercode `0x80070020` beim Verschieben in das
Zielverzeichnis. Der Helper hält dort einen Verzeichnishandle, der diesen Zielverzeichnis. Der Helper hält dort einen Verzeichnishandle, der diesen
Schreibzugriff sperrt. Im korrigierten Quellstand erlauben die Handles für Schreibzugriff sperrt. Im korrigierten Quellstand erlauben die Handles für
@@ -32,10 +32,16 @@ Windows x86-64 gebaut; dieser Build ist noch nicht auf der VM installiert
oder dort abgenommen. Beim anschließenden Versuch um 20:24 Uhr MEZ konnte der Gast oder dort abgenommen. Beim anschließenden Versuch um 20:24 Uhr MEZ konnte der Gast
die neue Zieldatei öffnen. Der Sicherheitsdeskriptor entsprach beim Lesen die neue Zieldatei öffnen. Der Sicherheitsdeskriptor entsprach beim Lesen
nicht exakt dem erwarteten Wert. Der Controller stoppte vor dem Schreiben nicht exakt dem erwarteten Wert. Der Controller stoppte vor dem Schreiben
der Profilbytes. Zum Vergleich werden die erwartete und die aktuelle der Profilbytes. Die anschließende Konsolenlesung bestätigte 0 Byte.
Ziel-SDDL sowie die Dateigröße benötigt. Der erste signierte Zeitvergleich Eigentümer, Gruppe, DACL-Schutz und alle sechs expliziten Zugriffsregeln
in beiden laufenden Rollen und die Windows-Skript- und Paketabnahmen stimmten überein. Nur das DACL-Steuerbit für automatische Vererbung (`AI`)
stehen weiterhin aus. fehlte im gelesenen Deskriptor. Um 20:40 Uhr MEZ gelang der Abschluss.
Der Gast las die 1177 Profilbytes mit dem erwarteten SHA-256 und derselben
Dateikennung zurück, die er vor dem Schreiben festgehalten hatte.
Um 20:41 Uhr MEZ bestätigte der Projektserver die ersten zwei getrennten
signierten Zeitvergleiche des laufenden Agenten und SYSTEM-Helpers.
Die Windows-Skript- und Paketabnahmen stehen aus.
[Zeitbelege beider Dienste](windows-passive-time-closeout.md)
[VM-Fehlerbeleg und Buildprüfung](windows-time-profile-config.md) [VM-Fehlerbeleg und Buildprüfung](windows-time-profile-config.md)
Die passive Zertifikatserneuerung ist implementiert. Fünf Wiederanlauf- und Die passive Zertifikatserneuerung ist implementiert. Fünf Wiederanlauf- und
+21 -1
View File
@@ -1,7 +1,7 @@
# Lesender Abschluss zweier passiver Windows-Zeitbeobachtungen # Lesender Abschluss zweier passiver Windows-Zeitbeobachtungen
Der Collector `deploy/windows/passive_time_closeout.py` ist lokal vorbereitet Der Collector `deploy/windows/passive_time_closeout.py` ist lokal vorbereitet
und ausführbar. **Noch kein Zielaufruf oder nativer Abschlussnachweis.** Die und ausführbar. Der native Abschluss über den auf dem Server laufenden Empfänger ist unten dokumentiert. Die
V2-Profileinrichtung und ihr ausdrücklich gemeldetes Zeitfenster stehen vor V2-Profileinrichtung und ihr ausdrücklich gemeldetes Zeitfenster stehen vor
dem Aufruf. Tunnel-/Zugangserneuerung, Profileinrichtung und Dienstwartung sind dem Aufruf. Tunnel-/Zugangserneuerung, Profileinrichtung und Dienstwartung sind
keine Aktionen dieses Collectors. keine Aktionen dieses Collectors.
@@ -129,3 +129,23 @@ Pipeeingrenzung helfen. Sie enthalten keinen vollständigen Timeworkerfehler;
auch Metadaten vorhandener fester `.agent-time.pending`/`.helper-time.pending` auch Metadaten vorhandener fester `.agent-time.pending`/`.helper-time.pending`
können eine unterbrochene Publikation erklären. Dieser Collector liest oder können eine unterbrochene Publikation erklären. Dieser Collector liest oder
ändert diese zusätzlichen Dateien nicht und löst keine Diagnose aus. ändert diese zusätzlichen Dateien nicht und löst keine Diagnose aus.
### Nativer Abschluss am 15. November 2026
Der Empfänger auf dem permanenten Server prüfte um **20:41:27 Uhr MEZ**
beide nach der Veröffentlichung des Profils entstandenen Belege. Der Agent
beobachtete seinen Vergleich um `19:40:52.455414900Z`, der SYSTEM-Helper
seinen um `19:40:52.524631100Z`. Beide gehörten zu Verbindungsgeneration 145
und demselben Windows-Boot. Verifier-UUIDs und die Hashes der beiden
Anfragen und Antworten unterschieden sich. Der Agent hatte PID 4420, der
Helper PID 10264. Die Serverzeugen vor und nach der Lesung stimmten überein.
Fall `c23245b7-017e-4643-9872-849f262faf21`, Lesung 36. Der SHA-256 des
empfangenen Datensatzes lautet
`40d45a9cb3145f8b1159b7c5da0509dd043355aca23d4bec860f37205e3a8551`,
der des Abschlussbelegs
`f1a79eed223487fa61890ccb274986660b33f2596ae33e1689e9b2afdc7b8884`.
Beim separaten Rücklesen stimmten die zwei ursprünglichen Rollenberichte
mit den validierten Einträgen überein. Der Server führte weiterhin nur
`windows.base/1`, `heartbeat/1` und `agent.update/1`. Für einen späteren
Auftrag muss die Uhr beim Prüfen des Grants erneut die Frischegrenzen erfüllen.
+127
View File
@@ -63,3 +63,130 @@ Produktquellen erzwingen keine neue native Ausführung und verhindern ihren
Readback nicht. Neue Starts benötigen weiterhin die exakt qualifizierten Readback nicht. Neue Starts benötigen weiterhin die exakt qualifizierten
aktuellen Quellen. Vollständige Ausgaben/Transportfehler bleiben privat, aktuellen Quellen. Vollständige Ausgaben/Transportfehler bleiben privat,
Standardausgabe enthält nur Status, Fallkennung und Nachweishashes. Standardausgabe enthält nur Status, Fallkennung und Nachweishashes.
### MCP-Planprüfung nach dem nativen Zeitvergleich am 15. November 2026
Um 20:44 Uhr MEZ las MCP die Windows-VM über ihre bestehende Geräteidentität
als online. Sie meldete über WSS weiterhin `windows.base/1`, `heartbeat/1`
und `agent.update/1`. Ein erster lesender Vorabcheck brach vor der Planung
ab, weil er für diese passive Verbindung fälschlich `sync_ready=false`
erwartete. Der Gateway setzt beim Hello ohne `rmm.sync.v1` den Wert
`sync_required=false` und damit `sync_ready=true`. Ein signierter
Job-Sync ist daraus nicht abzuleiten.
Um 20:44:47 Uhr MEZ wies `operations.plan` für genau diese Windows-VM eine
PowerShell-Ausgabe einer festen Textzeile unter `agent_service` mit dem Profil
`powershell_51_remote_signed` als `UNSUPPORTED_CAPABILITY` zurück. Der
Windows-Agent veröffentlicht weder die Skript- noch die Profilfähigkeit.
Vor und nach der Plananfrage standen Jobs, Outbox-Einträge, Ausführungspermits
und offene Jobs dieses Geräts jeweils auf null. Es erfolgte kein Submit.
MCP-Korrelations-ID `b87605ab-69ce-4697-b9ed-9f5b1eeba22c`,
Beleg-SHA-256 `0df80d11f7e0ef5e300c4c9657dca3850dad839582b3ba945c1e69795fc68ecc`.
Für die erste erfolgreiche Skriptabnahme braucht der Dienst die an das Gerät
gebundene Jobkonfiguration, qualifizierte Profilfähigkeit, signierten
Auftragsabgleich und beim Start erneut frische Zeitbelege. Darauf folgt der
unveränderliche Antrag mit Genehmigung in der WebUI.
### Erster LocalService-Auftrag, Stand 15. November 2026, 21:44 Uhr MEZ
Der gemeinsame Abnahmelauf kennt jetzt den festen Fall `windows_hello`.
Er adressiert ausschließlich die bestehende Windows-Test-VM. Das Skript
`Write-Output 'Zeitprofil-Test'` und die erwartete Ausgabe enden jeweils
mit CRLF. Der Plan bindet `agent_service` und
`powershell_51_remote_signed`. Der Browser prüft diese Angaben am gespeicherten
Plan und die sichtbare Prozessoption vor der Freigabe. Der Ergebnisvergleich
fordert neben Exit 0 und vollständiger Ausgabe auch die LocalService-SID,
den Skripthash und den prozessgebundenen Policybeleg. Die vorhandenen
Prüfungen für das Pending, den Freigabeaudit und die Anzahl der Startpermits
gelten für diesen Fall.
Lokal bestanden beim Browser-Planvergleich ein positiver und elf negative
Fälle. Der Python-Lauf prüfte den festen Planinput, eine passende
Ergebnisquittung und neun abweichende Ergebnisse. Beim ersten lokalen
Negativlauf fing der Test eine andere Ausnahmeklasse ab als der Prüfer
warf. Der korrigierte Lauf mit dem gemeinsamen Abnahmefehler bestand.
Tatsächlich ausgeführt wurde
`python3 deploy/cloud_mvp_acceptance.py --case windows_hello --execute-dev-test-ui`.
Der Lauf stoppte vor der Planung bei `actual_vm_capability_required`.
Der gespeicherte MCP-Kontakt um 21:42:59 Uhr MEZ war online, die
Verbindungsgeneration betrug 146. Das Gerät meldete seine drei passiven
Fähigkeiten. Jobs, Outbox, Permits und offene Aufträge standen auf null.
SHA-256 des serverseitig nachgelesenen Zustands im lokalen Beleg
`fd0c9af5f4df03a655fcb491212eb62c7777182f02a4e0a69633e5602985943c`.
Um 21:44:08 Uhr MEZ bestätigte eine lesende Transaktion für dieselbe
Generation `sync_required=false`, `sync_ready=true`,
`helper_sync_ready=false` und null Sync-Checkpoints. Ein neuer Plan,
eine WebUI-Genehmigung und eine Windows-Ausführung stehen aus.
Der Browser erreichte um 21:46 Uhr MEZ die echte, private WebUI des
Projektservers über deren SSH-Weiterleitung mit TLS-Prüfung. Anmeldung,
sichtbare Kennzeichnung `SIMULIERT` und Abmeldung als
`simulated-testprincipal-a` gelangen. Die Sitzung meldete
`approval_origin=dev_test_browser_simulation` und `testsimulation=true`.
Der Server lieferte das Frontend-Bundle `index-CTgvl2jr.js` mit der
PowerShell-Profilanzeige. Der Browser öffnete und genehmigte bei diesem
Zugangscheck keinen Antrag.
### Cloud-Linux-Nachweis für die explizite Profilaktivierung
Am 15. November 2026 um 21:54:37 Uhr MEZ bestand auf der festgelegten
Cloud-Linux-VM der portable Test
`tests::remote_signed_requires_explicit_profile_jobs_and_binding`.
Die Konfigurationsdefinition, die Methode `profile_enabled` und der Test
stimmen als Quelltextabschnitte mit dem Windows-Agent in `fcec400` überein.
Mit dem Buildfeature `system-helper` akzeptiert die Konfiguration das
benannte Prozessprofil nur mit Job-Opt-in und Bindingpfad. Der Test
verweigerte einen fehlenden Opt-in, deaktivierten Jobbetrieb, einen
fehlenden Bindingpfad sowie ungültige Profilwerte einschließlich `Bypass`.
Die x86-64-Testdatei lief mit UID 65534, ohne ergänzende Gruppen, mit
`no_new_privs` und in einem eigenen Netzwerk-Namespace. Der Aufruf mit
exaktem Testnamen endete mit Exit 0, einem bestandenen Test, null
ausgefilterten Tests und leerem stderr. Der Bootstrap entfernte das
temporäre Testverzeichnis auf der VM. Der Test verwendete lokale
Konfigurations-Fixtures. Windows-Dateirechte, LocalService-Jobbetrieb und
die Genehmigung in der WebUI brauchen eigene Nachweise.
| Prüfgegenstand | SHA-256 |
| --- | --- |
| Originalquelle `runtime.rs` aus `fcec400` | `4f94cce2c0557436cef4ea5accffb4778af2a3faeb7339cea16592c30872b479` |
| Extrahierte Testquelle | `2f338af46f38ebe72471dbdc81b0416947a20000bfad18be5b2f626c5c8a5812` |
| Testmanifest | `df3fadfa8e94a710de99546c21b6b74635ac9ea70e8a157583ef7bae05cd76e8` |
| Linux-Testdatei | `2168e5a6c31e2349b67ad81bcc58a711c3e37a0f03b7fecf0ca24281c5b72b6b` |
| VM-Beleg im Fall `28fac5aa-66e4-466f-93fc-f97062031d43` | `ee3a2c99651491a2fd876f1a3463919dc32d9509d9f9ef4eb73a36aa848bb56d` |
### Native Windows-Profilprüfung des neuen Agenten
Am 15. November 2026 um 21:56:30 Uhr MEZ bestand auf der Windows-VM genau
`runtime::tests::remote_signed_requires_explicit_profile_jobs_and_binding`
aus dem Release-Testprogramm des Commits `fcec400`. Ergebnis 1 bestanden,
7 gefiltert, Exit 0. Der vor dem Start nachgelesene SHA-256 der EXE war
`7d1715dc105c1eb482405511e1b3abf4437c448e186e73923c43dd3c7938710e`.
Der Konsolencontroller meldete Windows PowerShell **5.1.26100.9818** (x64).
SHA-256 des auf dem Gast erzeugten JSON-Belegs
`48de474d842ebc87550ba2e27b66086e6aa573973f252f4b8e19ac7b12b75a63`.
Für die Übertragung diente ein temporäres schreibgeschütztes Testmedium.
Der Test lief in der bereitgestellten Administratorkonsole. Er prüfte die
Profilwahl im neuen Build. Die Ausführung als auftragsverarbeitender
LocalService-Dienst muss weiterhin über die normale Genehmigungsstrecke folgen.
Im selben Gast wurde der neue Agent mit SHA-256
`df80b00fc2119b973d690053b9f9e4bdedd8fbc211f67599c3301eeb42e7702f`
in das geschützte Bootstrap-Verzeichnis kopiert und dort erneut gehasht.
Im Wartungsfall `49c230d8-fb5d-4c64-96b6-e0edce03ed90` bestätigten die
beiden Controller ihre Vorbereitung. Sie prüften den laufenden Vorgänger,
seine öffentliche Bindung und die Dateirechte und legten die Kandidaten und
Rückkehrkopien an. Die Dienstkonfiguration blieb dabei passiv.
Beim passiven Dienstwechsel stoppte der Controller Agent und Helper. Vor
dem ersten Dateitausch scheiterte das Öffnen der Arbeitskopie für
`FlushFile` mit „Zugriff verweigert“. Der erste diagnostische Leseaufruf
verwendete einen falschen Fallverzeichnisnamen. Der korrigierte Aufruf las
den ursprünglichen Fall und bestätigte bei Agent, Helperkonfiguration
und Gegenstellen-Pin jeweils ursprüngliche FileID, Hash und ACL-Hash.
Beide Dienste waren gestoppt. Es gab die Vorbereitungs- und Stoppbelege,
aber keinen Ersetzungsbeleg. Quelle und Arbeitskopie waren 23.541.484
Bytes groß, hatten den erwarteten SHA-256 des neuen Agenten und trugen
das vom Installationsmedium übernommene Windows-Dateiattribut `ReadOnly`.
+50
View File
@@ -519,3 +519,53 @@ Fehlerbeleg sowie die acht vorhandenen Profiltests. Die vier Fälle umfassten
ungleiche Deskriptoren mit lesbarer beziehungsweise fehlender FileID, einen ungleiche Deskriptoren mit lesbarer beziehungsweise fehlender FileID, einen
gleichen Deskriptor und einen unabhängigen Folgefehler. Die FileID-Abfrage war gleichen Deskriptor und einen unabhängigen Folgefehler. Die FileID-Abfrage war
simuliert. Eine native Abnahme dieser Belegerweiterung steht aus. simuliert. Eine native Abnahme dieser Belegerweiterung steht aus.
### Konsolennachweis der leeren Zieldatei
Die Bedienperson las den festen Zielpfad auf dem Windows-Gast. Die
Dateigröße betrug 0 Byte. Beim Vergleich der ungebrochenen SDDL-Texte
unterschieden sich ausschließlich die DACL-Steuerflags: erwartet `PAI`,
gelesen `P`. Beide Deskriptoren enthalten denselben Eigentümer und dieselbe
Gruppe (BUILTIN-Administratoren), die geschützte DACL und dieselben sechs
expliziten ACEs in identischer Reihenfolge. Die beiden Dienst-SIDs haben
je eine explizite Verweigerung von ReadData. Der Befund erklärt den
Textvergleichsabbruch. Er belegt keine Freigabe der Datei.
SHA-256 der UTF-8-Texte ohne die Zeilenumbrüche der Konsolendarstellung:
erwartet `d4726c7973c9b0cd8a66c1b129d1b5eb58d2bbfc1b103018e0a31a71fb1d9020`,
gelesen `a0e1d856ed3bdbe884b23599f7c53d8a281d6409a42bbfa48649127b2aa22793`.
Die erste Fehlerquittung enthielt keine FileID der leeren Zieldatei.
Der Modus `-ResumeEmpty` prüft die bestehenden Fallbelege und öffnet das
leere Ziel exklusiv. Vor dem Schreiben protokolliert er dessen jetzt
festgestellte FileID. Dieselbe Kennung muss nach dem Schreiben und nach
der Freigabe der Leserechte wieder vorliegen. Beim DACL-Vergleich sind nur
die beiden für diesen Fall beschriebenen Formen zulässig. Der Starter
vergleicht die FileID zusätzlich mit der Quittung. Der Rückkanal überträgt
das Ergebnis und die passiven Zeitmessungen.
Lokal bestanden acht Profiltests, die PowerShell-Parserprüfung, die
C#-Kompilierung, fünf AMD64-Strukturlayoutprüfungen und 20 Vergleiche
von Sicherheitsdeskriptoren. Acht lokale Fälle prüften die Auswahl des
Startmodus und das Verhalten bei vorhandenen Markern. Die Anwendung auf
dem Windowsgast und signierte Zeitmessungen beider Dienste stehen aus.
### Windows-VM, 15. November 2026, 20:40 Uhr MEZ
Der Controller schloss die Profilinstallation im Fall
`ad9fd154-b2be-4f5d-9e17-65abb721ceaf` ab. Ab
`2026-11-15T19:40:47.0850024Z` schrieb er die vorbereiteten 1177 Bytes.
Beim Rücklesen stimmten der erwartete SHA-256
`2b4a8a7080770304b80e2a665fa5f5ee1ebbd9182e7c80b184e75b114575b42b`
und die bei leerer Datei protokollierte FileID
`95990300000007000000000000000000` überein. Der Kandidat blieb erhalten.
Agent und Helper liefen während der Veröffentlichung weiter.
Der Empfänger auf dem Projektserver bestätigte die Quittung in Sitzung
`d8b4b255-8e3f-4aa7-8377-684ce9adbea1`.
SHA-256 des Gast-Ergebnisbelegs
`62a04be9c7d08d3687b51eacd6adbe290b91e16ba934d6b5bb531e8764a56cf5`,
SHA-256 der serverseitigen Publikationsquittung
`1a0ce65c852523072d6822024541591482e0bae3788834993c2548e9cbf7647e`.
Um 20:40:59 Uhr MEZ fehlte beim anschließenden Lesen noch mindestens
einer der beiden passiven Zeitbelege.