Warning
Early Development / Use at Your Own Risk This project is in an early stage of development and directly modifies low-level PAM authentication stacks and system security settings. Use at your own risk. It is strongly recommended to test inside a virtual machine or non-production environment first, and to always have alternative root access or recovery media available.
A Windows Hello–style, hardware-backed PIN authentication system for Linux using TPM 2.0.
It integrates with PAM (login screen, lock screen, sudo, and Polkit), automatically unseals and unlocks the desktop GNOME Keyring / KWallet, enforces TPM Dictionary Attack (anti-hammering) lockout, supports Secure Boot (PCR 7) integrity binding, and includes a native GTK4 / Libadwaita Settings Application.
- Hardware-Backed Security (TPM 2.0):
- Master encryption keys sealed inside a TPM 2.0
KEYEDHASHobject under the Primary Storage Hierarchy (TPM2_RH_OWNER). - Hardware Dictionary Attack (DA) protection: TPM rate-limits and hardware-locks attempts on repeated incorrect PIN entries.
- Optional PCR 7 binding: Pin validity bound to UEFI Secure Boot firmware and bootloader integrity.
- Master encryption keys sealed inside a TPM 2.0
- Unified Authentication Experience:
- Unified
"PIN or Password: "prompt acrosssudo/doas, GDM / SDDM / COSMIC (greetd) / LightDM /lylogin screens, screen lockers (kscreenlocker,cosmic-greeter,hyprlock,swaylock,*-screensaver), and Polkit (pkexec/run0). - Intelligent fallback: typing your standard system password does not waste TPM DA attempts and seamlessly authenticates via standard PAM (
pam_unix.so try_first_pass) without asking twice. - Desktop Keyring Auto-Unlock: Sealing your login password in the TPM enables automatic GNOME Keyring / COSMIC / KWallet unlocking on boot login.
- Unified
- Native GTK4 / Libadwaita Settings App:
- Matches the GNOME Settings look and feel (
AdwPreferencesWindow). - Configure PIN enrollment, change/remove PIN, per-service toggles (
sudo, login screen, lock screen, keyring auto-unlock), PIN complexity policies (digits-only vs. alphanumeric, min/max length), and reset TPM lockout counters. - Registers under
Settings;System;Security;in application launchers.
- Matches the GNOME Settings look and feel (
- Cross-Distribution & Packaging Support:
- Debian / Ubuntu (
.deb,pam-auth-updateprofile). - Fedora / RHEL / CentOS (
.rpm,system-auth/password-auth). - Arch Linux (
PKGBUILDwithx86_64,x86_64_v3,x86_64_v4, andaarch64targets). - Flatpak bundle (
io.github.securepin.Settings) for sandboxed desktop environments. - Universal CMake build system.
- Debian / Ubuntu (
-
Debian / Ubuntu:
sudo apt install cmake gcc pkg-config libssl-dev libpam0g python3 python3-gi gir1.2-adw-1 libtss2-esys-3.0.2-0t64 swtpm
-
Fedora / RHEL:
sudo dnf install cmake gcc pkgconfig openssl-devel pam-devel tpm2-tss-devel python3 python3-gobject libadwaita swtpm
-
Arch Linux:
sudo pacman -S --needed base-devel cmake gcc pkgconf openssl pam polkit tpm2-tss python python-gobject gtk4 libadwaita swtpm
To build and install a native Arch package (
.pkg.tar.zst) directly:./build.sh sudo pacman -U dist/tpm-pin-*.pkg.tar.zst(Optional: install
gnome-keyringon GNOME/COSMIC orkwallet-pamon KDE Plasma for automatic login keyring unlocking). -
TPM 2.0 User Permissions (
tssgroup):To query TPM status or run CLI commands as a non-root user, ensure your account is in the
tssgroup:sudo usermod -aG tss $USER newgrp tss # or log out and log back in
(Note: Installing
.deb,.rpm, or Arch packages automatically configures auaccessudev rule for desktop sessions).
Alternatively, you can build and install manually with CMake:
mkdir -p build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)
sudo make installNote
PAM Activation on New Installs:
-
Distribution packages (
.deb,.rpm, ArchPKGBUILD): Package maintainer scripts automatically register and activate the PAM configuration with safe relative jumps on installation. -
Installed from source (
make install): PAM integration is not enabled automatically. You must activate it after installation using either:sudo tpm-pin-ctl pam enableor by toggling "Enable TPM PIN in PAM" in the GTK Settings application (
tpm-pin-settings).
./build/tpm-pin-ctl statusOr JSON format (used by the settings GUI):
./build/tpm-pin-ctl status --json./build/tpm-pin-ctl enrollYou will be prompted for your current login password (to seal for desktop keyring auto-unlock) and your new PIN.
./build/tpm-pin-ctl verify./gui/tpm-pin-settings(Note: Automatically activated when installed via .deb, .rpm, or Arch package).
When installed from source, safely activate TPM PIN authentication across login, lockscreen, and sudo using:
sudo tpm-pin-ctl pam enable
# or from build tree: sudo ./build/tpm-pin-ctl pam enableTo disable and revert PAM configuration:
sudo ./build/tpm-pin-ctl pam disableContributions, bug reports, and pull requests are welcome. Please refer to CONTRIBUTING.md for development setup, testing workflows, and coding standards.
GPL-3.0-or-later. See LICENSE for details.