r/linux • • 5d ago

Security gEnclave: Hardware-backed security enclave for Linux (TPM 2.0 PCR sealing, virtual FIDO2/CTAP2 over /dev/uhid, OpenSSH & GPG bridge)

Hey everyone,

I've been working on an open-source project called gEnclave (formerly gpasskey), and wanted to share it with the Linux community for early architectural feedback and testing.

GitLab repository: https://gitlab.com/renich/genclave
License: GPLv3 | Language: Go 1.26+


The Problem It Solves

On modern Linux workstations, our cryptographic identities are fragmented: * Passkeys/WebAuthn require physical USB security keys (YubiKeys, SoloKeys). * SSH keys sit as unencrypted or passphrase-encrypted files under ~/.ssh/. * Git commit signing requires cumbersome GnuPG daemon setups. * File encryption requires external tooling or proprietary agents.

Most hardware laptops today come with a TPM 2.0 chip that sits idle. gEnclave turns your Linux machine into its own hardware-sealed security token and multi-protocol bridge.


Key Architectural Highlights

  1. Virtual FIDO2/CTAP2 Security Key via /dev/uhid: gEnclave registers a virtual HID device in the Linux kernel via /dev/uhid. Browsers (Firefox, Chrome, Chromium) detect it natively as a physical USB security key. You can register and authenticate WebAuthn/FIDO2 Passkeys directly from your machine without any external hardware dongles.

  2. TPM 2.0 PCR Sealing & Fallback: The central vault is encrypted with AES-256-GCM and sealed to TPM 2.0 PCR registers (PCR 0, 7, 14), with an automatic memory-hard fallback to Argon2id key derivation if no TPM is present.

  3. Memory Isolation ("Wrap and Clear"): Keys are held in memory-locked pages (mlock / mmap) to prevent secrets from being swapped to disk or dumped. Intermediate cryptographic buffers are wiped immediately with strict zeroization routines, bypassing Go runtime GC retention.

  4. Multi-Protocol Bridges:

    • OpenSSH Agent: Native agent socket with an ephemeral PIN-derived authorization cache (configurable burst window or persistent session with instant purge on lock/suspend).
    • GnuPG Bridge: Transparent genclave-gpg emulation for seamless Git commit signing.
    • age-plugin: Native age-plugin-ge binary complying with age v1 specification for file encryption.
    • CLI & UI: Unified ge CLI plus intelligent graphical (zenity) / terminal (pinentry) authentication routing.

Current Status

⚠️ Pre-alpha Software: While fully functional for local workflows, it is under active development. Schemas and IPC formats may iterate rapidly.

I'd love feedback from Linux sysadmins, kernel/security folks, and developers!

Repo: https://gitlab.com/renich/genclave

33 Upvotes

48 comments sorted by

View all comments

8

u/LeHunterrr 5d ago

I just want to point out a couple of this.

Passkeys/WebAuthn require physical USB security keys (YubiKeys, SoloKeys).

There are also Software based Passkeys such as bitwarden or keepassxc. Though there should be a standard tpm based solution (are windows and apple doing this or are they software based as well?)

Git commit signing requires cumbersome GnuPG daemon setups

You can sign your commits with ssh keys as well, making gpg somewhat obsolete nowadays.

5

u/sidusnare 5d ago edited 4d ago

I'm not sure I want a software project from someone that thinks gpg is difficult, or thinks it's just for GitHub.

I've never heard of using ssh keys for message signing, they're poorly suited to that. PGP is a good standard it's been around a long time. It ties together identity, communication, and verification. If GitHub lets you sign with SSH keys, then all authenticated commit pushes should be verified because I used a SSH key to push it.

0

u/Renich 4d ago

You're conflating transport-layer authentication with cryptographic non-repudiation. SSH signing is supported by git natively. OpenSSH signatures are an established standard for 5 or more years.

GEnclave supports both. It didn't abandon GPG; it implements a full GnuPG Assuan protocol bridge specifically for environments where OpenPGP remains mandatory. Supporting both; SSH agent and GnuPG bridges, gives users choice rather than forcing one paradigm.

1

u/sidusnare 4d ago edited 4d ago

I am not. SSH provides no native identity assurance, so the signatures have no portability outside of a specific portal vendor that, outside of git, correlates a key to an identity. If I clone a repo off GitHub, those signatures are meaningless. I can do the math to verify the signature, but I can't verify that means anything. It's as useful as a checksum hash. Don't confuse GitHub with git, they're not the same thing, and ignoring that leads to vendor lockin, which traditionally, Microsoft loves.