You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Add local rc declarations in gpg_card_factory_reset,
gpg_card_change_pin, and gpg_keytocard_subkeys to prevent
global scope leaks
- Add _luks_cleanup helper to close LUKS mappings on all error
paths (removed broken EXIT trap that does not fire on function
return)
- Re-run NK3 Secrets app reset with custom PIN when factory
reset is retried from default to custom PIN
- Add chmod 600 on /tmp/secret/gpg_pin to match existing
cache_gpg_signing_pin convention
- Fix recovery-shell.md auth scope: USB/external media boot
is also gated by gpg_auth via media-scan.sh
Signed-off-by: Thierry Laurion <insurgo@riseup.net>
# Ensure LUKS mappings are cleaned up on any exit path (error or normal)
452
-
trap'umount /media 2>/dev/null || true; for d in /dev/mapper/usb_mount_*; do [ -e "$d" ] && cryptsetup close "$(basename "$d")" 2>/dev/null || true; done' EXIT
453
-
454
464
# Detect dongle branding early -- needed for whiptail messages and
455
465
# Nitrokey Storage AES key reset in factory_reset_and_configure.
--yesno "The backed-up key is ECC P-256, but your $DONGLE_BRAND\nmay have limited ECC support.\n\nProceeding may fail.\n\nDo you want to continue?" 0 80;then
598
608
DEBUG "User aborted: ECC key incompatible with dongle"
--yesno "This will:\n\n * ERASE all keys on your $DONGLE_BRAND\n * Import GPG key: $identity_summary\n (${key_algo}$([ "$key_algo"="RSA" ] &&echo"${rsa_key_length}-bit"))\n * Copy subkeys to the smartcard\n\nDo you want to continue?" 0 80;then
613
623
DEBUG "User declined reprovision via confirmation dialog"
614
-
umount /media 2>/dev/null ||true
624
+
_luks_cleanup
615
625
return 1
616
626
fi
617
627
DEBUG "User confirmed reprovision; proceeding with factory reset"
618
628
619
629
# Re-verify the smartcard is still present before wiping it
620
630
STATUS "Verifying $DONGLE_BRAND smartcard is still present"
621
631
if! gpg --card-status >/dev/null 2>&1;then
622
-
umount /media 2>/dev/null ||true
632
+
_luks_cleanup
623
633
WARN "$DONGLE_BRAND smartcard disappeared after user confirmation"
624
634
whiptail_error --title 'ERROR: Smartcard Not Found' \
625
635
--msgbox "The $DONGLE_BRAND smartcard is no longer detected.\n\nCheck the connection and try again." 0 80
0 commit comments