Phishing-resistant sign-in
With FIDO2/WebAuthn, the key checks the website you sign in to, so a fake lookalike site cannot reuse the sign-in in the same way.
Hardware authentication and continuity
Start with what a YubiKey is and why to use one. Then explore a two-key setup, recovery procedures and advanced certificate architecture for individuals and businesses.
Understand in 60 seconds
A YubiKey is a small physical security key, usually USB and sometimes NFC. It proves you actually have the key when you sign in to an account. On compatible services it can replace SMS codes and even the password.
With FIDO2/WebAuthn, the key checks the website you sign in to, so a fake lookalike site cannot reuse the sign-in in the same way.
For FIDO2 and PIV keys generated on the device, the private key need not leave the YubiKey.
Depending on the service, plug it in or use NFC, touch the sensor and sometimes enter a PIN.
Registering a second key ahead of time avoids relying on a single device if one is lost or broken.
Important: a YubiKey is not a universal password backup. The service must support the selected method. FIDO2/WebAuthn, OTP, OpenPGP and PIV are different features: for most web accounts, FIDO2 is enough and no X.509 certificate is needed.
Learn how to secure an online account with FIDO2, without certificates or a PKI.
Review known inventory, checks, backups and recovery procedures for this environment.
Explore PIV, X.509 certificates, Entra CBA, Vault PKI and role-based choices.
Public conceptual diagram. No serial numbers, PINs/PUKs, OTP seeds, private keys, personal certificates, escrow paths or account identifiers are published. 'Documented' reflects a past observation, not a check performed today.
ykman-style view based on inspections from 31 October to 4 November 2026 and on the slot 2 restoration of 29 November, not a live scan. Each state only describes the specific check performed.
USB-C · NFC (PIV and OpenPGP off) · firmware 5.4.3
USB-A · NFC (PIV and OpenPGP off) · firmware 5.4.3
Slot 1 = short touch: triggers OTP configuration 1, here Yubico OTP used by Vaultwarden (WebAuthn being rolled out). A stray touch has already typed a code into a terminal.
Slot 2 = long touch (~3 s) for keyboard OTP output. In HMAC-SHA1 mode, KeePassXC sends a challenge to the key: a long touch alone does not type any code. An approval touch may be required. The homelab kill switch does not use this slot: its disarm uses a FIDO2 signature (decided on 29 Nov after a conflict with KeePassXC).
FIDO2, SSH or PIV touch confirmation does not trigger an OTP slot. PIV slots 9A/82 are a separate namespace.
| Protection | Factory default | Factory retry limit |
|---|---|---|
| FIDO2 / passkeys | No default PIN | 8 (reinsert after 3 failures) |
| PIV PIN | 123456 | 3 |
| PIV PUK | 12345678 | 3 |
| OpenPGP user PIN | 123456 | Read from device |
| OpenPGP admin PIN | 12345678 | Read from device |
These are factory defaults, not the device's current codes. The PIV PUK only unblocks the PIV PIN. OpenPGP has its own reset code; FIDO2 has no PUK. The PIV management key (AES-256 on the inspected devices) is distinct from the PIN.
Connect one key at a time. These commands read metadata and counters without entering a PIN. Do not publish output: it may contain identifiers.
ykman info
ykman otp info
ykman piv info
ykman fido info
ykman openpgp infoDetailed runbook: provenance, filenames, mounts, verification and restore
Migration and validation status (nabla-yubikey)
Public guide: only generic paths appear here. Operational details belong in the runbooks. No private identity, PIN or vault contents are shown.
State recorded in nabla-yubikey as of 29 November 2026, with the checks run from 31 October to 4 November. This is not live telemetry: a GO diagnostic does not prove a backup can be restored.
Verified with both keys
Vault opened using OTP slot 2 HMAC-SHA1 on each key alone. After slot 2 was restored on 29 Nov, the NAS copy opens again (attested by the owner) and the Dropbox copy opens with one of the keys.
Read the runbookVerified for GitHub
GitHub accepts each key on its own: the primary on 31 Oct, the backup on 1 Nov. The TrueNAS server still refused the FIDO2 SSH keys on 3 Nov. A fix for the SSH agent starting without a display under Wayland is documented.
Read the runbookConfigured, primary to replay
On 4 Nov, NFC was restricted (PIV and OpenPGP off over NFC) and YubiHSM Auth disabled on both keys. The probe is GO on the backup; it still has to be replayed on the primary connected alone. No OpenPGP key slot was filled on the device inspected on 31 Oct.
Read the runbookGitHub verified
Both keys are GitHub passkeys (attested on 1 Nov). For other services, registering both keys is only declared by the operator, and AWS is still to do. Vaultwarden is moving from Yubico OTP to WebAuthn (guide of 4 Nov). No TOTP account is shared by the two keys.
Read the runbookIncomplete
The KeePassXC key file has an offline copy (age archive read back on 1 Nov) and a copy on the encrypted escrow USB; the local and NAS encrypted copies are identical (3 Nov). A full restore is not proven.
Gate tested, disarm not run
Decision of 29 Nov: the disarm uses a FIDO2 signature with the existing SSH-sk keys (PIN and touch), public keys only on the verifier; slot 2 stays with KeePassXC. The first HMAC-SHA1 design was dropped: it had overwritten the vault secret, restored the same day. Gate test with each key alone: passed (owner-observed). arm and disarm on the homelab: not run (NOT_RUN).
Read the runbookFrom a nabla-yubikey checkout, with one YubiKey connected at a time. These commands do not enter a PIN or unlock a vault. GO only applies to the checks performed.
just dependencies-readonly
just applets-readonly
just ssh-fido2-readonly
just keepassxc-readonlyMigration done: nabla-yubikey PR #1 (merged)
Runbooks are pinned to a master commit; the kill switch note is pinned to PR #6, still a Draft. Never expose serial numbers, PINs, private fingerprints, vault names or export files on the website.
Select a node to explore its role. Links describe intended dependencies, not automatic synchronization of private keys between devices.
The backup YubiKey must be enrolled separately with each service; its private keys are not cloned automatically.
Target design, not deployed: each YubiKey retains its private key. Vault signs certificate requests (CSRs) and publishes certificates and revocation information.
An offline root CA delegates signing to a Vault PKI intermediate issuing authority.
Each YubiKey creates its own private PIV 9A key and CSR without exporting private material.
Vault signs both CSRs. Clients verify the X.509 chain and certificate revocation status (CRL).
Each certificate has an independent lifecycle and can be renewed or revoked separately.
Two separate security keys require distinct key pairs and certificates. Corporate credentials remain governed by enterprise PKI. This guide does not write to either YubiKey.
A YubiKey 5 has PIV slots, but identity certificates in 9A/9C/9D/9E are not automatically preinstalled. The factory attestation certificate is not an Entra ID login certificate.
X.509 certificate for smartcard/Entra CBA; not factory-provisioned.
Signing certificate when provisioned; not automatically present.
Plan recovery before use.
Not automatically an Entra CBA identity.
Encryption key history, not interchangeable login identities.
Factory Yubico attestation certificate; not a workplace identity.
Administration secret, not an X.509 certificate.
PIV slots are separate from the two physical OTP slots. PIN, PUK and management key are shared by the PIV application; multiple certificates do not mean independent environments.
The browser or operating system performs certificate authentication; YubiKey proves possession of its private key without exposing it. Entra validates CA trust, expiry, CRL revocation and user mapping; Conditional Access then determines access. CBA is not automatically MFA: configure strong mapping and authentication policy.
A PIV applet without an X.509 identity certificate is insufficient for Entra CBA. FIDO2/WebAuthn works without a personal PIV certificate.
The corporate CA must remain governed by the company. Do not add a personal Vault PKI CA to the tenant trust list without formal IAM approval. The private key stays on YubiKey.
Not solely for phishing-resistant MFA: FIDO2 is simpler to operate. CBA makes sense with an existing PKI, smartcards, legacy applications or certificate/compliance requirements. It entails issuance, renewal, CRLs, recovery and user support.
Hardware FIDO2 first; CBA only when smartcard/PKI is required.
Passkeys, Windows Hello for Business or Mac Platform SSO; CBA only when needed.
Home-tenant MFA with Cross-Tenant Access trust and corporate policy.
PIV 9C/9D certificates with defined CA and recovery process.
YubiKey FIDO2 alone: no PIV certificate needed.
Reference documentation: Microsoft Entra CBA · Yubico PIV · Vault PKI
Inspect USB/NFC, firmware and FIDO2, OTP, PIV and OpenPGP capabilities on both devices without changing slots.
Enroll both keys separately on each critical account, retain an independent recovery method, and test sign-in with each.
Keep a dedicated backup hardware SSH key (ed25519-sk), verify touch and PIN requirements, and test access non-destructively.
Inspect slots (including 9A and 82), expiration and trust chain; renew expired certificates only after backup and explicit authorization.
Document OpenPGP and GPG-agent/pcscd integration; distinguish PIV certificates, OpenPGP subkeys and FIDO-backed SSH.
Keep the legacy challenge-response mechanism separate from FIDO2. Validate the slot and client without revealing or reprogramming the secret.
Create two separate age archives; validate fingerprints and recovery paths without secrets in logs. Stop if both backups refer to the same file.
Verify unlock using the primary key and a backup scenario; document dependencies and rotation after loss.
Simulate losing the primary key: critical accounts, SSH, vault, certificates, archive recovery and redacted evidence.
Illustrative commands for an already configured environment. Variables prefixed with $ and hostnames are examples. This page never provisions a physical YubiKey.
15 of 15 examples
Enroll both YubiKeys separately on GitHub, Cloudflare, or another WebAuthn-compatible identity provider. Test each key independently.
Prerequisites : Compatible account, existing working access, and independent recovery method.
Caution : Use the service security settings: register the primary and backup keys separately. Do not depend on one authenticator.
Reference : FIDO Alliance
Use an already-enrolled ed25519-sk hardware identity. Authentication normally requires touch and optionally PIN.
Prerequisites : FIDO-enabled OpenSSH, public key registered in authorized_keys, and independent SSH recovery access.
Caution : Do not replace the only working SSH access. The local key file is a handle, not the hardware private key.
ssh -V
ssh -i ~/.ssh/id_ed25519_sk user@host.exampleReference : Yubico SSH FIDO2
Sign commits with a dedicated FIDO-backed SSH identity, preferably separate from the SSH login key.
Prerequisites : Existing ed25519-sk signing identity; public key registered for signing on GitHub; compatible Git.
Caution : These commands change repository-local Git settings. A GitHub Verified badge still requires server-side verification.
git config --local gpg.format ssh
git config --local user.signingkey "$HOME/.ssh/id_ed25519_sk_git_signing.pub"
git config --local commit.gpgsign trueReference : Yubico Git FIDO2
Use an OpenPGP signing subkey stored on the YubiKey. Git invokes gpg-agent and may require touch/PIN.
Prerequisites : Working OpenPGP signing subkey and gpg-agent; verified public fingerprint.
Caution : Do not confuse PIV, OpenPGP, and FIDO-backed SSH keys. Do not automate PIN or key changes.
gpg --card-status
git config --local gpg.format openpgp
git config --local user.signingkey "$GPG_SIGNING_FINGERPRINT"
git config --local commit.gpgsign trueReference : GitHub signing commits
Keep sensitive configuration encrypted in Git and inject it only when needed. SOPS uses an age recipient, either software-based or via a YubiKey plugin.
Prerequisites : Already encrypted file, recipient configured in .sops.yaml, accessible age identity, approved local dev command.
Caution : Never commit plaintext .env files or print environment secrets. Software age identities are not automatically YubiKey-backed.
sops edit config/dev.enc.yaml
sops exec-env config/dev.enc.yaml 'just dev-up'Reference : SOPS
Decrypt workstation development secrets using an already-provisioned YubiKey age identity, without persisting plaintext. Access follows the configured device PIN/touch policy.
Prerequisites : Existing age-plugin-yubikey identity, readable identity descriptor, compatible plugin installed, YubiKey recipient already present in the SOPS policy, and a separate recovery recipient.
Caution : This is a read/decrypt workflow, not PIV provisioning. exec-env requires flat top-level scalar secrets; do not print the environment or commit decrypted credentials.
age-plugin-yubikey --list
SOPS_AGE_KEY_FILE="$HOME/.config/sops/age/yubikey-identity.txt" \
sops exec-env config/dev.enc.yaml 'just dev-up'Reference : age-plugin-yubikey
After explicitly approved age-plugin-yubikey provisioning, encrypt for the hardware recipient and decrypt with the plugin identity file.
Prerequisites : Installed plugin, approved PIV slot, backed-up plugin identity file, verified recipient, independent recovery plan.
Caution : Initial plugin setup can mutate a PIV slot: never run it without approval. An identity stored on a USB drive is not automatically hardware-resident.
age-plugin-yubikey --list
age -r "$AGE_YUBIKEY_RECIPIENT" -o artifact.age artifact.txt
age -d -i "$AGE_YUBIKEY_IDENTITY_FILE" artifact.age | sha256sumReference : age-plugin-yubikey
Encrypt a pg_dump stream directly without creating an intermediate plaintext dump. Use multiple independent recovery recipients.
Prerequisites : Restricted pg_dump permissions, verified age recipients in recipients.txt, secured backup storage, planned recovery drill.
Caution : Listing an archive is not a full restore test. Use independent recovery recipients and verify pipeline exit status.
set -o pipefail
pg_dump -Fc --no-owner "$PGDATABASE" | age -R recipients.txt -o postgres.dump.age
age -d -i "$AGE_IDENTITY_FILE" postgres.dump.age | pg_restore --listReference : PostgreSQL pg_dump
Add a detached signature to an already encrypted archive to verify origin and integrity before a restore.
Prerequisites : YubiKey-accessible GPG signing subkey, existing postgres.dump.age file, trusted signer public key.
Caution : A signature does not encrypt a backup. Check the signer fingerprint and verify before restoring.
gpg --local-user "$GPG_SIGNING_FINGERPRINT" --detach-sign --armor --output postgres.dump.age.asc postgres.dump.age
gpg --verify postgres.dump.age.asc postgres.dump.ageReference : GnuPG
Inspect the slot 9a authentication certificate, its issuer and expiration. For TLS client authentication, configure PKCS#11 middleware.
Prerequisites : Connected YubiKey, ykman installed, existing certificate, approved trust chain.
Caution : Export is public certificate only, but may expose personal identity information. Do not publish; never regenerate keys during diagnostics.
ykman piv info
ykman piv certificates export 9a auth-public.pem
openssl x509 -in auth-public.pem -noout -subject -issuer -datesReference : Yubico PIV
Use WebAuthn/FIDO2 for vault login, enroll a second key independently and verify offline recovery codes.
Prerequisites : Compatible server/client, recovery session, securely stored recovery code.
Caution : In account settings, turn on WebAuthn two-step login and independently enroll and test both keys.
Reference : Bitwarden two-step login
Protect human HashiCorp Vault login with an OIDC identity provider enforcing FIDO2/WebAuthn; Vault can also apply supported native MFA methods.
Prerequisites : Configured OIDC method in Vault and upstream identity provider enforcing FIDO2.
Caution : Vault does not automatically offer native WebAuthn MFA. Distinguish IdP MFA from Vault's built-in login MFA.
vault login -method=oidcReference : HashiCorp Vault MFA
Bind a KeePassXC database to the YubiKey HMAC-SHA1 OTP challenge-response slot. Plan independent recovery.
Prerequisites : Existing challenge-response slot, compatible KeePassXC, test copy of the database and validated recovery plan.
Caution : Never reprogram an OTP slot without secure secret backup. Separate keys cannot automatically unlock the same database.
Reference : KeePassXC
Keep OATH-TOTP credentials on the YubiKey and obtain codes through Yubico Authenticator when WebAuthn is unavailable.
Prerequisites : Provisioned OATH app, TOTP-enabled service and recovery method.
Caution : TOTP is less phishing-resistant than WebAuthn. OATH-TOTP and the HMAC-SHA1 OTP challenge-response slot are separate applications.
Reference : Yubico Authenticator
Both YubiKeys are the unlock key for the disarm step of the nabla-compose homelab panic kill switch: a FIDO2 signature of a random challenge with one of the existing SSH-sk keys, PIN and touch required by the key, either key is enough. The verifier keeps public keys only and slot 2 stays with KeePassXC. Arming cuts public access, stops AI and bots, freezes Vaultwarden and cuts the NAS outbound traffic while keeping the admin channel, then stops services by criticality tier. Only disarming requires the YubiKey.
Prerequisites : nabla-compose checkout on the workstation with its virtualenv, SSH-sk keys created with verify-required and enrolled with enroll (public keys only, nothing is written to the YubiKey), an admin SSH session already opened with the YubiKey and the plan reviewed with check before any run.
Caution : State on 29 Nov 2026: unlock-test passed with each key alone (PIN and touch observed by the owner); arm and disarm have never been run on the homelab. Owner only: automated agents only run check. Do not add --include-critical unless required: stopping the critical tier needs a physical NAS restart. On disarm the firewall rule is removed and services restart most-critical first; Vaultwarden is unlocked by hand, its master password is never automated. This card documents the procedure, not the live state of the homelab.
# Read the plan: read-only, runs nothing
python3 scripts/truenas/kill-switch.py check
# Test the YubiKey gate alone, runs nothing else (PIN + touch)
python3 scripts/truenas/kill-switch.py unlock-test
# ARM (emergency): public access, AI and bots, then services by criticality
python3 scripts/truenas/kill-switch.py arm --apply --acknowledge I_ARM_THE_HOMELAB_KILL_SWITCH
# DISARM: PIN then YubiKey touch (either key works)
python3 scripts/truenas/kill-switch.py disarm --applyReference : nabla-compose kill switch runbook (PR #473)
Terms used throughout the diagram and plan.
Strong authentication standard with hardware keys, including passwordless sign-in.
Browser API to register and authenticate a security key.
Protocol between the client system and a hardware authenticator.
Remote access protocol; the -sk key type uses a FIDO authenticator.
Smartcard application for certificate-based authentication and cryptographic operations.
Standard interface to cryptographic modules and smartcard objects.
Software to manage OpenPGP keys and signatures.
Open standard for signing and encrypting data.
Single-use password; not the same as WebAuthn.
Authentication code derived from a secret key and hash function.
Legacy hash function used by some challenge-response modes; not a recommendation for new digital signatures.
Short-range radio communication with phones and readers.
Personal code protecting key access.
Unlock code for the PIV application, kept offline.
Authority issuing or signing certificates.
File encryption tool used for encrypted recovery archives.
Authentication with multiple independent factors, for example a password and hardware key.
Editor and encryption tool for structured secrets, including age recipients.
Identity protocol built on OAuth 2.0, used for federated Vault login.
Provider authenticating users and optionally enforcing WebAuthn.
Standards for authentication passcodes, distinct from the OTP challenge-response application.
Short-lived time-based code, often six digits.
Protocol securing network connections, optionally using client certificates.
Standard for public-key certificate format and validation.
Database language used by PostgreSQL.
Reference documentation: Yubico · FIDO Alliance · age