@ -151,13 +151,15 @@ func runNetworkLockInit(ctx context.Context, args []string) error {
return nil
return nil
}
}
fmt . Printf ( "%d disablement secrets have been generated and are printed below. Take note of them now, they WILL NOT be shown again.\n" , nlInitArgs . numDisablements )
var successMsg strings . Builder
fmt . Fprintf ( & successMsg , "%d disablement secrets have been generated and are printed below. Take note of them now, they WILL NOT be shown again.\n" , nlInitArgs . numDisablements )
for range nlInitArgs . numDisablements {
for range nlInitArgs . numDisablements {
var secret [ 32 ] byte
var secret [ 32 ] byte
if _ , err := rand . Read ( secret [ : ] ) ; err != nil {
if _ , err := rand . Read ( secret [ : ] ) ; err != nil {
return err
return err
}
}
fmt . Printf( "\tdisablement-secret:%X\n" , secret [ : ] )
fmt . Fprintf( & successMsg , "\tdisablement-secret:%X\n" , secret [ : ] )
disablementValues = append ( disablementValues , tka . DisablementKDF ( secret [ : ] ) )
disablementValues = append ( disablementValues , tka . DisablementKDF ( secret [ : ] ) )
}
}
@ -168,7 +170,7 @@ func runNetworkLockInit(ctx context.Context, args []string) error {
return err
return err
}
}
disablementValues = append ( disablementValues , tka . DisablementKDF ( supportDisablement ) )
disablementValues = append ( disablementValues , tka . DisablementKDF ( supportDisablement ) )
fmt . Println( "A disablement secret for Tailscale support has been generated and will be transmitted to Tailscale upon initialization .")
fmt . Fprintln( & successMsg , "A disablement secret for Tailscale support has been generated and transmitted to Tailscale.")
}
}
// The state returned by NetworkLockInit likely doesn't contain the initialized state,
// The state returned by NetworkLockInit likely doesn't contain the initialized state,
@ -177,6 +179,7 @@ func runNetworkLockInit(ctx context.Context, args []string) error {
return err
return err
}
}
fmt . Print ( successMsg . String ( ) )
fmt . Println ( "Initialization complete." )
fmt . Println ( "Initialization complete." )
return nil
return nil
}
}