Prepare usage of /boot/kexec_hotp_key as branding

This commit is contained in:
alex-nitrokey 2020-06-24 16:11:41 +02:00
parent 28735a8c84
commit 53b67d27a4
No known key found for this signature in database
GPG Key ID: A8853020E8EE6FBA
3 changed files with 15 additions and 4 deletions

View File

@ -48,9 +48,6 @@ include $(CONFIG)
# Unless otherwise specified, we are building for heads
CONFIG_HEADS ?= y
# HOTP USB Security naming if not specified in boards config
CONFIG_HOTPKEY_BRANDING ?= "HOTP USB Security dongle"
# Some things want usernames, we use the current checkout
# so that they are reproducible
GIT_HASH := $(shell git rev-parse HEAD)

View File

@ -3,6 +3,12 @@
CONFIG_BOOT_GUI_MENU_NAME='Heads Boot Menu'
if [ -r /boot/kexec_hotp_key ]; then
CONFIG_HOTPKEY_BRANDING="$(cat /boot/kexec_hotp_key)"
else
CONFIG_HOTPKEY_BRANDING="HOTP USB security dongle"
fi
. /etc/functions
. /tmp/config
@ -93,7 +99,7 @@ update_totp()
echo "Scan the QR code to add the new TOTP secret"
/bin/seal-totp
if [ -x /bin/libremkey_hotp_verification ]; then
echo "Once you have scanned the QR code, hit Enter to configure your $(CONFIG_HOTPKEY_BRANDING)"
echo "Once you have scanned the QR code, hit Enter to configure your HOTP USB security dongle (e.g. Librem Key or Nitrokey)"
read
/bin/seal-libremkey
else

View File

@ -6,6 +6,10 @@
HOTP_SEALED="/tmp/secret/hotp.sealed"
HOTP_SECRET="/tmp/secret/hotp.key"
HOTP_COUNTER="/boot/kexec_hotp_counter"
HOTP_KEY="/boot/kexec_hotp_key"
CONFIG_HOTPKEY_BRANDING="HOTP USB security dongle"
mount_boot()
{
@ -59,6 +63,8 @@ if ! libremkey_hotp_verification info ; then
fi
fi
# TODO find out branding now and set variable
echo -e ""
read -s -p "Enter your $(CONFIG_HOTPKEY_BRANDING) Admin PIN: " admin_pin
echo -e "\n"
@ -75,6 +81,8 @@ if [ $? -ne 0 ]; then
fi
fi
# TODO store key branding in HOTP_KEY
# HOTP key no longer needed
shred -n 10 -z -u "$HOTP_SECRET" 2> /dev/null