Skip to content

Lock your Windows machine when Yubikey is removed

License

Notifications You must be signed in to change notification settings

folixg/yubikey-windows-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

Yubikey Windows Lock

A script to lock your Windows machine once a formerly connected Yubikey is removed.

Requirements

Needs a Python installation and yubikey-manager which can be installed with

pip install --user yubikey-manager

Usage

Command Line Options

usage: yubikey_windows_lock.py [-h] [-s SERIAL] [-w WAIT]

Lock Windows when Yubikey is removed

options:
-h, --help            show this help message and exit
-s SERIAL, --serial SERIAL
                        Limit to yubikey with this serial number
-w WAIT, --wait WAIT  The time (in s) between two checks (default: 2)

Start At Windows Login

An easy way to automatically launch the script on Windows login is to use Windows Task Scheduler. Create a basic task that is executed on logon and as action starts a program. In the Program/Script field provide the path to pythonw.exe of your Python installation. Typically that is

C:\Users\<your_username>\AppData\Local\Programs\Python\<your_python_version>\pythonw.exe

In the Add arguments field you provide the path to yubikey_windows_lock.py and optionally the arguments you want to provide to the script. So it should look something like

C:\Users\<your_username>\<path_to_this_repo>\yubikey_windows_lock.py -w 3 -s <your_yubikey_serial>

Releases

No releases published

Packages

No packages published

Languages