Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - guttermonk/yubilock: Lock your screen when your Yubikey is removed.
Nothing Special   »   [go: up one dir, main page]

Skip to content

guttermonk/yubilock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yubilock

This Waybar module adds a service that will lock your screen when your Yubikey is removed. The service is controlled by a toggle button in Waybar. This allows you to disable the service to conserve resources when the threat model is low risk, and to enable it when the threat model is higher risk (such as in public places like the airport or coffee shop).

Screenshot

The indicator will show the current status of the service and whether a YubiKey is currently inserted.

This Waybar module is intended to be used with hardware like the following (ref links to support my open source projects):

Dependency

Installation Instructions

Option 1: NixOS with Home Manager (Recommended for NixOS users)

For NixOS users with Home Manager, you can use the included NixOS module for automatic systemd service management:

  1. Import the module in your Home Manager configuration:

    { config, pkgs, ... }:
    {
      imports = [
        /path/to/yubilock/yubilock.nix
      ];
    
      services.yubilock = {
        enable = true;
        autoRestore = true;  # Automatically restore yubilock state on login
      };
    }
  2. Copy the Waybar scripts to ~/.config/waybar/scripts/:

    mkdir -p ~/.config/waybar/scripts/
    cp scripts/*.sh ~/.config/waybar/scripts/
    chmod +x ~/.config/waybar/scripts/*.sh
  3. Add the custom module to your Waybar config (see Waybar Configuration).

  4. Add the CSS to your Waybar style.css (see Waybar CSS Style).

  5. Rebuild your NixOS configuration:

    home-manager switch

The systemd services will be automatically configured:

  • yubilock.service - Monitors YubiKey presence and locks screen on removal
  • yubilock-restore.service - Restores yubilock state on login (if autoRestore = true)

Option 2: Manual Installation (All Linux distributions)

  1. Save the three scripts to: ~/.config/waybar/scripts/
  2. Make them executable:
    chmod +x ~/.config/waybar/scripts/yubikey-status.sh
    chmod +x ~/.config/waybar/scripts/yubilock.sh
    chmod +x ~/.config/waybar/scripts/yubilock-toggle.sh
    
  3. Add the custom module to your Waybar config (see Waybar Configuration).
  4. Add the CSS to your Waybar style.css and/or style it to your liking (see Waybar CSS Style).
  5. Restart Waybar: killall waybar && waybar &

Now you can toggle the Yubilock service by clicking the indicator in your Waybar. The indicator will show the current status of the service and whether a YubiKey is currently inserted.

Part 3: Waybar Configuration

Add this to your Waybar configuration file:

3.1 For NixOS:

"custom/yubilock" = {
  return-type = "json";
  interval = 5;
  exec = "$HOME/.config/waybar/scripts/yubikey-status.sh";
  on-click = "$HOME/.config/waybar/scripts/yubilock-toggle.sh";
  tooltip = true;
  format = "{icon}";
  format-icons = {
    active = "";
    inactive = "";
  };
};

3.2 For other Linux distributions:

"custom/yubilock": {
    "return-type": "json",
    "interval": 5,
    "exec": "$HOME/.config/waybar/scripts/yubikey-status.sh",
    "on-click": "$HOME/.config/waybar/scripts/yubilock-toggle.sh",
    "tooltip": true,
    "format": "{icon}",
    "format-icons": {
      "active": "",
      "inactive": "",
    },
}

Part 4: Waybar CSS Style

Add this to your Waybar style.css file:

#custom-yubilock {
    padding: 0 10px;
    border-radius: 10px;
    margin: 6px 0;
}

#custom-yubilock.yubilock-on {
    background-color: #26a65b;
    color: #ffffff;
}

#custom-yubilock.yubilock-off {
    background-color: #e74c3c;
    color: #ffffff;
}

#custom-yubilock.yubilock-on:hover,
#custom-yubilock.yubilock-off:hover {
    background-color: #2
62BE
980b9;
}

About

Lock your screen when your Yubikey is removed.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published
0