diff --git a/api/utils/keys/piv/yubikey.go b/api/utils/keys/piv/yubikey.go index bb1eccdc0e0fb..7a62e95e88f28 100644 --- a/api/utils/keys/piv/yubikey.go +++ b/api/utils/keys/piv/yubikey.go @@ -439,7 +439,11 @@ func (y *YubiKey) setPINAndPUKFromDefault(ctx context.Context, prompt hardwareke y.pinCache.mu.Lock() defer y.pinCache.mu.Unlock() - ctx, cancel := context.WithTimeout(ctx, pinPromptTimeout) + // Use a longer timeout than pinPromptTimeout since this specific prompt requires the user to + // re-type both PIN and PUK. The user might also want to save the values somewhere. + // pinPromptTimeout just doesn't give enough time for that. + const newPinPromptTimeout = 3 * time.Minute + ctx, cancel := context.WithTimeout(ctx, newPinPromptTimeout) defer cancel() pinAndPUK, err := prompt.ChangePIN(ctx, keyInfo) diff --git a/web/packages/teleterm/src/ui/ModalsHost/modals/HardwareKeys/ChangePin.tsx b/web/packages/teleterm/src/ui/ModalsHost/modals/HardwareKeys/ChangePin.tsx index efd87cb6f9a5e..5432db0c2e437 100644 --- a/web/packages/teleterm/src/ui/ModalsHost/modals/HardwareKeys/ChangePin.tsx +++ b/web/packages/teleterm/src/ui/ModalsHost/modals/HardwareKeys/ChangePin.tsx @@ -87,7 +87,7 @@ export function ChangePin(props: { The default PIV PIN is not allowed.
Please set a new PIV PIN for your hardware key before - proceeding. Both the PIN and PUK must be 4-6 characters long. + proceeding. Both the PIN and PUK must be 6–8 characters long. @@ -145,7 +145,7 @@ export function ChangePin(props: { rule={requiredAll( requiredField('PUK is required'), notDefaultPuk(), - correctLength('PUK must be 4-6 characters long') + correctLength('PUK must be 6–8 characters long') )} /> ) : ( @@ -159,7 +159,7 @@ export function ChangePin(props: { rule={requiredAll( requiredField('New PUK is required'), notDefaultPuk(), - correctLength('PUK must be 4-6 characters long') + correctLength('PUK must be 6–8 characters long') )} /> setConfirmNewPuk(e.target.value)} mb={0} rule={requiredAll( - requiredConfirmed(pin, { + requiredConfirmed(newPuk, { confirm: 'Confirm New PUK is required', doesNotMatch: 'PUK does not match', }), notDefaultPuk(), - correctLength('PUK must be 4-6 characters long') + correctLength('PUK must be 6–8 characters long') )} /> @@ -221,7 +221,7 @@ const correctLength = value => () => { const valid = - typeof value === 'string' && value.length >= 4 && value.length <= 6; + typeof value === 'string' && value.length >= 6 && value.length <= 8; return { valid, message: !valid ? message : '',