Skip to content

Commit

Permalink
Refactor to force HOTP sealing when needed.
Browse files Browse the repository at this point in the history
We want to seal against HOTP dongle here, no reason to skip presence. Force it.

USB drivers are loaded on demand prior of having calls to interrogate usb dongle, dongle should be detectable per host drivers if connected.

If not, there is either a bug in Nitrokey dongle firmware firmware, under hotp_verification, or prior code paths having interacted with gpg --card-info of gpg --card-edit.

Signed-off-by: Thierry Laurion <[email protected]>
  • Loading branch information
tlaurion committed Apr 18, 2024
1 parent a16c280 commit acaf29a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions initrd/bin/gui-init
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,23 @@ generate_totp_hotp()
tpm_owner_password="$1" # May be empty, will prompt if needed and empty
if [ "$CONFIG_TPM" != "y" ] && [ -x /bin/hotp_verification ]; then
echo "Generating new HOTP secret"
/bin/seal-hotpkey
# we loop calling /bin/seal-hotpkey until it succeeds
while ! /bin/seal-hotpkey; do
warn "Sealing HOTP secret failed, retrying..."
/bin/seal-hotpkey
done
elif echo -e "Generating new TOTP secret...\n\n" && /bin/seal-totp "$BOARD_NAME" "$tpm_owner_password"; then
echo
if [ -x /bin/hotp_verification ]; then
if [ "$CONFIG_TOTP_SKIP_QRCODE" != y ]; then
echo "Once you have scanned the QR code, hit Enter to configure your HOTP USB Security Dongle (e.g. Librem Key or Nitrokey)"
read
fi
/bin/seal-hotpkey
# we loop calling /bin/seal-hotpkey until it succeeds
while ! /bin/seal-hotpkey; do
warn "Sealing HOTP secret failed, retrying..."
/bin/seal-hotpkey
done
else
if [ "$CONFIG_TOTP_SKIP_QRCODE" != y ]; then
echo "Once you have scanned the QR code, hit Enter to continue"
Expand Down

0 comments on commit acaf29a

Please sign in to comment.