Build and serve signed Linux ARM64 agent releases

This commit is contained in:
2026-11-18 17:58:12 +01:00
parent c599baa494
commit 247646a2ba
27 changed files with 151 additions and 88 deletions
+2 -2
View File
@@ -25,7 +25,7 @@ export function releaseEnvelope(value: unknown): ReleaseView {
if (!bytes.length || bytes.length > 16384 || signature.length !== 64) throw new Error('Agentupdate: Manifest-/Signaturlimit');
const m = record(JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)));
exact(m, ['schema_version', 'release_id', 'release_sequence', 'version', 'platform', 'published_at', 'expires_at', 'protocol_major', 'state_schema', 'minimum_updater_version', 'artifacts']);
if (m.schema_version !== 1 || !['x86_64-unknown-linux-gnu', 'x86_64-pc-windows-msvc', 'x86_64-pc-windows-gnu'].includes(String(m.platform)) || typeof m.version !== 'string' || !/^[A-Za-z0-9.+_-]{1,64}$/.test(m.version)
if (m.schema_version !== 1 || !['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'x86_64-pc-windows-msvc', 'x86_64-pc-windows-gnu'].includes(String(m.platform)) || typeof m.version !== 'string' || !/^[A-Za-z0-9.+_-]{1,64}$/.test(m.version)
|| !Array.isArray(m.artifacts) || m.artifacts.length !== 2) throw new Error('Agentupdate: festes x64-Codepaar erforderlich');
const artifacts = m.artifacts.map((value, index) => { const a = record(value); exact(a, ['role', 'artifact_id', 'sha256', 'bytes']); if (a.role !== ['agent', 'helper'][index]) throw new Error('Agentupdate: Agent-/Helperreihenfolge'); return { role: a.role, artifact_id: uuid(a.artifact_id), sha256: digest(a.sha256), bytes: integer(a.bytes, 1, 268435456) }; });
if (artifacts[0]!.artifact_id === artifacts[1]!.artifact_id) throw new Error('Agentupdate: doppelte Artefakt-ID');
@@ -55,7 +55,7 @@ export function validateAgentUpdateAction(value: unknown, identity: unknown): Re
const action = record(value); exact(action, ['action', 'update']); if (action.action !== 'update_agent') throw new Error('Agentupdate: typisierte Aktion erforderlich');
const u = record(action.update); exact(u, ['schema_version', 'profile', 'release_envelope', 'release_envelope_sha256', 'manifest_sha256', 'predecessor', 'updater', 'peer_pin_transition', 'recovery', 'health_profile', 'health_timeout_seconds', 'no_reboot']);
if (u.schema_version !== 1 || u.profile !== 'fixed_code_pair_v1' || u.recovery !== 'restore_exact_predecessor_once' || u.health_profile !== 'mtls_inventory_sync_v1' || u.health_timeout_seconds !== 180 || u.no_reboot !== true) throw new Error('Agentupdate: fester Apply-/Health-/No-Reboot-Vertrag erforderlich');
const release = releaseEnvelope(u.release_envelope), linux = release.manifest.platform === 'x86_64-unknown-linux-gnu';
const release = releaseEnvelope(u.release_envelope), linux = release.manifest.platform.endsWith('-unknown-linux-gnu');
if (identity !== (linux ? 'root' : 'system')) throw new Error('Agentupdate: Plattform und Root-/SYSTEM-Identität widersprechen sich');
const old = record(u.predecessor); exact(old, ['release_id', 'release_sequence', 'manifest_sha256', 'installed_record_sha256', 'agent_sha256', 'helper_sha256']);
const predecessor = { release_id: uuid(old.release_id), release_sequence: integer(old.release_sequence), manifest_sha256: digest(old.manifest_sha256), installed_record_sha256: digest(old.installed_record_sha256), agent_sha256: digest(old.agent_sha256), helper_sha256: digest(old.helper_sha256) };
+6 -2
View File
@@ -200,7 +200,11 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
const [copied, setCopied] = useState(false);
const [adminScripts, setAdminScripts] = useState(false);
const origin = enrollment?.origin;
const linuxInstaller = origin && enrollment.platforms.includes('x86_64-unknown-linux-gnu') ? `${origin}/install/linux.sh` : null;
const linuxArchitectures = [
['x86_64-unknown-linux-gnu', 'x86-64'],
['aarch64-unknown-linux-gnu', 'ARM64'],
].filter(([target]) => enrollment?.platforms.includes(target)).map(([, label]) => label);
const linuxInstaller = origin && linuxArchitectures.length > 0 ? `${origin}/install/linux.sh` : null;
const windowsPlatforms = ['x86_64-pc-windows-gnu', 'x86_64-pc-windows-msvc'].filter(platform => enrollment?.platforms.includes(platform));
const windowsInstaller = origin && windowsPlatforms.length > 0 ? `${origin}/install/windows.ps1` : null;
return <section aria-label="Gerät aufnehmen"><h2>Gerät aufnehmen</h2>
@@ -241,7 +245,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
{enrollment && !origin && <p role="status">Für die Geräteaufnahme ist keine HTTPS-Downloadadresse konfiguriert.</p>}
{origin && !linuxInstaller && !windowsInstaller && <p role="status">Für diesen Kunden ist derzeit kein Linux- oder Windows-Installer verfügbar.</p>}
{linuxInstaller && <>
<h4>Linux (x86-64)</h4>
<h4>Linux ({linuxArchitectures.join(' und ')})</h4>
<p>Installationsskript <a href={linuxInstaller} target="_blank" rel="noopener noreferrer">linux.sh</a></p>
<pre>{`curl --fail --show-error --silent '${linuxInstaller}' -o linux.sh && sudo sh linux.sh '${origin}'${adminScripts ? ' --enable-admin-scripts' : ''}`}</pre>
</>}