A blazingly fast, intelligent TUI for YubiKey management
YubiTUI is a terminal user interface (TUI) written in Rust that provides comprehensive YubiKey management with a focus on SSH and GPG key operations. It intelligently detects configuration issues, guides users through secure setup, and provides full access to all YubiKey features.
- Smart Diagnostics: Automatically detects gpg-agent issues, configuration problems, and locked keys
- PIN Management: Check retry counters, detect locks, unblock PINs with admin PIN
- Key Import/Generation: Import existing keys or generate new ones directly on the YubiKey
- SSH Configuration: Guide users through the optimal setup for SSH authentication
- Multi-Model Support: Automatically detects YubiKey model and adapts features accordingly
- Card Editing: Full access to all
gpg --card-editfunctionality through an intuitive UI
- Native Speed: Written in Rust for sub-millisecond rendering
- Efficient Backend: Direct PC/SC communication via
pcsccrate - Zero Overhead: Immediate-mode rendering with minimal allocations
- Configuration Analysis: Detects missing or misconfigured gpg-agent, scdaemon, pcscd
- Lock Detection: Identifies PIN retry counter status and provides recovery options
- Key Recognition: Understands why keys aren't being detected and suggests fixes
- Best Practices: Recommends secure, efficient configurations for SSH usage
- TUI Framework: Ratatui with Crossterm backend
- YubiKey Communication:
yubikeycrate for PIV operations (via PC/SC)openpgp-cardcrate for OpenPGP card operations- Direct
gpgCLI integration for card editing
- State Management: Elm-inspired architecture with message passing
src/
βββ main.rs # Entry point, TUI initialization
βββ app.rs # Application state and event loop
βββ ui/ # UI rendering
β βββ mod.rs
β βββ dashboard.rs # Main dashboard view
β βββ diagnostics.rs # Configuration diagnostics view
β βββ keys.rs # Key management view
β βββ pin.rs # PIN management view
β βββ ssh.rs # SSH configuration wizard
βββ yubikey/ # YubiKey operations
β βββ mod.rs
β βββ detection.rs # Device detection and model info
β βββ piv.rs # PIV operations
β βββ openpgp.rs # OpenPGP card operations
β βββ pin.rs # PIN/PUK operations
β βββ ssh.rs # SSH-specific operations
βββ diagnostics/ # System diagnostics
β βββ mod.rs
β βββ gpg_agent.rs # GPG agent detection/analysis
β βββ scdaemon.rs # Scdaemon configuration
β βββ pcscd.rs # PC/SC daemon status
β βββ ssh_agent.rs # SSH agent configuration
βββ utils/
βββ mod.rs
βββ gpg_cli.rs # GPG CLI wrapper
βββ config.rs # Configuration helpers
- GPG 2.1+: For OpenPGP operations and card editing
- PC/SC Lite: For smart card communication (pcscd daemon)
- YubiKey: Firmware 4.0+ recommended (full feature support)
- Rust 1.75+: Latest stable Rust toolchain
- PC/SC Development Libraries:
- macOS:
brew install pcsc-lite - Linux:
apt-get install libpcsclite-devor equivalent - Windows: Windows SDK (pre-installed)
- macOS:
# Clone the repository
git clone https://github.com/yourusername/yubitui
cd yubitui
# Build and run
cargo run --release# Launch the TUI
yubitui
# Quick diagnostics
yubitui --check
# Show detected YubiKeys
yubitui --list
# Enable debug logging
yubitui --debugNote: When running in TUI mode, logs are written to your system's temp directory (e.g., /tmp/yubitui.log on Linux/macOS, %TEMP%\yubitui.log on Windows) to avoid interfering with the display.
Tab/Shift+Tab: Navigate between sectionsββββ: Navigate within sectionsEnter: Select / ActivateEsc: Go back / Cancelq: Quit?: Show help
Note: Mouse capture is intentionally disabled to allow text selection and copying. Use keyboard navigation instead.
| Model | PIV | OpenPGP | FIDO2 | Firmware Detection |
|---|---|---|---|---|
| YubiKey 5 Series | β | β | β | β |
| YubiKey 4 Series | β | β | β | β |
| YubiKey NEO | β | β | β |
# Run all tests
cargo test
# Run tests with a YubiKey connected (requires device)
cargo test --features device-tests -- --ignored
# Run with logging
RUST_LOG=debug cargo run- Separation of Concerns: UI rendering separate from business logic
- Type Safety: Leverage Rust's type system to prevent invalid states
- Error Handling: Comprehensive error types with user-friendly messages
- Testability: Mock YubiKey operations for CI/CD testing
- Project structure
- YubiKey detection
- Basic dashboard UI
- PIN retry counter display
- GPG agent diagnostics
- View existing keys
- Import keys to card (via GPG)
- Generate keys on-device
- Key attribute configuration
- SSH configuration wizard
- SSH agent integration
- Public key export
- authorized_keys management
- Touch policy configuration
- Attestation support
- Multiple YubiKey support
- Backup/restore workflows
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
- Verify signatures on releases
- Backup your keys before any destructive operations
- Use the reset function only when you understand the consequences
- Change default PINs immediately after setup
Apache-2.0 OR MIT
- Ratatui - Excellent TUI framework
- yubikey.rs - YubiKey PIV driver
- openpgp-card - OpenPGP card library
- drduh's YubiKey Guide - Comprehensive YubiKey documentation
- YubiKey Manager (ykman) - Official Yubico CLI
- gpg-card-automation - GPG smartcard automation scripts