# Step-CA Certificate Authority

> Step-CA private certificate authority for internal TLS certificates.

- Category: Security & Networking
- Difficulty: advanced
- Components: step-ca
- Tags: step-ca, certificates, pki, tls, security
- Source: https://docker.recipes/security/step-ca-certificates

## Overview

Step-CA is an open-source certificate authority server developed by Smallstep Labs that provides a modern, API-driven approach to managing X.509 certificates and SSH certificates. Unlike traditional heavyweight PKI solutions, Step-CA offers a lightweight, cloud-native certificate authority that supports ACME protocol, OAuth/OIDC integration, and programmatic certificate management through REST APIs. The platform was designed to address the complexity and operational overhead of traditional certificate authorities while providing enterprise-grade security features.

This Docker deployment creates a private certificate authority using Step-CA with ACME protocol support enabled, allowing automated certificate issuance and renewal for internal infrastructure. The configuration includes remote management capabilities through the Step CLI and web interface, making it suitable for organizations that need to manage TLS certificates across multiple services without relying on public certificate authorities. The ACME integration enables compatibility with tools like cert-manager, Traefik, and other automated certificate management systems.

This stack is ideal for DevOps teams, security engineers, and organizations requiring internal PKI infrastructure with modern management capabilities. Companies with microservices architectures, Kubernetes clusters, or internal web services will benefit from Step-CA's automated certificate provisioning and short-lived certificate approach, which reduces the risk associated with long-lived certificates and manual certificate management processes.

## Features

- ACME protocol support for automated certificate issuance and renewal compatible with Let's Encrypt clients
- REST API and CLI-based certificate management with support for X.509 and SSH certificates
- OAuth/OIDC integration for identity-based certificate authentication and authorization
- Configurable certificate templates and policies for controlling certificate attributes and validity periods
- Built-in support for short-lived certificates with automatic renewal workflows
- Remote management capabilities through Step CLI and web-based administrative interface
- Hardware Security Module (HSM) and cloud KMS integration for root key protection
- Certificate revocation lists (CRL) and Online Certificate Status Protocol (OCSP) support

## Use cases

- Internal PKI infrastructure for Kubernetes clusters requiring automatic TLS certificate management
- Microservices environments needing mutual TLS authentication between service components
- Development and staging environments requiring trusted certificates without public CA dependencies
- Organizations implementing zero-trust network architectures with certificate-based authentication
- Homelab and self-hosted service deployments requiring proper TLS certificates for internal domains
- CI/CD pipelines requiring temporary certificates for testing and deployment automation
- Enterprise environments replacing manual certificate processes with automated PKI workflows

## Prerequisites

- Minimum 512MB RAM and 1GB disk space for certificate storage and CA operations
- Port 9000 available for Step-CA HTTPS API and web interface access
- Step CLI installed on management workstations for CA administration and certificate operations
- Basic understanding of PKI concepts including certificate chains, root CAs, and ACME protocol
- DNS resolution configured for CA hostname to ensure proper certificate validation
- Backup strategy planned for CA private keys and certificate database in step_ca_data volume

## docker-compose.yml

```yaml
services:
  step-ca:
    image: smallstep/step-ca:latest
    container_name: step-ca
    volumes:
      - step_ca_data:/home/step
    ports:
      - "9000:9000"
    environment:
      - DOCKER_STEPCA_INIT_NAME=${CA_NAME}
      - DOCKER_STEPCA_INIT_DNS_NAMES=localhost,step-ca
      - DOCKER_STEPCA_INIT_REMOTE_MANAGEMENT=true
      - DOCKER_STEPCA_INIT_ACME=true
    restart: unless-stopped
    networks:
      - step-ca-network

volumes:
  step_ca_data:

networks:
  step-ca-network:
    driver: bridge
```

## .env

```bash
# Step-CA
CA_NAME=My Private CA
```

## Usage notes

- CA at https://localhost:9000
- Get root CA: docker exec step-ca step ca root
- ACME enabled for auto-renewal
- Use step CLI for management
- Install root CA on clients

## Troubleshooting

- Certificate validation fails with 'x509: certificate signed by unknown authority': Install the root CA certificate on client systems using 'step ca root' command output
- ACME client fails with '404 directory not found': Verify ACME is enabled and access the directory at https://localhost:9000/acme/acme/directory
- Step-CA container exits with 'no configuration found': Initialize the CA properly by ensuring DOCKER_STEPCA_INIT_NAME environment variable is set on first run
- Remote management returns 'connection refused': Check that port 9000 is accessible and DOCKER_STEPCA_INIT_REMOTE_MANAGEMENT is set to true
- Certificate requests fail with 'provisioner not found': Verify the ACME provisioner is configured correctly and check available provisioners with 'step ca provisioner list'

