Compare commits

...
Author SHA1 Message Date
kevin_janssen dc3906272c Resume the verified empty Windows time profile by exclusive handle
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:37:00 +01:00
kevin_janssen 454e08f942 Pin the verified descriptor-aware Windows finalizer in the receipt launcher
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:29:08 +01:00
kevin_janssen 38e6df51ea Merge commit '5adf209'
Rust development slice / linux (push) Failing after 7s
# Conflicts:
#	docs/windows-time-profile-config.md
2026-11-15 20:29:06 +01:00
kevin_janssen 5adf209f1e Capture both security descriptors at the exclusive profile creation handle
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:28:38 +01:00
kevin_janssen 48662f97e3 Keep Windows receipt retries read-only after a recorded or incomplete attempt
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:28:34 +01:00
kevin_janssen 16c9c3cefe Verify Windows heartbeat after the native descriptor failure and update handover
Rust development slice / linux (push) Failing after 6s
2026-11-15 20:26:33 +01:00
kevin_janssen 07c5b0e12d Record Windows first-create descriptor check failure from the evening window
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:24:54 +01:00
kevin_janssen c46873ff95 Renew the bounded Windows receipt window and pass its deadline to the launcher
Rust development slice / linux (push) Failing after 7s
2026-11-15 20:23:15 +01:00
kevin_janssen 1a502a1c46 Merge commit '715287a'
Rust development slice / linux (push) Failing after 7s
2026-11-15 17:17:52 +01:00
kevin_janssen a5ec061a92 Receive first-create publication evidence and passive samples for the Windows case
Rust development slice / linux (push) Failing after 7s
2026-11-15 17:14:22 +01:00
kevin_janssen 9a6599fddd Merge commit '5f21b75'
Rust development slice / linux (push) Failing after 6s
# Conflicts:
#	docs/windows-time-profile-config.md
2026-11-15 17:13:49 +01:00
kevin_janssen f023d790a4 Verify Windows heartbeat and identity after the profile publication failure
Rust development slice / linux (push) Failing after 7s
2026-11-15 17:13:08 +01:00
kevin_janssen 5f21b753ed Provision the missing original Windows time profile through an exclusive first-create handle
Rust development slice / linux (push) Failing after 7s
2026-11-15 17:13:01 +01:00
kevin_janssen 0b32859d74 Update Windows MVP handover with the native error and corrected build status
Rust development slice / linux (push) Failing after 6s
2026-11-15 17:12:26 +01:00
kevin_janssen 331cdddac5 Merge commit 'e952698'
Rust development slice / linux (push) Failing after 7s
2026-11-15 17:11:07 +01:00
kevin_janssen 00717e4283 Record native Windows time profile sharing violation and cloud receipt
Rust development slice / linux (push) Failing after 6s
2026-11-15 17:08:37 +01:00
4 changed files with 520 additions and 21 deletions
+318 -2
View File
@@ -2,7 +2,10 @@
#requires -RunAsAdministrator
# Finish the single, console-verified public-file publication on the test VM.
# Run in a fresh Windows PowerShell process. No SSH or RMM job is involved.
[CmdletBinding()]
param([switch]$InitialCreate, [switch]$ResumeEmpty)
$ErrorActionPreference = 'Stop'
if ($InitialCreate -and $ResumeEmpty) { throw 'Choose one publication operation' }
$caseId = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf'
$controllerHash = 'd8b4fd4fd9ca5310cc1591ce3c2ccae5bd72a2ade43b21a8187cfdfb960b3427'
$configHash = '2b4a8a7080770304b80e2a665fa5f5ee1ebbd9182e7c80b184e75b114575b42b'
@@ -49,10 +52,34 @@ $aclDone = Get-Content -LiteralPath (Join-Path $folder 'directory-acl-done.json'
$staged = Join-Path $folder 'time-attestation.candidate.json'
$resultPath = Join-Path $folder 'result.json'
$reservation = Join-Path $folder 'console-finalization-intent.json'
foreach ($path in @($target,$resultPath,$reservation)) {
$initialReservation = Join-Path $folder 'console-initial-create-intent.json'
$initialResult = Join-Path $folder 'console-initial-create-result.json'
$initialError = Join-Path $folder 'console-initial-create-error.json'
$initialVerified = Join-Path $folder 'console-initial-create-verified.json'
$resumeReservation = Join-Path $folder 'console-resume-empty-intent.json'
$resumeVerified = Join-Path $folder 'console-resume-empty-verified.json'
$resumeResult = Join-Path $folder 'console-resume-empty-result.json'
$resumeError = Join-Path $folder 'console-resume-empty-error.json'
$absent = @($resultPath,$initialVerified,$initialResult,$resumeReservation,$resumeVerified,$resumeResult,$resumeError)
if (!$ResumeEmpty) { $absent += @($target,$initialReservation,$initialError) }
if ($InitialCreate -or $ResumeEmpty) {
$priorError = Join-Path $folder 'console-finalization-error.json'
CheckControl $reservation $false
CheckControl $priorError $false
$priorReservation = Get-Content -LiteralPath $reservation -Raw | ConvertFrom-Json
$priorFailure = Get-Content -LiteralPath $priorError -Raw | ConvertFrom-Json
if ($priorReservation.id -cne $caseId -or $priorReservation.config_sha256 -cne $configHash -or
$priorFailure.id -cne $caseId -or $priorFailure.phase -cne 'File.Move' -or
$priorFailure.hresult -cne '0x80070020' -or $priorFailure.exception -cne 'System.IO.IOException') {
throw 'Expected the recorded sharing violation from the original single finalization attempt'
}
} else {
$absent += $reservation
}
foreach ($path in $absent) {
if (Test-Path -LiteralPath $path) { throw 'Existing target or finalization record: read original case' }
}
$null = ReadAcl $staged $false
$stagedAcl = ReadAcl $staged $false
$rootAcl = ReadAcl $helperRoot $true
$expected = @{
volume_serial = '9815088561147542064'
@@ -67,6 +94,19 @@ if ($publish.create_once -ne $true -or $publish.config_sha256 -cne $configHash -
(AclHash $helperRoot) -cne '186d85132cf0e16cbb9623ad9636b7777741939a8cae3d689a2af1eb267a7f49') {
throw 'Original file identity or permissions changed'
}
if ($ResumeEmpty) {
CheckControl $initialReservation $false
CheckControl $initialError $false
$creation = Get-Content -LiteralPath $initialReservation -Raw | ConvertFrom-Json
$failure = Get-Content -LiteralPath $initialError -Raw | ConvertFrom-Json
if ($creation.id -cne $caseId -or $creation.config_sha256 -cne $configHash -or
$creation.create_new -isnot [bool] -or !$creation.create_new -or !$creation.utc -or
!(JsonEqual $expected $creation.staged) -or $failure.id -cne $caseId -or
$failure.phase -cne 'verify_creation' -or $failure.hresult -cne '0x80131501' -or
$failure.exception -cne 'System.Management.Automation.RuntimeException') {
throw 'Unexpected initial creation intent or failure'
}
}
if ($p.probe_sha256 -cne '727732fb4b38ac5431a330527bd52a3ab80af8f189ae75a7b48eceb1d4b69cac' -or
$p.system_probe_sha256 -cne '77a344912c61b7ac4a92152ae1b534ca7c36fe6f7dc4675783f20558c3a7f434') {
throw 'Unexpected native status probes'
@@ -77,12 +117,288 @@ SameLive $intent.before $before
if ($before.agent_kernel.creation_filetime -cne '134392294174782153' -or
$before.helper_kernel.creation_filetime -cne '134392294130218261') { throw 'Service generation changed' }
# FileStandardInfo supplies the hard-link count and directory/delete-pending state
# from the same exclusive handle used to write, flush, hash and publish the DACL.
function Initialize-InitialProfileNative {
Add-Type -TypeDefinition @'
using System;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
public static class RmmInitialProfileFile {
[StructLayout(LayoutKind.Sequential)]
private struct StandardInfo {
public long AllocationSize, EndOfFile;
public uint NumberOfLinks;
public byte DeletePending, Directory;
}
[DllImport("kernel32.dll", SetLastError=true)]
private static extern bool GetFileInformationByHandleEx(
SafeFileHandle handle, int infoClass, out StandardInfo info, uint size);
[StructLayout(LayoutKind.Sequential)]
private struct TagInfo { public uint Attributes, ReparseTag; }
[DllImport("kernel32.dll", SetLastError=true)]
private static extern bool GetFileInformationByHandleEx(
SafeFileHandle handle, int infoClass, out TagInfo info, uint size);
[DllImport("kernel32.dll", CharSet=CharSet.Unicode, ExactSpelling=true, SetLastError=true)]
private static extern SafeFileHandle CreateFileW(string path, uint access, uint sharing,
IntPtr security, uint disposition, uint flags, IntPtr template);
private static void CheckAttributes(SafeFileHandle handle, bool directory) {
TagInfo info;
if (!GetFileInformationByHandleEx(handle, 9, out info, (uint)Marshal.SizeOf(typeof(TagInfo))))
throw new Win32Exception(Marshal.GetLastWin32Error());
if ((info.Attributes & (uint)FileAttributes.ReparsePoint) != 0 ||
((info.Attributes & (uint)FileAttributes.Directory) != 0) != directory)
throw new InvalidOperationException("Unexpected file type or reparse point");
}
[StructLayout(LayoutKind.Sequential)]
private struct UnicodeString { public ushort Length, MaximumLength; public IntPtr Buffer; }
[StructLayout(LayoutKind.Sequential)]
private struct ObjectAttributes {
public int Length;
public IntPtr RootDirectory, ObjectName;
public uint Attributes;
public IntPtr SecurityDescriptor, SecurityQoS;
}
[StructLayout(LayoutKind.Sequential)]
private struct IoStatus { public IntPtr Status, Information; }
[DllImport("ntdll.dll")]
private static extern int NtOpenFile(out SafeFileHandle file, uint access, ref ObjectAttributes attributes,
out IoStatus io, uint share, uint options);
[DllImport("ntdll.dll")]
private static extern uint RtlNtStatusToDosError(int status);
// Open-only, relative to the held volume root. OBJ_DONT_REPARSE applies to
// the complete relative path, including ProgramData and the helper directory.
public static FileStream OpenExistingTarget() {
const string relativePath = @"ProgramData\RustDiscoverySystem\time-attestation.json";
const uint backupSemanticsNoFollow = 0x02200000;
using (SafeFileHandle root = CreateFileW(@"C:\", 0xA0, 7, IntPtr.Zero, 3,
backupSemanticsNoFollow, IntPtr.Zero)) {
if (root.IsInvalid) throw new Win32Exception(Marshal.GetLastWin32Error());
CheckAttributes(root, true);
UnicodeString name = new UnicodeString();
name.Length = checked((ushort)(relativePath.Length * sizeof(char)));
name.MaximumLength = name.Length;
name.Buffer = Marshal.StringToHGlobalUni(relativePath);
IntPtr nativeName = IntPtr.Zero;
try {
nativeName = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(UnicodeString)));
Marshal.StructureToPtr(name, nativeName, false);
ObjectAttributes attributes = new ObjectAttributes();
attributes.Length = Marshal.SizeOf(typeof(ObjectAttributes));
attributes.RootDirectory = root.DangerousGetHandle();
attributes.ObjectName = nativeName;
attributes.Attributes = 0x1040; // OBJ_DONT_REPARSE | OBJ_CASE_INSENSITIVE
const uint readWriteAcl = 0x00160083; // synchronize, WRITE_DAC, READ_CONTROL, attributes and data
const uint options = 0x62; // FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_WRITE_THROUGH
IoStatus io;
SafeFileHandle h;
int status = NtOpenFile(out h, readWriteAcl, ref attributes, out io, 0, options);
if (status != 0) throw new Win32Exception((int)RtlNtStatusToDosError(status));
try {
CheckSingleFile(h, 0);
return new FileStream(h, FileAccess.ReadWrite);
} catch { h.Dispose(); throw; }
} finally {
Marshal.FreeHGlobal(nativeName);
Marshal.FreeHGlobal(name.Buffer);
}
}
}
public static void CheckSingleFile(SafeFileHandle handle, long expectedLength) {
CheckAttributes(handle, false);
StandardInfo info;
if (!GetFileInformationByHandleEx(handle, 1, out info, (uint)Marshal.SizeOf(typeof(StandardInfo))))
throw new Win32Exception(Marshal.GetLastWin32Error());
if (info.NumberOfLinks != 1 || info.DeletePending != 0 || info.Directory != 0 ||
info.EndOfFile != expectedLength)
throw new InvalidOperationException("Expected one regular file of the exact size");
}
}
'@
}
function Get-HeldProfileFileId([IO.FileStream]$Stream) {
$id = New-Object RmmPipeNative+FileId
if (![RmmPipeNative]::GetFileInformationByHandleEx($Stream.SafeFileHandle, 18, [ref]$id, 24)) {
throw 'New file identity unavailable'
}
return @{
volume_serial=$id.Volume.ToString([Globalization.CultureInfo]::InvariantCulture)
file_id=([BitConverter]::ToString($id.Id)).Replace('-','').ToLowerInvariant()
}
}
function Get-HeldProfileIdentity([IO.FileStream]$Stream) {
[RmmInitialProfileFile]::CheckSingleFile($Stream.SafeFileHandle, 1177)
$identity = Get-HeldProfileFileId $Stream
$Stream.Position = 0
$algorithm = [Security.Cryptography.SHA256]::Create()
try { $digest = [BitConverter]::ToString($algorithm.ComputeHash($Stream)).Replace('-','').ToLowerInvariant() }
finally { $algorithm.Dispose() }
$sddl = $Stream.GetAccessControl().GetSecurityDescriptorSddlForm($aclSections)
$identity.bytes = $Stream.Length
$identity.sha256 = $digest
$identity.acl_sha256 = BytesHash ([Text.Encoding]::UTF8.GetBytes($sddl))
return $identity
}
# Both accepted strings retain the protected DACL, owner, group and all ACEs.
# Windows stored the newly created file without the auto-inherited marker.
function Test-ProfileDescriptor([string]$ExpectedSddl, [string]$ActualSddl) {
if (!$ExpectedSddl.StartsWith('O:BAG:BAD:PAI(', [StringComparison]::Ordinal)) { return $false }
return $ActualSddl -ceq $ExpectedSddl -or $ActualSddl -ceq $ExpectedSddl.Replace('D:PAI(', 'D:P(')
}
function New-OriginalPublicProfile {
Initialize-InitialProfileNative
$aclSections = [Security.AccessControl.AccessControlSections]'Owner,Group,Access'
$accessOnly = [Security.AccessControl.AccessControlSections]::Access
$draftAcl = [Security.AccessControl.FileSecurity]::new()
$draftAcl.SetSecurityDescriptorSddlForm($stagedAcl.Sddl, $aclSections)
foreach ($sid in @($agentSid,$helperSid)) {
$deny = [Security.AccessControl.FileSystemAccessRule]::new(
[Security.Principal.SecurityIdentifier]::new($sid),
[Security.AccessControl.FileSystemRights]::ReadData, [Security.AccessControl.AccessControlType]::Deny)
$draftAcl.AddAccessRule($deny)
}
$draftSddl = $draftAcl.GetSecurityDescriptorSddlForm($aclSections)
if (!$draftAcl.AreAccessRulesProtected -or $draftSddl -ceq $stagedAcl.Sddl) { throw 'Initial protected DACL required' }
if ((BytesHash ([Text.Encoding]::UTF8.GetBytes($draftSddl))) -cne
'd4726c7973c9b0cd8a66c1b129d1b5eb58d2bbfc1b103018e0a31a71fb1d9020') {
throw 'Unexpected draft descriptor for this case'
}
$reserved = $false
$phase = 'CreateNew'
$descriptorFailure = $null
if ($ResumeEmpty) {
$attemptResult = $resumeResult
$attemptError = $resumeError
$attemptVerified = $resumeVerified
} else {
$attemptResult = $initialResult
$attemptError = $initialError
$attemptVerified = $initialVerified
}
try {
if ($ResumeEmpty) {
$phase = 'open_existing_empty'
$stream = [RmmInitialProfileFile]::OpenExistingTarget()
} else {
$since = [DateTime]::UtcNow.ToString('o')
WriteNew $initialReservation @{id=$caseId; config_sha256=$configHash; utc=$since; staged=$expected; create_new=$true}
$reserved = $true
$rights = [Security.AccessControl.FileSystemRights]'ReadData,WriteData,ReadAttributes,ReadPermissions,ChangePermissions,Synchronize'
$stream = [IO.FileStream]::new($target, [IO.FileMode]::CreateNew,
$rights, [IO.FileShare]::None, 4096,
[IO.FileOptions]::WriteThrough, $draftAcl)
}
try {
$phase = 'verify_creation'
$actualSddl = $stream.GetAccessControl().GetSecurityDescriptorSddlForm($aclSections)
if (!(Test-ProfileDescriptor $draftSddl $actualSddl)) {
$descriptorFailure = @{expected_sddl=$draftSddl; actual_sddl=$actualSddl; bytes=$null}
try {
$descriptorFailure.bytes = $stream.Length
$fileId = Get-HeldProfileFileId $stream
$descriptorFailure.file_id = $fileId.file_id
$descriptorFailure.volume_serial = $fileId.volume_serial
} catch {
$descriptorFailure.metadata_hresult = '0x{0:X8}' -f $_.Exception.GetBaseException().HResult
}
throw 'Unexpected security descriptor on new file'
}
[RmmInitialProfileFile]::CheckSingleFile($stream.SafeFileHandle, 0)
$emptyId = Get-HeldProfileFileId $stream
if ($emptyId.volume_serial -cne $expected.volume_serial -or
$emptyId.file_id -ceq $expected.file_id -or $emptyId.file_id -ceq ('0' * 32)) {
throw 'Unexpected volume or identity on held empty target'
}
$draftHash = BytesHash ([Text.Encoding]::UTF8.GetBytes($actualSddl))
if ($ResumeEmpty) {
$since = [DateTime]::UtcNow.ToString('o')
WriteNew $resumeReservation @{
id=$caseId; utc=$since; config_sha256=$configHash; target_id=$emptyId.file_id
volume_serial=$emptyId.volume_serial; draft_acl_sha256=$draftHash; bytes=0
}
$reserved = $true
}
$phase = 'write_verify'
$stream.Write($bytes, 0, $bytes.Length)
$stream.Flush($true)
$new = Get-HeldProfileIdentity $stream
if ($new.volume_serial -cne $expected.volume_serial -or $new.file_id -ceq $expected.file_id -or
$new.file_id -cne $emptyId.file_id -or $new.sha256 -cne $configHash -or
$new.acl_sha256 -cne $draftHash) {
throw 'New held bytes, identity or staging permissions differ'
}
SameLive $before (ActualState $true)
$null = Kernel 'agent' $before.service $heldAgent
$null = Kernel 'helper' $before.helper_service $heldHelper
if (!(JsonEqual $expected (FileIdentity $staged)) -or (AclHash $helperRoot) -cne $rootAclHash) {
throw 'Original source or target directory changed before publication'
}
WriteNew $attemptVerified @{
id=$caseId; utc=$since; original_candidate=$expected; held_target=$new
}
# Change only the DACL by handle after the verified bytes and FileID
# are durable. A crash before this point leaves service reads denied.
$phase = 'publish_dacl'
$final = $stream.GetAccessControl()
$final.SetSecurityDescriptorSddlForm($stagedAcl.Sddl, $accessOnly)
$stream.SetAccessControl($final)
$stream.Flush($true)
$actualFinal = $stream.GetAccessControl().GetSecurityDescriptorSddlForm($aclSections)
if (!(Test-ProfileDescriptor $stagedAcl.Sddl $actualFinal)) { throw 'Unexpected final descriptor' }
$new.acl_sha256 = BytesHash ([Text.Encoding]::UTF8.GetBytes($actualFinal))
if (!(JsonEqual $new (Get-HeldProfileIdentity $stream))) { throw 'Held publication readback failed' }
} finally { $stream.Dispose() }
$phase = 'readback'
$null = ReadAcl $target $false
$published = FileIdentity $target
if (!(JsonEqual $new $published) -or !(JsonEqual $expected (FileIdentity $staged)) -or
(AclHash $helperRoot) -cne $rootAclHash) { throw 'Final source/target binding failed' }
$after = ActualState $true
SameLive $before $after
$null = Kernel 'agent' $before.service $heldAgent
$null = Kernel 'helper' $before.helper_service $heldHelper
$outcome = @{
id=$caseId; installed=$true; publication_since=$since; configuration=$published
original_candidate=$expected; source_candidate_preserved=$true; initial_create=$true
native=$after; clock_runtime_qualified=$false; services_changed=$false; private_key_read=$false
no_jobs=$true; original_move_failed=$true
}
if ($ResumeEmpty) { $outcome.resumed_empty = $true }
WriteNew $attemptResult $outcome
} catch {
$cause = $_.Exception.GetBaseException()
$failure = @{id=$caseId; phase=$phase; hresult=('0x{0:X8}' -f $cause.HResult); exception=$cause.GetType().FullName}
if ($null -ne $descriptorFailure) { $failure.creation_descriptor = $descriptorFailure }
if ($reserved) { WriteNew $attemptError $failure }
throw
}
}
$heldAgent = [RmmPipeNative]::Open([int]$before.service.pid)
try {
$heldHelper = [RmmPipeNative]::Open([int]$before.helper_service.pid)
try {
$null = Kernel 'agent' $before.service $heldAgent
$null = Kernel 'helper' $before.helper_service $heldHelper
if ($InitialCreate -or $ResumeEmpty) {
$rootAclHash = '186d85132cf0e16cbb9623ad9636b7777741939a8cae3d689a2af1eb267a7f49'
New-OriginalPublicProfile
'Zeitprofil am gebundenen Dateihandle veroeffentlicht und nachgelesen.'
return
}
# WriteNew uses CreateNew. Concurrent or later invocations cannot republish.
WriteNew $reservation @{id=$caseId; config_sha256=$configHash; utc=[DateTime]::UtcNow.ToString('o')}
try {
@@ -1,13 +1,13 @@
#requires -Version 5.1
#requires -RunAsAdministrator
# The relay receives a fixed public receipt. There is no command reader.
param([Parameter(Mandatory)][DateTimeOffset]$Until)
$ErrorActionPreference = 'Stop'
$until = [DateTimeOffset]::Parse('2026-11-15T17:00:00+00:00')
$deadline = [DateTimeOffset]::UtcNow.AddMinutes(12)
if ($deadline -gt $until) { $deadline = $until }
if ($deadline -le [DateTimeOffset]::UtcNow) { throw 'Das Wartungsfenster ist abgelaufen.' }
$base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/577132fb422bf854276b3afb5bafdb12d2c08427/deploy/windows'
$base = 'https://gitea.incoso.eu/kevin_janssen/rust-discovery/raw/commit/38e6df51ea57a76ec2d5462513d59e855f36c0f4/deploy/windows'
$bootstrap = 'C:\ProgramData\RustDiscoveryBootstrap'
$caseId = 'ad9fd154-b2be-4f5d-9e17-65abb721ceaf'
$case = Join-Path $bootstrap "time-profile-$caseId"
@@ -24,7 +24,7 @@ $null = New-Item -ItemType Directory -Path $work
$listener = $null
$ssh = $null
$scripts = [ordered]@{
'Complete-OriginalTimeProfile.ps1' = '5ad85ae7a3a513d3cc2f5f5dca3e48eb42fd863522c3384f9c64cdcf0273ef1a'
'Complete-OriginalTimeProfile.ps1' = 'c2fb92ebd0f4ab19545b55ad92d7a9b21ec6e3604d33107d0dd78882162be131'
'Read-PassiveTimeSamples.ps1' = 'd9e2b9344c19af1296b86ec70ba754ef820f369ac5ec897979bd4233e0722d04'
}
try {
@@ -45,21 +45,39 @@ try {
$ssh = Start-Process -FilePath "$sshBin\ssh.exe" -ArgumentList $options -PassThru -NoNewWindow
if ($ssh.WaitForExit(1800)) { throw "SSH Exit $($ssh.ExitCode)" }
Write-Host 'Wartungsfenster aktiv. Dieses Fenster offen lassen. Strg+C beendet es.'
$receipt = [ordered]@{session=$session; case_id=$caseId; phase='preflight'; read_only_channel=$true}
$result = Join-Path $case 'result.json'
$receipt = [ordered]@{session=$session; case_id=$caseId; method='initial_create'; phase='preflight'; read_only_channel=$true}
$result = Join-Path $case 'console-initial-create-result.json'
$intentPath = Join-Path $case 'console-initial-create-intent.json'
$failurePath = Join-Path $case 'console-initial-create-error.json'
$receipt.finalizer_invoked = $false
try {
if (Test-Path -LiteralPath $failurePath) { throw 'Previous profile finalization error recorded' }
if (!(Test-Path -LiteralPath $result)) {
$null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1')
if (Test-Path -LiteralPath $intentPath) { throw 'Previous profile finalization intent without result' }
$receipt.finalizer_invoked = $true
$null = & (Join-Path $work 'Complete-OriginalTimeProfile.ps1') -InitialCreate
}
$record = Get-Content -LiteralPath $result -Raw | ConvertFrom-Json
$actual = Get-FileHash -LiteralPath 'C:\ProgramData\RustDiscoverySystem\time-attestation.json'
if ($record.id -cne $caseId -or $record.installed -ne $true -or
$record.console_finalized -ne $true -or $record.clock_runtime_qualified -ne $false -or
$record.initial_create -ne $true -or $record.source_candidate_preserved -ne $true -or
$record.services_changed -ne $false -or $record.private_key_read -ne $false -or $record.clock_runtime_qualified -ne $false -or
$actual.Hash -ne '2b4a8a7080770304b80e2a665fa5f5ee1ebbd9182e7c80b184e75b114575b42b') { throw 'Unexpected publication result' }
$marker = Get-Content -LiteralPath (Join-Path $case 'console-finalization-intent.json') -Raw | ConvertFrom-Json
if ($marker.id -cne $caseId -or $marker.config_sha256 -ne $actual.Hash) { throw 'Unexpected finalization intent' }
$marker = Get-Content -LiteralPath $intentPath -Raw | ConvertFrom-Json
if ($marker.id -cne $caseId -or $marker.utc -cne $record.publication_since -or
$marker.config_sha256 -ne $actual.Hash -or $record.configuration.sha256 -ne $actual.Hash -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' }
$receipt.phase = 'published'
$receipt.publication_since = $marker.utc
$receipt.publication_since = $record.publication_since
$receipt.initial_create = $record.initial_create
$receipt.source_candidate_preserved = $record.source_candidate_preserved
$receipt.services_changed = $record.services_changed
$receipt.private_key_read = $record.private_key_read
$receipt.clock_runtime_qualified = $record.clock_runtime_qualified
$receipt.source_id = $record.original_candidate.file_id
$receipt.target_id = $record.configuration.file_id
$receipt.config_sha256 = $actual.Hash.ToLowerInvariant()
$receipt.result_sha256 = (Get-FileHash -LiteralPath $result).Hash
} catch {
$receipt.phase = 'finalization_failed'
@@ -67,10 +85,24 @@ try {
$receipt.line = $_.InvocationInfo.ScriptLineNumber
$receipt.file = [IO.Path]::GetFileName($_.InvocationInfo.ScriptName)
Write-Warning $_.Exception.Message
$failurePath = Join-Path $case 'console-finalization-error.json'
if (Test-Path -LiteralPath $failurePath) {
$failure = Get-Content -LiteralPath $failurePath -Raw | ConvertFrom-Json
if ($failure.id -ceq $caseId -and $failure.hresult -cmatch '^0x[0-9A-Fa-f]{8}$') { $receipt.move_hresult = $failure.hresult }
if ($failure.id -ceq $caseId -and $failure.hresult -cmatch '^0x[0-9A-Fa-f]{8}$') {
$receipt.hresult = $failure.hresult
if ($failure.phase -cmatch '^[A-Za-z][A-Za-z0-9_.-]{0,63}$') { $receipt.failure_phase = $failure.phase }
$descriptor = $failure.creation_descriptor
if ($failure.phase -ceq 'verify_creation' -and $null -ne $descriptor -and
$descriptor.expected_sddl -is [string] -and $descriptor.expected_sddl.Length -le 4096 -and
$descriptor.actual_sddl -is [string] -and $descriptor.actual_sddl.Length -le 4096) {
$receipt.creation_descriptor = @{
expected_sddl=$descriptor.expected_sddl; actual_sddl=$descriptor.actual_sddl; bytes=$descriptor.bytes
}
if ($descriptor.file_id -cmatch '^[0-9a-f]{32}$' -and $descriptor.volume_serial -cmatch '^[0-9]{1,20}$') {
$receipt.creation_descriptor.file_id = $descriptor.file_id
$receipt.creation_descriptor.volume_serial = $descriptor.volume_serial
}
}
}
}
}
$readScript = Join-Path $work 'Read-PassiveTimeSamples.ps1'
+15 -7
View File
@@ -22,13 +22,21 @@ 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.
[Dienstwechsel und Telemetrienachweis](windows-signed-clock-upgrade-plan.md)
Die Zeitprofilinstallation scheiterte beim Veröffentlichen der Datei mit einer
`IOException`. Eine separate Abfrage auf der VM bestätigte, dass die Zieldatei
fehlte und die Dienste weiterliefen. Das SSH-Fenster endete um 16:30 Uhr MEZ.
Für die nächste Gastprüfung muss der bestehende Teilzustand berücksichtigt
werden. Die Zeitprüfung in beiden installierten Rollen und der erste über die
WebUI genehmigte PowerShell-Auftrag stehen aus.
[Zeitprofil und Originalbefund](windows-time-profile-config.md)
Die Erstinstallation des Windows-Zeitprofils ist offen. Der Server empfing um
17:05:36 Uhr MEZ den Fehlercode `0x80070020` beim Verschieben in das
Zielverzeichnis. Der Helper hält dort einen Verzeichnishandle, der diesen
Schreibzugriff sperrt. Im korrigierten Quellstand erlauben die Handles für
das öffentliche Verzeichnis diesen Zugriff. Löschsperre, DACL- und
Dateiidentitätsprüfungen bleiben aktiv. Agent und Helper wurden damit für
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
die neue Zieldatei öffnen. Der Sicherheitsdeskriptor entsprach beim Lesen
nicht exakt dem erwarteten Wert. Der Controller stoppte vor dem Schreiben
der Profilbytes. Zum Vergleich werden die erwartete und die aktuelle
Ziel-SDDL sowie die Dateigröße benötigt. Der erste signierte Zeitvergleich
in beiden laufenden Rollen und die Windows-Skript- und Paketabnahmen
stehen weiterhin aus.
[VM-Fehlerbeleg und Buildprüfung](windows-time-profile-config.md)
Die passive Zertifikatserneuerung ist implementiert. Fünf Wiederanlauf- und
Fehlerfälle mit Testidentitäten bestanden auch auf Windows. Das Anlegen,
+143
View File
@@ -376,3 +376,146 @@ Fall `time-profile-receipt-f7f56e9f` ab. Für Zeitbelege verwendet er die
bestehende Rollen-, Boot-, Generations- und Altersprüfung mit je einer
Datenbanklesung vor und nach dem Empfang. Die Bereitstellung des Empfängers
belegt noch keine Profilveröffentlichung auf dem Gast.
## Rückmeldung der Windows-VM am 15. November um 17:05:36 Uhr MEZ
Der Empfänger hat im Fall `time-profile-receipt-f7f56e9f` die Antwort
`finalization_failed` gespeichert. Der Abschlussbefehl bestand die Prüfungen
auf Kandidat, Berechtigungen und Dienstgenerationen bis zur Veröffentlichung.
Der Aufruf von `File.Move` meldete HRESULT **0x80070020**
(`ERROR_SHARING_VIOLATION`). Zeile 94 gibt diesen Fehler an den Aufrufer
weiter. Empfangsbeleg SHA-256
`7cc51d44abfbe7949b0896053a463f3bd140b1844229e9ba206683db34d6f2ba`,
Ergebnis `172edeaf54ca08f4e5b1ad3662884da6ec217636ca30bbd8274e73140f6ef35b`.
Der Code des installierten Helpers öffnet das öffentliche Stammverzeichnis
mit Lesezugriff und ausschließlich `FILE_SHARE_READ` und hält diesen Handle
im laufenden Dienst. Ein Rename aus einem anderen Verzeichnis benötigt am
Zielverzeichnis `FILE_ADD_FILE`. Das erklärt einen konkreten Konflikt.
Die VM-Rückmeldung enthält keine Liste der tatsächlich offenen Handles.
Für den älteren Installationsaufruf ohne HRESULT bleibt der Fehlercode
unbekannt. Das laufende Konsolenskript hat keine weitere Veröffentlichung
versucht. Für diesen Lauf liegt keine erfolgreiche Zeitprüfung vor.
[Windows-Dateisystemregeln für Rename](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fsa/87f86c9b-6c2a-4803-84b7-131a74a434fa)
Nach der fehlgeschlagenen Erstveröffentlichung ergab eine unabhängige Abfrage
von `inventory.get_device` über den permanenten Server einen neuen Kontakt
um 17:12:44 Uhr MEZ, Präsenz `online` und Quelle `windows.base`.
Geräte-ID, Agent-ID, Assignment, Enrollmentgeneration und authentifiziertes
Zertifikat stimmten mit der Telemetrieabnahme vor dem Profilversuch überein.
Der Agent meldete weiterhin die drei passiven Fähigkeiten `heartbeat/1`,
`windows.base/1` und `agent.update/1`.
### Erstprovisionierung nach dem belegten Sharingkonflikt
`Complete-OriginalTimeProfile.ps1 -InitialCreate` ist eine eigene Reparatur
für das bislang fehlende Ziel. Sie setzt den vorhandenen Abschlussintent und
den gespeicherten Fehler `File.Move / System.IO.IOException / 0x80070020`
voraus. Die ursprünglichen Quell-, ACL-, Dienst-, Geräte- und
Kandidatenbindungen gelten weiter. Der ursprüngliche Kandidat bleibt als
Referenz erhalten. Der alte Move-Erfolg und dessen `result.json` werden durch
diesen Pfad nicht nachträglich erzeugt.
Der feste neue Name wird genau einmal mit `CreateNew` angelegt. Windows
erhält dabei bereits eine geschützte DACL mit explizitem Leseverbot für die
beiden Service-SIDs. Der kontrollierende Prozess besitzt den einzigen
Datenhandle. Er schreibt und flusht die 1177 qualifizierten Bytes und liest sie
über denselben Handle vollständig zurück. Er prüft Hash, Volume, neue FileID,
einzigen Hardlink, Länge und DACL. Dann prüft er die ursprüngliche
Kandidatenidentität und die laufenden Dienste noch einmal und schreibt einen
Prüfbeleg. Erst jetzt setzt er die bereits gebundene endgültige DACL auf dem
gehaltenen Handle und prüft Identität, Hash und DACL erneut. Nach Schließen
folgt eine separate Prüfung beider Pfade und Dienste. Damit wird eine neue
Ziel-FileID dokumentiert. Die DACL des öffentlichen Ordners bleibt unverändert.
[Windows-Dateierstellung](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fsa/498a5eeb-afc9-445f-99ed-a7e4b73c648b)
[.NET-Framework-Konstruktor mit Erstellungs-DACL](https://learn.microsoft.com/en-us/dotnet/api/system.io.filestream.-ctor?view=netframework-4.8)
Eine vor der DACL-Freigabe unterbrochene Erstellung kann eine vorhandene
Teildatei mit gesperrtem Dienstzugriff hinterlassen. Nach erfolgter
DACL-Freigabe ist die Datei lesbar, auch wenn der Prozess vor dem
abschließenden Ergebnis ausfällt. Ein neuer Versuch wird in beiden Fällen
verweigert. Die getrennten `console-initial-create-*`-Dateien dokumentieren
Intent, verifizierte neue Zielidentität und tatsächlichen Abschluss oder
Fehlerphase. Das Ergebnis weist `clock_runtime_qualified=false` aus. Für
dessen positive Bewertung sind weiterhin die unabhängigen Zeitbelege der
installierten Dienste erforderlich.
Lokal bestanden Parserprüfung, Kompilierung des kleinen nativen
Handle-Readers, Prüfung seines Strukturlayouts und drei simulierte
Entscheidungsfälle mit echtem beziehungsweise verändertem Fehlerbeleg.
Der frühere lokale Prüfharness wählte beim ersten Strukturlayoutaufruf die
falsche .NET-Überladung; nach Angabe des Typs bestand die Prüfung. Der
Original-Kandidaten-/FileID-Vergleich und die acht bisherigen Profilfixtures
bestanden ebenfalls. Dieser Stand wurde auf der Windows-VM noch nicht
ausgeführt.
Das passende Konsolenfenster ruft ausschließlich die Variante `-InitialCreate`
auf. Der neue Empfänger `time-profile-receipt-f0488aba` war vor Übergabe des
Befehls aktiv und hat die erwartete Geräte- und Gatewaybindung geprüft. Er
unterscheidet die neue Rückmeldung von der alten Move-Fehlermeldung und
speichert die Erstveröffentlichung und den signierten Rollenvergleich getrennt.
Für diesen Skriptstand liegen bei Bereitstellung ausschließlich lokale Prüfungen
vor. Die Bestätigung der VM steht aus.
Am 15. November endete die Freigabe um 18:00 Uhr MEZ. Der Empfänger für
die Erstveröffentlichung schloss mit `window_expired`. Es lag keine
entsprechende Gastquittung vor. Für die Fortsetzung wurde derselbe
Weiterleitungsschlüssel bis 23:45 Uhr MEZ freigegeben. Frist und aktiver
Abschalttimer wurden auf dem Server geprüft. Der neue Empfänger
`time-profile-receipt-a6bb4e2f` hat den Gateway- und Gerätebezug geprüft
und ist bereit. Der Konsolenstarter nimmt die Serverfrist als Parameter
`-Until` entgegen und begrenzt jeden lokalen Start weiterhin auf zwölf Minuten.
### Rückmeldung aus dem Abendfenster
Um 20:24:02 Uhr MEZ empfing der Server im Fall `time-profile-receipt-a6bb4e2f`
die Gastquittung `finalization_failed`. Der Aufruf mit `CreateNew` hatte das
Ziel geöffnet. Bei der ersten Prüfung am offenen Handle wich die vom Kernel
gelesene SDDL-Zeichenfolge vom vorbereiteten Sicherheitsdeskriptor ab. Der
Controller brach in `verify_creation` in Zeile 176 mit `0x80131501` ab.
Der Abbruch lag vor dem ersten Schreiben von Profilbytes und vor der Freigabe
der Datei für die Dienste. Der HRESULT stammt von der ausgelösten
PowerShell-Ausnahme. Er identifiziert keine abweichende Berechtigung.
Die Quittung enthält weder die beiden Deskriptoren noch eine spätere Nachlese
der Zieldatei. Der konkrete Unterschied und der aktuelle Dateizustand bleiben
zu prüfen. Der Empfänger beendete sich nach diesem Fehler wie vorgesehen.
Es gibt aus diesem Lauf keinen erfolgreichen signierten Rollenvergleich.
SHA-256 der Gastantwort samt Serverkontext:
`a1725dbc532f022857e828080bec107ec32efd58836e22dd250909b9d7c2d28b`.
Ein separater MCP-Abruf bestätigte anschließend einen neuen Windows-Heartbeat
um 20:25:35 Uhr MEZ. Präsenz war `online`, die Quelle `windows.base`.
Gerät, Agent, Assignment, Enrollmentgeneration und authentifiziertes Zertifikat
stimmten mit dem früheren Abnahmebeleg überein. Beleg-SHA-256
`7ea828b42b3c7948956aad56845502ffa52192ce6ca14728203f8574d70a28ec`.
Der Konsolenstarter prüft im aktualisierten Quellstand vor einem Aufruf des
Abschlussbefehls auf einen vorhandenen Fehler oder einen offenen Intent.
In beiden Fällen liest er den vorhandenen Stand. Die Rückmeldung kennzeichnet
mit `finalizer_invoked`, ob dieser Start den Abschlussbefehl aufgerufen hat.
Enthält der Fehlerbeleg die bei der Erstellung verglichenen Deskriptoren,
überträgt der Starter sie mit der Länge und den vorhandenen Datei-IDs an den
Ergebnisempfänger. Ältere Fehlerbelege bleiben ohne diese Angaben lesbar.
Der PowerShell-Parser und fünf lokale Fälle bestanden: erster Aufruf,
vorliegender Fehler, offener Intent, bereits vorliegender Erfolg und
widersprüchliche Erfolgs-/Fehlermarker. Nur der erste Fall rief im Test den
simulierten Abschluss auf. Diese Prüfung lief auf dem Entwicklungsrechner.
### Fehlerbeleg beim ersten Vergleich des Sicherheitsdeskriptors
Unterscheiden sich Soll- und Ist-SDDL an der neu angelegten Datei, erfasst der
Controller beide Werte für Besitzer, Gruppe und DACL am exklusiv gehaltenen
Dateihandle. Der private Fehlerbeleg enthält dazu das optionale Feld
`creation_descriptor` mit `expected_sddl`, `actual_sddl` und `bytes`.
Bei erfolgreicher nativer Identitätsabfrage kommen `file_id` und
`volume_serial` hinzu. Scheitert das Lesen der Zusatzmetadaten, hält
`metadata_hresult` dessen Fehlercode fest. Die ursprüngliche Abweichung
bricht den Aufruf vor dem Schreiben der Profilbytes und der Rechtefreigabe ab.
Der ältere Gastbeleg enthält diese neuen Felder noch nicht.
Lokal bestanden die Parserprüfung, vier PowerShell-Fälle für Vergleich und
Fehlerbeleg sowie die acht vorhandenen Profiltests. Die vier Fälle umfassten
ungleiche Deskriptoren mit lesbarer beziehungsweise fehlender FileID, einen
gleichen Deskriptor und einen unabhängigen Folgefehler. Die FileID-Abfrage war
simuliert. Eine native Abnahme dieser Belegerweiterung steht aus.