Install qualified journal capacity while preserving original reboot attempt
Rust development slice / linux (push) Failing after 7s
Rust development slice / linux (push) Failing after 7s
This commit is contained in:
@@ -150,11 +150,16 @@ def server_policy(payload):
|
||||
def server_boot_evidence(payload):
|
||||
root=Path('/opt/rust-discovery');tenant=str(uuid.UUID(payload['tenant_id']));agent=str(uuid.UUID(payload['agent_id']))
|
||||
job=str(uuid.UUID(payload['job_id']));receipt=str(uuid.UUID(payload['inventory_message_id']))
|
||||
query=("SELECT json_build_object('new_boot_id',a.connection_boot_id,'generation',a.connection_generation,'sync_ready',a.sync_ready,'helper_ready',a.helper_sync_ready,"
|
||||
verification=str(uuid.UUID(payload['verification_inventory_message_id']))
|
||||
query=("SELECT json_build_object('observed_at',now(),'new_boot_id',a.connection_boot_id,'generation',a.connection_generation,'sync_ready',a.sync_ready,'helper_ready',a.helper_sync_ready,"
|
||||
"'restore_blocked',a.restore_blocked,'last_authenticated_at',a.last_authenticated_at,'grant_id',p.grant_id,'reserved_at',p.created_at,"
|
||||
"'original_boot_id',(SELECT data->>'boot_id' FROM audit_events WHERE tenant_id=a.tenant_id AND event_type='start_reserved' AND data->>'job_id'='"+job+"' AND data->>'grant_id'=p.grant_id::text),"
|
||||
"'inventory_message_id',o.message_id,'inventory_boot_id',o.boot_id,'inventory_received_at',o.received_at) FROM agent_installations a "
|
||||
"'inventory_message_id',o.message_id,'inventory_boot_id',o.boot_id,'inventory_received_at',o.received_at,"
|
||||
"'verification_inventory_message_id',v.message_id,'verification_inventory_boot_id',v.boot_id,'verification_inventory_received_at',v.received_at,"
|
||||
"'verification_audits',(SELECT count(*) FROM audit_events WHERE tenant_id=a.tenant_id AND event_type='reboot_postcondition_verified' AND data->>'job_id'='"+job+"' AND data->>'grant_id'=p.grant_id::text),"
|
||||
"'verification_audit',(SELECT json_build_object('created_at',created_at,'data',data) FROM audit_events WHERE tenant_id=a.tenant_id AND event_type='reboot_postcondition_verified' AND data->>'job_id'='"+job+"' AND data->>'grant_id'=p.grant_id::text ORDER BY created_at LIMIT 1)) FROM agent_installations a "
|
||||
"JOIN execution_permits p ON p.tenant_id=a.tenant_id AND p.job_id='"+job+"' JOIN observations o ON o.tenant_id=a.tenant_id AND o.agent_id=a.agent_id AND o.message_id='"+receipt+"' "
|
||||
"JOIN observations v ON v.tenant_id=a.tenant_id AND v.agent_id=a.agent_id AND v.message_id='"+verification+"' "
|
||||
"WHERE a.tenant_id='"+tenant+"' AND a.agent_id='"+agent+"';")
|
||||
cmd=['docker','compose','--env-file',str(root/'devstate/.env'),'-f',str(root/'deploy/server.compose.yaml'),'exec','-T','postgres','psql','-X','-qAt','-v','ON_ERROR_STOP=1','-U','postgres','-d','rmm']
|
||||
raw=subprocess.run(cmd,input=query.encode(),capture_output=True,check=True,timeout=15).stdout.strip();require(raw,'bound authenticated reboot/inventory evidence required')
|
||||
@@ -184,6 +189,82 @@ def browser(path):
|
||||
require(result.returncode==0,'actual reboot UI incomplete; retain fixed checkpoint, never repeat approval')
|
||||
|
||||
|
||||
def verify_reboot_receipts(session,job,result,central):
|
||||
m=cloud.contract;post=result['result']['evidence'];grant=result['result']['grant_id']
|
||||
require(central['grant_id']==grant and central['new_boot_id']==central['inventory_boot_id']==central['verification_inventory_boot_id']==post['new_boot_id']
|
||||
and central['original_boot_id']==session['old_boot_id'] and post['new_boot_id']!=session['old_boot_id'], 'same original grant and independently stored newboot receipts')
|
||||
reserved=m.timestamp(central['reserved_at']);received=m.timestamp(central['inventory_received_at']);verified_received=m.timestamp(central['verification_inventory_received_at'])
|
||||
require(reserved<received<=reserved+dt.timedelta(seconds=180) and m.timestamp(post['reboot_reserved_at'])==reserved
|
||||
and m.timestamp(post['reconnect_deadline'])==reserved+dt.timedelta(seconds=180)
|
||||
and post['inventory_message_id']==central['inventory_message_id'] and m.timestamp(post['inventory_received_at'])==received,
|
||||
'original central deadline and exact timely independent receipt')
|
||||
require(post['verification_inventory_message_id']==central['verification_inventory_message_id']
|
||||
and m.timestamp(post['verification_inventory_received_at'])==verified_received, 'exact separate stored verification receipt')
|
||||
audit=central['verification_audit'];require(central['verification_audits']==1 and isinstance(audit,dict),'single durable native verification audit')
|
||||
data=audit['data'];at=m.timestamp(audit['created_at'])
|
||||
require(all(data[k]==v for k,v in dict(job_id=job['job_id'],attempt_id=job['attempt_id'],grant_id=grant,new_boot_id=post['new_boot_id'],
|
||||
inventory_message_id=central['inventory_message_id'],verification_inventory_message_id=central['verification_inventory_message_id']).items())
|
||||
and m.timestamp(data['reboot_reserved_at'])==reserved and m.timestamp(data['reconnect_deadline'])==reserved+dt.timedelta(seconds=180)
|
||||
and m.timestamp(data['inventory_received_at'])==received and m.timestamp(data['verification_inventory_received_at'])==verified_received,
|
||||
'same job/attempt/grant and two receipts bound by actual server audit')
|
||||
require(verified_received<=at<verified_received+dt.timedelta(minutes=5) and at<=m.timestamp(central['observed_at'])
|
||||
and 0<int(data['connection_generation'])<=int(central['generation']), 'fresh verification at original verification time and current authenticated generation')
|
||||
|
||||
|
||||
def effective_pins(folder,session,checkpoint):
|
||||
"""Only one separately witnessed storage-only repair of this consumed reboot."""
|
||||
path=folder/'capacity-upgrade.json'
|
||||
if not path.exists():return session['pins']
|
||||
m=cloud.contract;record=m.protected_json(path);job=checkpoint['job']
|
||||
expected=dict(session_id='d015c3ef-f3aa-4522-a3c2-fcb6099df17b',job_id='8ffd0ce5-187e-4227-9fd4-374ac5fdf4aa',
|
||||
grant_id='25a4bf3f-772c-487d-825d-73bcbbc418fd',attempt_id=job['attempt_id'],target=session['target'])
|
||||
require(folder.name==session['id']==expected['session_id'] and job['job_id']==expected['job_id']
|
||||
and record.get('schema_version')==1 and record.get('type')=='rmm.reboot.storage-capacity-upgrade' and record.get('verified') is True
|
||||
and all(record.get(k)==v for k,v in expected.items()), 'exact original reboot storage repair only')
|
||||
require(record['session_before_sha256']==hashlib.sha256((folder/'before.json').read_bytes()).hexdigest()
|
||||
and record['checkpoint_sha256']==hashlib.sha256((folder/'checkpoint.json').read_bytes()).hexdigest(), 'historical session and approved checkpoint unchanged')
|
||||
def referenced(item,name):
|
||||
p=Path(item['path']).resolve()
|
||||
require(p==folder.resolve()/name and p.is_relative_to((cloud.ROOT/'devstate').resolve())
|
||||
and hashlib.sha256(p.read_bytes()).hexdigest()==item['sha256'], 'exact protected upgrade witness')
|
||||
return m.protected_json(p)
|
||||
witness=referenced(record['preservation_witness'],'proof-upgrade-before.json')
|
||||
runtime=referenced(record['runtime_report'],'capacity-runtime.json');frozen=witness['native']
|
||||
require(witness['gate']==dict(jobs=30,outbox=30,permits=26,unresolved=1)
|
||||
and witness['current']['job_id']==expected['job_id'] and witness['current']['attempt_id']==expected['attempt_id']
|
||||
and witness['current']['state']=='unknown' and witness['current']['result']['grant_id']==expected['grant_id']
|
||||
and frozen['boot_id']==record['new_boot_id']!=session['old_boot_id'], 'actual original consumed reboot and same newboot')
|
||||
require(all(runtime.get(k)==v for k,v in expected.items()) and runtime['new_boot_id']==record['new_boot_id']
|
||||
and runtime['completed'] is True and runtime['preserved_state'] is True and runtime['journals_preserved_before_restart'] is True
|
||||
and runtime['root_consumed']==18 and runtime['root_unresolved']==1 and runtime['agent_stopped'] is True
|
||||
and runtime['apt_endpoint_enabled'] is False and runtime['apt_runtime_ready'] is False
|
||||
and all(runtime[k] is False for k in ('jobs_created','grants_created','package_effects','reboot_requested')),
|
||||
'completed storage-only install without jobs, grants, package effects or another reboot')
|
||||
require(set(frozen['root_rows'])==set(session['before']['root_rows'])|{expected['grant_id']}
|
||||
and all(frozen['root_rows'][k]==v for k,v in session['before']['root_rows'].items())
|
||||
and runtime['root_rows_before']==runtime['root_rows_after']==frozen['root_rows']
|
||||
and runtime['database_inodes_before']==runtime['database_inodes_after']==frozen['database_inodes']==session['before']['database_inodes'],
|
||||
'all original 18 Root rows and database inodes preserved through replacement')
|
||||
enabled=m.protected_json(folder/'helper-enabled.json')
|
||||
require(runtime['general_pin']==enabled['general_pin']==frozen['general_pin']
|
||||
and runtime['journal_page_size']==4096 and runtime['journal_max_page_count']==262144 and runtime['journal_capacity_bytes']==1073741824
|
||||
and record['provider_sha256']==runtime['provider_sha256']=='1dc0237dd8df9c9d22568bb1f6b047ede73bc2a5fca5c7fcedb7f24ab2a58b1e',
|
||||
'unchanged General authority/provider and exact finite 1GiB storage correction')
|
||||
pins=dict(session['pins'])
|
||||
for name in ('agent','helper'):
|
||||
require(record['old_'+name+'_sha256']==runtime['old_'+name+'_sha256']==session['pins'][name+'_sha256'], 'original historical binary pin')
|
||||
metadata=referenced(record['qualification_reports'][name],name+'-reboot-capacity.json')
|
||||
binary=folder/(name+'-reboot-capacity')
|
||||
require(metadata['release_build'] is True and metadata['architecture']=='x86_64-unknown-linux-gnu'
|
||||
and metadata['provider_sha256']==record['provider_sha256'] and metadata['binary_sha256']==record[name+'_sha256']==runtime[name+'_sha256']
|
||||
and hashlib.sha256(binary.read_bytes()).hexdigest()==metadata['binary_sha256']
|
||||
and 'crates/privileged-helper/src/lib.rs' in metadata['source_files']
|
||||
and (name!='agent' or 'crates/agent/src/reconcile.rs' in metadata['source_files'])
|
||||
and all(hashlib.sha256((cloud.ROOT/p).read_bytes()).hexdigest()==h for p,h in metadata['source_files'].items()), 'qualified exact new storage-only release artifact')
|
||||
pins[name+'_sha256']=metadata['binary_sha256']
|
||||
return pins
|
||||
|
||||
|
||||
def enable(path):
|
||||
m=cloud.contract;target,pins=fixed();gates=prerequisites(path,target)
|
||||
require(evidence(target,'gate')['unresolved']==0,'no earlier unresolved work')
|
||||
@@ -237,11 +318,11 @@ def finish(ident):
|
||||
require(time.monotonic()<deadline,'reboot unproven; preserve unknown and do not repeat');time.sleep(3)
|
||||
require(result['state']=='succeeded','single reboot did not prove success; no retry')
|
||||
post=result['result']['evidence'];require(post['postconditions_passed'] is True and post['reconciled_after_reboot'] is True and post['new_boot_id']!=session['old_boot_id'],'actual newboot postcondition')
|
||||
central=cloud.bootstrap.rpc('server.conf',server_boot_evidence,dict(target,job_id=job['job_id'],inventory_message_id=post['inventory_message_id']))
|
||||
central=cloud.bootstrap.rpc('server.conf',server_boot_evidence,dict(target,job_id=job['job_id'],inventory_message_id=post['inventory_message_id'],verification_inventory_message_id=post['verification_inventory_message_id']))
|
||||
require(central['new_boot_id']==central['inventory_boot_id']==post['new_boot_id'] and central['original_boot_id']==session['old_boot_id'] and central['sync_ready'] and central['helper_ready'] and not central['restore_blocked'],'actual outgoing authenticated currentboot, persisted inventory and fresh signed Sync')
|
||||
reserved=m.timestamp(central['reserved_at']);received=m.timestamp(central['inventory_received_at'])
|
||||
require(reserved<received<=reserved+dt.timedelta(seconds=180) and m.timestamp(post['reboot_reserved_at'])==reserved and m.timestamp(post['reconnect_deadline'])==reserved+dt.timedelta(seconds=180),'original central deadline and timely independent receipt')
|
||||
native=cloud.bootstrap.rpc('linux-vm.conf',vm_state,dict(session['pins'],job_id=job['job_id'],attempt_id=job['attempt_id']))
|
||||
verify_reboot_receipts(session,job,result,central)
|
||||
pins=effective_pins(folder,session,checkpoint)
|
||||
native=cloud.bootstrap.rpc('linux-vm.conf',vm_state,dict(pins,job_id=job['job_id'],attempt_id=job['attempt_id']))
|
||||
sync=native['signed_sync'];require(native['boot_id']==post['new_boot_id'] and native['root_unresolved']==native['other_unresolved']==0 and native['database_inodes']==session['before']['database_inodes'] and len(native['root_rows'])==len(session['before']['root_rows'])+1 and all(native['root_rows'].get(k)==v for k,v in session['before']['root_rows'].items()),'preserved oldledgers/inodes and closedexactreboot')
|
||||
require(sync['ready'] and sync['helper_ready'] and sync['boot_id']==post['new_boot_id'] and native['agent_last_decision']==sync['decision_id'] and len(native['selected_root_grants'])==1 and native['selected_root_grants']==[result['result']['grant_id']],'same consumed grant and applied normal signed Sync')
|
||||
require(len(sync['selected'])==1 and sync['selected'][0]['grant_id']==result['result']['grant_id'] and sync['selected'][0]['outcome_state']=='succeeded','same signed reboot result')
|
||||
@@ -253,6 +334,7 @@ def finish(ident):
|
||||
def close(ident):
|
||||
m=cloud.contract;folder=STATE/str(uuid.UUID(ident));require(m.protected_json(folder/'result.json')['verified'],'normal verified reconnect required before rollback')
|
||||
session=m.protected_json(folder/'before.json');target=session['target'];opened=m.protected_json(folder/'policy-open.json');enabled=m.protected_json(folder/'helper-enabled.json')
|
||||
pins=effective_pins(folder,session,m.protected_json(folder/'checkpoint.json'))
|
||||
require(evidence(target,'gate')['unresolved']==0,'all effects closed')
|
||||
earlier=folder/'policy-closed-for-upgrade.json'
|
||||
if earlier.exists():
|
||||
@@ -260,7 +342,7 @@ def close(ident):
|
||||
require(current['closed'] and current['policy_sha256']==closed['policy_sha256'],'exact earlier deny-only closure retained')
|
||||
else:closed=cloud.bootstrap.rpc('server.conf',server_policy,dict(id=ident,action='close',previous_sha256=opened['policy_sha256']))
|
||||
m.write_private(folder/'policy-closed.json',closed)
|
||||
restored=cloud.bootstrap.rpc('linux-vm.conf',vm_policy,dict(session['pins'],id=ident,enabled=False,config_sha256=enabled['config_sha256'],pin_sha256=enabled['pin_sha256'],original_backup=enabled['backup']))
|
||||
restored=cloud.bootstrap.rpc('linux-vm.conf',vm_policy,dict(pins,id=ident,enabled=False,config_sha256=enabled['config_sha256'],pin_sha256=enabled['pin_sha256'],original_backup=enabled['backup']))
|
||||
require(restored['general_pin']==session['before']['general_pin'] and restored['config_sha256']==session['before']['config_sha256'] and restored['pin_sha256']==session['before']['pin_sha256'] and restored['preserved_state'] and not restored['reboot_requested'],'original non-reboot policy/pin bytes restored without another reboot')
|
||||
m.write_private(folder/'closed.json',dict(verified=True,policy=closed,helper=restored));print('Final reboot limits closed; exact original General policy/pin restored; no second reboot')
|
||||
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
# Tatsächlicher Implementierungsstand
|
||||
|
||||
## Journalursache nativ bestätigt und erhaltend korrigiert — 2026-11-13
|
||||
|
||||
Tatsächliche RootDBkopie am256MiB-Limit mitSQLITE_FULL13 reproduziert; derselbe
|
||||
512KiB-Insert unter endlichen1GiB gelang. Beide Rollbacks erhalten Schema/Zeilen,
|
||||
Originalbytes/-inode unverändert. Spec1.15/sharedRustfix mit126Tests/Format/
|
||||
Clippy und BookwormReleasebuild qualifiziert, Agent9e9f3230/Helperd6fbfc25 nativ
|
||||
versioniert installiert. Alle18Rootverbräuche, drei DBinodes, sämtliche History/
|
||||
Identitäts-/Paket-/Policynachweise erhalten. General läuft, Agent für folgenden
|
||||
normalen Sync zunächst gestoppt; Originalrebootweiterunknown, keine weitere
|
||||
Wirkung. APT-Endpunkt bleibt aus; historische3bac-Abnahmen bleiben exakt gültig,
|
||||
aktueller Helperhash verlangt separate kopierende Runtime-Requalifikation vor
|
||||
weiteren APTjobs. [Journalnachweise](journal-capacity.md).
|
||||
|
||||
## Original-Reboot erfolgt; Abschluss noch gesperrt — 2026-11-13
|
||||
|
||||
Der feste WebUI-genehmigte Job `8ffd0ce5-187e-4227-9fd4-374ac5fdf4aa`
|
||||
|
||||
@@ -17,8 +17,15 @@ BookwormReleasebuildc8f567a84f1c483e8cfea753e34e2c8f und126Tests im gleichen
|
||||
Lockfile-/Buildimage sowie Format/AlltargetsClippy bestanden. AgentSHA
|
||||
`9e9f323075f44e02e3900267b846f124303179171476a23d023708fc8339f9b4`,
|
||||
HelperSHA`d6fbfc25263243475c50e703c014772c359533548bccc3f09ff91072b0e8b929`;
|
||||
ELFx64/OpenSSL3/GLIBC2.34. Provider1dc unverändert. Dies ist noch **kein nativer
|
||||
Artefaktaustausch** und noch kein erfolgreicher Rebootabschluss.
|
||||
ELFx64/OpenSSL3/GLIBC2.34. Provider1dc unverändert. Native Installation danach ebenfalls bestanden: ausschließlich Agent/Helper
|
||||
versioniert ersetzt, General gestartet, Agent zunächst bewusst gestoppt. Vor
|
||||
und nach Austausch/start alle18Verbrauchszeilen, DBinodes, Journal-/Identitäts-/
|
||||
APT-Historybytes sowie Generalpolicy/-pin erhalten. Keine Jobs/Grants/Paketwirkung
|
||||
oder weiterer Reboot. Private capacity-runtime.json und separat hashgebundener
|
||||
capacity-upgrade.json erhalten Originalbefore.json/Checkpoint unverändert.
|
||||
Der aktuelle APT-Runtimepin muss wegen neuem Helperhash separat rein kopierend
|
||||
requalifiziert werden; Endpunkt bleibt aus. Noch kein erfolgreicher
|
||||
Rebootabschluss.
|
||||
|
||||
Die folgenden256MiB-Angaben sind historische Vorgängerqualifikationen; sie
|
||||
werden weder überschrieben noch als aktuelles1GiB-Installationszeugnis benutzt.
|
||||
|
||||
Reference in New Issue
Block a user