Simple daemon for locking and unlocking macOS with Yubikey.
Via Homebrew formula:
brew install https://raw.githubusercontent.com/shtirlic/yubikeylockd/master/yubikeylockd.rb
- YubiKey using the native smart card (PIV) mode
- Require password immediately after sleep or screen saver begins
How it works
When you attach Yubikey for the first time
launchctl will run
that will simply monitor the state of the Yubikey USB devices.
Daemon based on the sample provided by Apple for IOKit development.
It does two things:
- when device is attached it makes activity via
IOPMAssertionDeclareUserActivitycall to turn screen on
- after device is detached it uses
IORequestIdleto put display to sleep and (if you configured it) also locks the OS X