@@ -40,6 +40,9 @@ type InstallOptions = {
4040 zitadelAdminEmail ?: string ;
4141} ;
4242
43+ const LXD_API_POLL_TIMEOUT_MS = 90 * 1000 ;
44+ const LXD_API_VERIFY_TIMEOUT_MS = 2 * 60 * 1000 ;
45+
4346function baseEmail ( ctx : IntegrationContext ) : string {
4447 return `terrarium+${ ctx . config . slug } @${ ctx . config . ipDnsDomain } ` ;
4548}
@@ -325,34 +328,36 @@ export async function verifyManagementSurfaces(
325328
326329/** Verifies the public LXD endpoint serves the real API over trusted TLS and does not expose trusted anonymous access. */
327330export async function verifyLxdApi ( host : ManagedHost , context ?: IntegrationContext ) : Promise < void > {
328- context ?. logger . info ( `verify ${ host . label } LXD API` ) ;
329- await expectHttpsJson (
330- `https://${ host . domains . lxd } /1.0` ,
331- ( body ) => {
332- if ( ! isObject ( body ) ) {
333- throw new Error ( "LXD API root did not return an object" ) ;
334- }
335-
336- const metadata = body . metadata ;
337- if ( ! isObject ( metadata ) ) {
338- throw new Error ( "LXD API root did not include metadata" ) ;
339- }
340-
341- if ( ! Array . isArray ( metadata . api_extensions ) ) {
342- throw new Error ( "LXD API root did not include api_extensions" ) ;
343- }
344-
345- const auth = typeof metadata . auth === "string" ? metadata . auth . toLowerCase ( ) : "" ;
346- if ( ! auth ) {
347- throw new Error ( "LXD API root did not include auth state" ) ;
348- }
349- if ( auth === "trusted" ) {
350- throw new Error ( "LXD API root allowed trusted anonymous access" ) ;
351- }
352- } ,
353- { timeoutMs : 300000 , resolveIp : host . server . ipv4 }
354- ) ;
355- context ?. logger . info ( `verified ${ host . label } LXD API` ) ;
331+ await withStepTimeout ( `LXD API verification for ${ host . label } ` , LXD_API_VERIFY_TIMEOUT_MS , async ( ) => {
332+ context ?. logger . info ( `verify ${ host . label } LXD API` ) ;
333+ await expectHttpsJson (
334+ `https://${ host . domains . lxd } /1.0` ,
335+ ( body ) => {
336+ if ( ! isObject ( body ) ) {
337+ throw new Error ( "LXD API root did not return an object" ) ;
338+ }
339+
340+ const metadata = body . metadata ;
341+ if ( ! isObject ( metadata ) ) {
342+ throw new Error ( "LXD API root did not include metadata" ) ;
343+ }
344+
345+ if ( ! Array . isArray ( metadata . api_extensions ) ) {
346+ throw new Error ( "LXD API root did not include api_extensions" ) ;
347+ }
348+
349+ const auth = typeof metadata . auth === "string" ? metadata . auth . toLowerCase ( ) : "" ;
350+ if ( ! auth ) {
351+ throw new Error ( "LXD API root did not include auth state" ) ;
352+ }
353+ if ( auth === "trusted" ) {
354+ throw new Error ( "LXD API root allowed trusted anonymous access" ) ;
355+ }
356+ } ,
357+ { timeoutMs : LXD_API_POLL_TIMEOUT_MS , resolveIp : host . server . ipv4 }
358+ ) ;
359+ context ?. logger . info ( `verified ${ host . label } LXD API` ) ;
360+ } ) ;
356361}
357362
358363/** Verifies a real browser login through LXD's public OIDC flow. */
0 commit comments