A command-line tool that makes PKI simple. Create and manage certificates with hardware security (YubiKey) support.
OpenSSL is powerful but cryptic. Setting up a proper PKI usually means:
- Copy-pasting commands you don't understand
- Skipping security best practices because they're too complex
- Ending up with insecure self-signed certificates
SCA provides a simple interface to do PKI properly:
# Create a service certificate
sca config set service myapp
sca create key service
sca create csr service
sca approve service # Signs with YubiKey
sca create crt service- Simple commands -
create,approve,export,list - YubiKey integration - Hardware-protected private keys
- Hierarchical CA - Root CA → Sub-CA → Certificates
- Offline root CA - Keep root keys on air-gapped USB
- SSH integration - Use certificates for SSH authentication
- Bash completion - Tab completion for all commands
- Claude Code skill - AI-assisted PKI operations and guidance
# Ubuntu/Debian
sudo apt install openssl opensc pcscd yubico-piv-tool
# Start smart card daemon
sudo systemctl enable --now pcscd# Download latest release
curl -L https://github.com/harley-systems/sca/releases/latest/download/sca -o ~/bin/sca
chmod +x ~/bin/sca
# Enable bash completion
~/bin/sca completion bash > ~/.local/share/bash-completion/completions/sca# Build
make
# Install system-wide
sudo cp build/sca.sh /usr/local/bin/sca
# Enable bash completion
echo 'source <(sca completion bash)' >> ~/.bashrcThe two install routes are not equivalent (sca install also installs
packages, creates the config and edits ~/.bashrc), and they put the bash
completion in different places:
| Route | sca | Completion |
|---|---|---|
make deploy |
$(INSTALL_DIR)/sca (default ~/bin/sca) |
$(COMPLETION_DIR)/sca (default ~/.local/share/bash-completion/completions/sca) |
sca install |
~/bin/sca |
~/bin/sca_completion |
sca init sca_usb_stick ships ~/bin/sca and generates the stick's completion
from it, so either route works, but sca must be in ~/bin.
# Set your organization name
sca config set ca mycompany
sca config set domain .mycompany.com
# Create root CA (do this offline for security)
sca create key ca
sca create crt ca# Select the sub-CA first: init writes its credentials to this sub-CA's files
sca config set subca admin
# Initialize YubiKey: random PIN, PUK and management key, saved to
# ~/.sca/keys/<ca>/<subca>/private/ (back them up offline)
sca security_key init subca
# Create sub-CA
sca create key subca
sca create csr subca
sca approve subca
sca create crt subca
# Upload to YubiKey
sca security_key upload subca crt
sca security_key upload subca key# Configure service
sca config set service webapp
# Create and sign certificate
sca create key service
sca create csr service
sca approve service # Prompts for YubiKey PIN
sca create crt service
# Export for deployment
sca export crt_pub_ssh service| Command | Description |
|---|---|
create |
Create keys, CSRs, certificates |
request |
Create signing request |
approve |
Approve/sign a CSR |
display |
Display certificate details |
export |
Export certificate bundles |
import |
Import certificates |
list |
List CAs, certificates, configs |
config |
Manage configuration |
security_key |
YubiKey management |
install |
Install prerequisites |
completion |
Shell completion scripts |
Run sca <command> --help for detailed usage.
- Demo Walkthrough - Complete tutorial from install to user certificate
- Command Reference - Detailed command documentation
- YubiKey Setup - Hardware security key configuration
- Procedures - Step-by-step guides
- SSH Integration - Certificate-based SSH
- SSH with a YubiKey: Choosing a Method - PIV vs OpenPGP (GPG) vs FIDO2
- GPG with a YubiKey - Signing, encryption and Git commit signing with the OpenPGP applet
- Air-Gapped Operations - Secure offline CA environment
- The Air-Gapped CA Appliance - Hardware design, bill of materials and prices for the offline CA
- YubiKey Touch Fixture - A printed box and RP2040 firmware that touch test YubiKeys on command, for unattended tests
- USB Boot on ARM - Booting a ROCK64 from USB by writing U-Boot to SPI flash
- Configuration Reference - Config files and customization
- Troubleshooting - Common issues and solutions
This repo includes a Claude Code skill that provides AI-assisted guidance for SCA operations.
Automatic (project-level): When you open this project in Claude Code, the skill activates automatically -- no installation needed.
Manual install (global): To use the skill outside this repo, install it from the claude-skills marketplace:
/plugin marketplace add harley-systems/claude-skills
Then install "sca-plugin" when prompted. The marketplace fetches the skill
straight from .claude/skills/sca-cskill/ on this repository's main branch, so
the installed skill is never behind the one in this repo.
Root CA (offline, USB storage)
│
└── Sub-CA (on YubiKey)
│
├── Service certificates
├── Host certificates
└── User certificates
Key storage:
- Root CA private key → Offline USB (air-gapped)
- Sub-CA private key → YubiKey hardware token
- Service/host keys → Filesystem (Ansible-managed)
SCA stores configuration in ~/.sca/:
~/.sca/
├── config/ # OpenSSL templates
└── keys/ # Certificates and keys
└── <ca>/
└── <subca>/
└── <service>/
sca config set service vpn-server
sca create crt_pub_ssh service
# Deploy to StrongSwansca config set service webapp
sca create crt_pub_ssh service
# Deploy to nginx/Apachesca config set user developer
sca create crt_pub_ssh user
sca create pub_ssh user
# Add to authorized_keysContributions welcome! Please read CONTRIBUTING.md first.
Areas where help is appreciated:
- Certificate revocation (CRL generation)
- More shell completions (zsh, fish)
- Documentation improvements
- YubiKey diagnostics (see issues #9, #10, #11)
MIT License - see LICENSE
Built on:
