YubiKey Setup & Configuration
Configure a new YubiKey for FIDO2 SSH authentication and register public key across all infrastructure.
1. Pre-Flight Checklist
-
New YubiKey in hand (5C NFC, 5C Nano, or similar with FIDO2)
-
YubiKey Manager installed (
ykman) -
OpenSSH 8.2+ (for FIDO2 support)
-
Access to all infrastructure (to add new public key)
2. Phase 1: Identify and Initialize YubiKey
2.1. 1.1 Verify YubiKey Detection
Insert YubiKey and verify:
ykman info
Device type: YubiKey 5C NFC
Serial number: 12345678
Firmware version: 5.4.3
Form factor: Keychain (USB-C)
Enabled USB interfaces: OTP, FIDO, CCID
...
2.2. 1.2 Record Serial Number
SERIAL=$(ykman info | awk '/Serial number:/ {print $3}')
echo "Serial: ${SERIAL}"
Write this down - you’ll use it to identify this key.
3. Phase 2: Generate SSH Key
3.1. 2.1 Determine Key Slot Name
Choose a descriptive name based on YubiKey role:
| Role | Key Filename |
|---|---|
Primary (keychain) |
|
Secondary (backup) |
|
Tertiary (nano) |
|
Quaternary (offsite) |
|
New 5th key |
|
3.2. 2.2 Generate FIDO2 Resident Key
# Replace KEY_NAME with your chosen name
KEY_NAME="id_ed25519_sk_rk_d000_quaternary"
ssh-keygen -t ed25519-sk -O resident -O verify-required \
-C "evanusmodestus@d000-yubikey-${SERIAL}" \
-f ~/.ssh/${KEY_NAME}
Touch YubiKey when prompted.
5. Phase 4: Register on Infrastructure
5.2. 4.2 Add to Linux Hosts
For each Linux host:
# SSH with existing key, then add new key
ssh vault-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh ise-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh keycloak-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh home-dc01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh nas-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh bind-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh k3s-master-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
ssh pfsense-01 "echo '${PUBKEY}' >> ~/.ssh/authorized_keys"
6. Phase 5: Update SSH Config
6.1. 5.1 Add Key to SSH Config
Edit ~/.ssh/config:
# Add this block for all hosts that should use this YubiKey
Host vault-01 ise-01 keycloak-01 home-dc01 nas-01 bind-01 k3s-master-01
IdentityFile ~/.ssh/id_ed25519_sk_rk_d000_quaternary
IdentityFile ~/.ssh/id_ed25519_sk_rk_d000 # fallback
IdentitiesOnly yes
7. Phase 6: Validate All Infrastructure
8. Phase 7: Document and Backup
9. Quick Reference
| Task | Command |
|---|---|
Check YubiKey |
|
Reset FIDO2 |
|
Set PIN |
|
Generate resident key |
|
Add to agent |
|
List agent keys |
|
Test specific key |
|
10. Troubleshooting
| Issue | Solution |
|---|---|
|
Insert YubiKey, check |
|
udev rules. Run: |
|
Enter FIDO2 PIN when prompted |
Key not found on host |
Check authorized_keys: |
Timeout on touch |
Touch YubiKey when blinking |