Command-line interface for managing X.509 certificates via the PKI Manager API.
# Using uv (recommended)
cd cli
uv sync
uv run pki --help
# Or install globally with pipx
pipx install .
pki --helpThe CLI requires configuration to connect to the PKI Manager API. All settings are required and must be provided via environment variables, .env file, or CLI options.
cp .env.example .env
# Edit .env with your server URLs and credentialsThe CLI looks for .env files in:
- Current working directory
~/.config/pki-cli/.env(global configuration)
export PKI_API_URL=https://your-pki-server.example.com/api/v1
export PKI_OIDC_URL=https://your-iam-server.example.com/realms/realm/protocol/openid-connect/token
export PKI_CLIENT_ID=your-client-id
export PKI_CLIENT_SECRET=your-client-secretpki --api-url https://... --oidc-url https://... \
--client-id your-id --client-secret your-secret \
ca listpki config # Show current configuration
pki login # Test authentication
pki logout # Clear cached token
pki health # Check API healthpki ca list # List all CAs
pki ca list --status active # Filter by status
pki ca get <CA_ID> # Get CA details
pki ca create --cn "My CA" --org "MyOrg" # Create new CA
pki ca revoke <CA_ID> --reason key_compromise # Revoke CA
pki ca delete <CA_ID> --force # Delete CApki cert list # List all certificates
pki cert list --ca <CA_ID> # Filter by CA
pki cert list --type server --status active # Filter by type and status
pki cert get <CERT_ID> # Get certificate details
# Issue a new certificate
pki cert issue --ca <CA_ID> --cn "example.com" --type server \
--dns "www.example.com" --dns "api.example.com"
pki cert renew <CERT_ID> # Renew certificate
pki cert revoke <CERT_ID> --reason key_compromise # Revoke
pki cert delete <CERT_ID> --force # Delete
# Download certificate
pki cert download <CERT_ID> # Download as PEM
pki cert download <CERT_ID> -f pkcs12 -p pass # Download as PKCS12pki stats # Show statistics
pki expiring # Show expiring certificates
pki search "example" # Search CAs and certificatesAll commands support -o json for JSON output:
pki ca list -o json | jq '.items[].id'# Create a CA and issue a server certificate
CA_ID=$(pki ca create --cn "Internal CA" -o json | jq -r '.id')
pki cert issue --ca "$CA_ID" --cn "web.internal" --type server
# Renew expiring certificates
for id in $(pki expiring -o json | jq -r '.[].id'); do
pki cert renew "$id"
done| Variable | Description | Required |
|---|---|---|
PKI_API_URL |
PKI Manager API URL | Yes |
PKI_OIDC_URL |
OIDC token endpoint | Yes |
PKI_CLIENT_ID |
OIDC client ID | Yes |
PKI_CLIENT_SECRET |
OIDC client secret | Yes |
- Never commit
.envfiles containing credentials - The
.gitignoreis configured to exclude.envfiles - Use
~/.config/pki-cli/.envfor personal credentials - Token cache is stored in
~/.cache/pki-cli/tokenwith restricted permissions
| Project | Description |
|---|---|
| PKI Manager | Main PKI Manager web application |
| PKI Manager Ansible | Ansible Collection for certificate management (Galaxy) |
| PKI Manager Skill | Claude Code skill for AI-assisted certificate management |