yubiKeyLock
This program locks your Windows PC once you remove your Yubikey. The script keeps a startup fallback: on first run, if no approved key is present, it exits instead of locking. This allows login if you forgot your key at home.
Requirements
- Python 3 on Windows
- Yubico YubiKey Manager CLI (
ykman) installed and available inPATH
Configuration
- List connected key serial numbers:
ykman list --serials - Edit
yubicheck_config.jsonand set:check_interval_secondswhitelisted_serials(list of allowed serials)
Config file location
- Script mode: config is read from the same folder as
yubicheck.py. - EXE mode: config is read from the same folder as the compiled
.exe. - This allows changing serials/interval without rebuilding the executable.
Behavior
- If a whitelisted serial is present, the script continues running.
- If no whitelisted serial is present after startup, the workstation is locked.
- On first run only, if no whitelisted serial is present, the script exits (startup fallback).
- On first run, if unwhitelisted YubiKey serials are detected, the script offers a 10 second
y/nprompt to add them toyubicheck_config.json.