Scope enrollment membership migration and use pull-only deployed gateway

This commit is contained in:
2026-11-17 16:03:54 +01:00
parent 7fd17272d5
commit 60f8f21f54
8 changed files with 258 additions and 67 deletions
+8 -5
View File
@@ -176,7 +176,7 @@ function WindowsMsiCatalog({ tenantId, auth }: { tenantId: string; auth: Session
function AgentReleaseCatalog({ tenantId, auth }: { tenantId: string; auth: Session }) {
const [cursor, setCursor] = useState<string | null>(null), [revision, setRevision] = useState(0), [source, setSource] = useState('{}'), [busy, setBusy] = useState(false), [error, setError] = useState<string | null>(null), [receipts, setReceipts] = useState<unknown[]>([]);
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null } | null>(null);
const [enrollment, setEnrollment] = useState<{ token: string; expires: string; origin: string | null; platforms: string[] } | null>(null);
const [enrollmentError, setEnrollmentError] = useState<string | null>(null);
const [issuing, setIssuing] = useState(false);
const list = useResource(async signal => {
@@ -212,14 +212,17 @@ function AgentReleaseCatalog({ tenantId, auth }: { tenantId: string; auth: Sessi
try {
const result = record(await request(tenantPath(tenantId, '/enrollment-tokens'), { body: {}, csrf: auth.csrf_token }));
if (typeof result.token !== 'string' || !/^[a-f0-9]{64}$/.test(result.token) || typeof result.expires_at !== 'string') throw new Error('Ungültiger Einmalcode');
setEnrollment({ token: result.token, expires: result.expires_at, origin: typeof result.bootstrap_origin === 'string' ? new URL(result.bootstrap_origin).origin : null });
setEnrollment({ token: result.token, expires: result.expires_at, origin: typeof result.bootstrap_origin === 'string' ? new URL(result.bootstrap_origin).origin : null,
platforms: Array.isArray(result.release_platforms) ? result.release_platforms.filter((p): p is string => typeof p === 'string') : [] });
} catch (error) { setEnrollmentError(errorText(error)); } finally { setIssuing(false); }
}}>Einmalcode erstellen</button>
<ErrorBox error={enrollmentError}/>
{enrollment && <><label>Einmalcode gültig bis {new Date(enrollment.expires).toLocaleString()}<input readOnly value={enrollment.token}/></label><button onClick={() => setEnrollment(null)}>Code ausblenden</button>
{enrollment.origin && <><p>Linux, mit einem Administratorkonto ausführen</p><pre>{`curl --fail --show-error --silent '${enrollment.origin}/install/linux.sh' -o linux.sh && sudo sh linux.sh '${enrollment.origin}'`}</pre>
<p>Windows, in einer administrativen Windows PowerShell ausführen</p><pre>{`Invoke-WebRequest -UseBasicParsing '${enrollment.origin}/install/windows.ps1' -OutFile .\\windows.ps1
.\\windows.ps1 -BootstrapBase '${enrollment.origin}'`}</pre></>}
{enrollment.origin && enrollment.platforms.includes('x86_64-unknown-linux-gnu') && <><p>Linux, mit einem Administratorkonto ausführen</p><pre>{`curl --fail --show-error --silent '${enrollment.origin}/install/linux.sh' -o linux.sh && sudo sh linux.sh '${enrollment.origin}'`}</pre></>}
{enrollment.origin && ['x86_64-pc-windows-msvc','x86_64-pc-windows-gnu'].filter(p => enrollment.platforms.includes(p)).map(platform =>
<div key={platform}><p>Windows {platform.endsWith('-gnu') ? 'GNU (Entwicklungsrelease)' : 'MSVC'}, in einer administrativen Windows PowerShell ausführen</p>
<pre>{`Invoke-WebRequest -UseBasicParsing '${enrollment.origin}/install/windows.ps1' -OutFile .\\windows.ps1
.\\windows.ps1 -BootstrapBase '${enrollment.origin}' -Platform '${platform}'`}</pre></div>)}
</>}
</details>
</section>;