GithubHelp home page GithubHelp logo

fuhry / yubikey-hotplug Goto Github PK

View Code? Open in Web Editor NEW
19.0 19.0 3.0 4 KB

udev hook and accompanying script to lock/unlock a workstation when a yubikey is plugged/unplugged

License: MIT License

Shell 100.00%

yubikey-hotplug's Introduction

yubikey-hotplug: Automatic screen lock/unlock for Yubikeys

This is a small script that allows the running desktop environment's screensaver to be locked/unlocked based on hotplug events of a Yubikey. It has the following features:

  • Fast and responsive, triggered via a udev hook
  • Confined to specific Yubikey serial numbers per-user
  • No root access required for configuration
  • Secure - workstation cannot be unlocked with a yubikey if it was unplugged while the PC was locked

Dependencies

This utility depends on yubikey-manager which is available in the Arch Linux community repository.

Setup

To configure yubikey-hotplug, all you need to do is write your Yubikey's serial number to a file in your home directory:

mkdir -p ~/.config/yubikey-hotplug
echo 1234567 > ~/.config/yubikey-hotplug/serials

If you don't know your Yubikey's serial number, use ykman info to get it. If ykman can't figure out what it is then this program will not work, as it uses ykman to query the Yubikey's serial number. Note that some very old Yubikeys do not have serial numbers.

Security

Unlike other attributes, the serial number is completely burned into the Yubikey and no two will ever be the same. It is theoretically possible to make a fake device with the same hwid and API as a Yubikey. There is no challenge-response or other secret key based authentication that occurs when the system verifies the Yubikey's serial number. So keep this in mind, this utility is a convenience aid and not a replacement for proper workstation security.

The utility will check if the screensaver is locked when a Yubikey is unplugged. If it is, it will create a flag file (~/.config/yubikey-hotplug/require-unlocked-plugin) which signals that plugging the Yubikey back in should not unlock the workstation. The use case for this is perhaps you left your workstation unattended and forgot to take your Yubikey with you - this protects you from an attacker unplugging your Yubikey and immediately plugging it back in. If you unplug your Yubikey while your workstation is locked, you must unlock it and then reconnect the Yubikey to automatically delete the flag file.

Limitations

The utility currently works only on MATE, an issue will be opened to track progress on support for other desktop environments.

Author/License

Written by Dan Fuhry [email protected].

MIT licensed; please see the COPYING file.

yubikey-hotplug's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yubikey-hotplug's Issues

Support desktop environments other than MATE

Currently this utility supports only MATE and this support is hardcoded.

Add the ability to detect a user's running desktop environment and call the appropriate screensaver commands for lock, unlock, and check_if_locked. Allow this to be overridden with scripts in the configuration directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.