# LuCI App - Key Storage Manager (KSM) **Version:** 1.0.0 **Last Updated:** 2025-12-28 **Status:** Active Centralized cryptographic key management system for OpenWrt with hardware security module (HSM) support for Nitrokey and YubiKey devices. ## Overview The Key Storage Manager provides a comprehensive solution for managing cryptographic keys, certificates, secrets, and SSH keys on OpenWrt. It supports both software-based key storage and hardware-backed cryptographic operations using USB security tokens. ### Features - **Cryptographic Key Management** - Generate RSA, ECDSA, and Ed25519 keys - Import/export keys in PEM, DER, and PKCS#12 formats - Secure deletion with shred support - Key metadata tracking and organization - **Hardware Security Module (HSM) Support** - Auto-detection of Nitrokey and YubiKey devices - On-chip key generation - PIN management and security - Hardware-backed cryptographic operations - **Certificate Management** - Generate Certificate Signing Requests (CSR) - Import SSL/TLS certificates - Certificate chain verification - Expiration alerts (< 30 days) - **Secrets Storage** - Encrypted storage for API keys, passwords, and tokens - Categorized secret organization - Automatic secret rotation (optional) - Access audit logging - **SSH Key Management** - Generate SSH key pairs (RSA, ECDSA, Ed25519) - Deploy keys to remote hosts - Support for SSH certificates - Public key export and sharing - **Audit Logging** - Comprehensive activity tracking - Export logs to CSV format - Filterable audit timeline - User action accountability ## Installation ### Dependencies The module requires the following packages: - `luci-base` - `rpcd` - `openssl-util` - `gnupg2` - `nitropy` (for Nitrokey support) - `yubikey-manager` (for YubiKey support) - `opensc` (smart card framework) - `libccid` (USB CCID driver) - `pcscd` (PC/SC daemon) ### Install from Package ```bash # Transfer package to router scp luci-app-ksm-manager_*.ipk root@192.168.1.1:/tmp/ # Install on router ssh root@192.168.1.1 opkg update opkg install /tmp/luci-app-ksm-manager_*.ipk # Restart services /etc/init.d/rpcd restart /etc/init.d/uhttpd restart ``` ### Build from Source ```bash # In OpenWrt SDK make package/luci-app-ksm-manager/compile V=s make package/luci-app-ksm-manager/install # Package will be in bin/packages/*/base/ ``` ## Initial Setup ### 1. Install HSM Drivers (if using hardware tokens) For Nitrokey devices: ```bash opkg install nitropy python3-pip ``` For YubiKey devices: ```bash opkg install yubikey-manager ``` ### 2. Configure USB Permissions Ensure your user has access to USB devices: ```bash # Add udev rules for Nitrokey cat > /etc/udev/rules.d/60-nitrokey.rules < /etc/udev/rules.d/70-yubikey.rules <