Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion initrd/bin/oem-factory-reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,9 @@ gpg_key_factory_reset() {
if [ "$DONGLE_BRAND" = "Nitrokey Storage" ] && [ -x /bin/hotp_verification ]; then
STATUS "Resetting Nitrokey Storage AES keys"
hotp_verification regenerate ${ADMIN_PIN_DEF}
# see https://github.com/Nitrokey/heads/commit/397a46203bedcb77aeac24917e7fe254465128fb
STATUS "Restarting scdaemon to remove possible exclusive lock of dongle"
release_scdaemon
STATUS_OK "Nitrokey Storage AES keys reset"
fi

Expand Down Expand Up @@ -1389,7 +1392,7 @@ assert_signable

# clear gpg-agent and scdaemon cache so that next gpg calls don't have stale state
# scdaemon holds exclusive CCID lock to dongle - must be killed to allow fresh card access
killall gpg-agent scdaemon >/dev/null 2>&1 || true
release_scdaemon
# clear local keyring
rm -rf /.gnupg/*.kbx /.gnupg/*.gpg >/dev/null 2>&1 || true

Expand Down
2 changes: 1 addition & 1 deletion initrd/bin/seal-hotpkey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ STATUS_OK "$DONGLE_BRAND detection ready for HOTP configuration"
TRACE_FUNC

# Make sure no conflicting GPG related services are running, gpg-agent will respawn
DO_WITH_DEBUG killall gpg-agent scdaemon >/dev/null 2>&1 || true
DO_WITH_DEBUG release_scdaemon

# Query hotp_verification info and extract numeric PIN retry counter.
# Retries up to N times on communication failure. Dies if the dongle
Expand Down
1 change: 1 addition & 0 deletions initrd/etc/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@ hotpkey_fw_display() {
# immediately. Both must be killed; gpg-agent and scdaemon respawn on demand
# for the next GPG operation.
release_scdaemon() {
TRACE_FUNC
DEBUG "release_scdaemon: killing gpg-agent and scdaemon to release CCID lock"
killall gpg-agent scdaemon >/dev/null 2>&1 || true
}
Expand Down