Bind essentials recovery to explicit manifest and verified offsite provenance
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06ecb-456a-71c2-b41e-0755d336e883
This commit is contained in:
parent
4707bf08d7
commit
11322a5256
7 changed files with 151 additions and 14 deletions
|
|
@ -6,6 +6,7 @@ import urllib.request
|
|||
import shutil
|
||||
import hashlib
|
||||
import json
|
||||
import zipfile
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
|
@ -56,7 +57,10 @@ def run(source, directory, receipt):
|
|||
result = subprocess.run(['age','-d','-i','/dev/stdin',str(encrypted)],
|
||||
input=(values['AGE_PRIVATE_KEY'].strip()+'\n').encode(), stdout=output, stderr=subprocess.PIPE, timeout=1200)
|
||||
require(result.returncode == 0, 'offsite_decryption_failed')
|
||||
receipt.update(decrypted=True, plaintext_sha256=sha(plain), quota_after=quota(auth), status='offsite_fetched_pending_isolated_restore')
|
||||
with zipfile.ZipFile(plain) as archive:
|
||||
profile=json.loads(archive.read('backup-manifest.json'))['profile'] if 'backup-manifest.json' in archive.namelist() else 'full'
|
||||
require(profile in ('full','essentials'), 'unknown_archive_profile')
|
||||
receipt.update(archive_profile=profile,decrypted=True, plaintext_sha256=sha(plain), quota_after=quota(auth), status='offsite_fetched_pending_isolated_restore')
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue