step-ca-hsm镜像)。step-ca 文档默认镜像 适用于大多数用户。
标签为 latest 和版本号,例如 0.23.0。
这是一个基于Alpine的镜像。
HSM镜像 用于存储在PKCS#11硬件安全模块(HSM)或Yubikey PIV插槽中的密钥。
标签为 hsm 和带版本的 hsm- 标签,例如 hsm-0.23.0、hsm-0.23.1 等。
此镜像中的 step-ca 二进制文件启用CGO编译。
基于Bullseye,因此可集成来自HSM供应商的 glibc 兼容PKCS#11模块。
不想运行自己的CA?
如需快速上手或作为运行自己 step-ca 服务器的替代方案,可考虑创建免费托管的smallstep证书管理器权威机构。
step-ca 交互,需在主机环境中安装 step 客户端。参见安装文档。在Docker主机上运行以下命令初始化PKI:
docker run -it -v step:/home/step \ -p 9000:9000 \ -e "DOCKER_STEPCA_INIT_NAME=Smallstep" \ -e "DOCKER_STEPCA_INIT_DNS_NAMES=localhost,$(hostname -f)" \ -e "DOCKER_STEPCA_INIT_REMOTE_MANAGEMENT=true" \ smallstep/step-ca
👉 注意输出中的CA指纹(SHA256)、远程管理超级管理员用户名和远程管理密码。
以下环境变量可用于初始化CA配置:
DOCKER_STEPCA_INIT_NAME:CA名称——将作为CA证书的颁发者DOCKER_STEPCA_INIT_DNS_NAMES:CA接受请求的主机名或IPDOCKER_STEPCA_INIT_REMOTE_MANAGEMENT:启用远程配置器管理DOCKER_STEPCA_INIT_PROVISIONER_NAME:初始管理员(JWK)配置器的标签。默认:adminDOCKER_STEPCA_INIT_SSH:设为true以启用SSH证书支持DOCKER_STEPCA_INIT_ACME:为CA创建初始ACME配置器DOCKER_STEPCA_INIT_PASSWORD_FILE:用于私钥和默认CA配置器的密码文件位置。适用于指向容器中/run/secrets内的Docker密钥。若同时设置DOCKER_STEPCA_INIT_PASSWORD和DOCKER_STEPCA_INIT_PASSWORD_FILE,仅使用DOCKER_STEPCA_INIT_PASSWORD_FILE。DOCKER_STEPCA_INIT_PASSWORD:通常CA密码会自动生成。使用此选项可指定加密CA密钥和默认CA配置器的密码。注意:存储在环境变量中的密码不安全。生产环境中,更安全的方式是使用下文的手动安装流程。这些变量仅在首次运行前配置step-ca时生效。
CA初始化后将开始运行,可进行连接。客户端需知道CA的URL和SHA256指纹。
在主机环境中引导step客户端并将根CA证书安装到主机信任存储:
bash{ CA_FINGERPRINT=$(docker run -v step:/home/step smallstep/step-ca step certificate fingerprint certs/root_ca.crt) step ca bootstrap --ca-url https://localhost:9000 --fingerprint $CA_FINGERPRINT --install }
输出:
The root certificate has been saved in /Users/alice/.step/certs/root_ca.crt. Your configuration has been saved in /Users/alice/.step/config/defaults.json. Installing the root certificate in the system truststore... [sudo] password for alice: .... done.
本地step CLI现已配置为使用容器实例的step-ca,且根证书受主机环境信任。
运行健康检查:
bashcurl https://localhost:9000/health
输出:
json{"status":"ok"}
CA已准备就绪。
已在Linux的Bash中测试。
获取最新版本的step-ca:
bashdocker pull smallstep/step-ca
Docker卷step将存储CA配置、密钥和数据库:
bashdocker run -it -v step:/home/step smallstep/step-ca step ca init --remote-management
init命令将引导配置流程。示例输出:
✔ What would you like to name your new PKI? (e.g. Smallstep): Smallstep ✔ What DNS names or IP addresses would you like to add to your new CA? (e.g. ca.smallstep.com[,1.1.1.1,etc.]): localhost ✔ What address will your new CA listen at? (e.g. :443): :9000 ✔ What would you like to name the first provisioner for your new CA? (e.g. ***): *** ✔ What do you want your password to be? [leave empty and we'll generate one]: Generating root certificate... done! Generating intermediate certificate... done! ✔ Root certificate: /home/step/certs/root_ca.crt ✔ Root private key: /home/step/secrets/root_ca_key ✔ Root fingerprint: fa08cceda8501b1d93d275cfc614a5af2a37c6c72e674192b4598808c5bae91e ✔ Intermediate certificate: /home/step/certs/intermediate_ca.crt ✔ Intermediate private key: /home/step/secrets/intermediate_ca_key ✔ Database folder: /home/step/db ✔ Default configuration: /home/step/config/defaults.json ✔ Certificate Authority configuration: /home/step/config/ca.json ✔ Admin provisioner: *** (JWK) ✔ Super admin subject: step Your PKI is ready to go. To generate certificates for individual services see 'step help ca'.
保存根指纹值!客户端引导需使用。
镜像期望中间CA私钥密码存放在/home/step/secrets/password。再次启动容器shell并写入文件:
bashdocker run -it -v step:/home/step smallstep/step-ca sh
在容器内,将密码写入指定位置:
bashecho -n "<your password here>" > /home/step/secrets/password
CA已配置完成,可启动。
CA在容器内的9000端口运行HTTPS API。本地暴露该端口并启动:
bashdocker run -d -p 9000:9000 -v step:/home/step smallstep/step-ca
在主机环境中引导step客户端配置:
bash{ CA_FINGERPRINT=$(docker run -v step:/home/step smallstep/step-ca step certificate fingerprint /home/step/certs/root_ca.crt) step ca bootstrap --ca-url https://localhost:9000 --fingerprint $CA_FINGERPRINT --install }
输出:
The root certificate has been saved in /Users/alice/.step/certs/root_ca.crt. Your configuration has been saved in /Users/alice/.step/config/defaults.json. Installing the root certificate in the system truststore... [sudo] password for alice: ... done.
本地step CLI现已配置为使用容器实例的step-ca,新根证书受主机环境信任。
运行健康检查:
bashcurl https://localhost:9000/health
输出:
json{"status":"ok"}
step-ca以适应基础设施。step-ca使用sigstore/cosign进行容器签名和验证。验证示例:
bashcosign verify smallstep/step-ca:0.23.1 \ --certificate-identity-regexp "[***]\.com/smallstep/workflows/.*" \ --certificate-oidc-issuer [***]
需求:
在安装Docker的主机上运行以下步骤。
引导本地环境后,可运行配置TLS和mTLS的Web服务。首先获取localhost证书:
bashstep ca certificate localhost localhost.crt localhost.key
输出:
✔ Key ID: aTPGWP0qbuQdflR5VxtNouDIOXyNMH1H9KAZKP-UcHo (admin) ✔ Please enter the password to decrypt the provisioner key: ✔ CA: <https://localhost:9000/1.0/sign> ✔ Certificate: localhost.crt ✔ Private Key: localhost.key
保存根CA证书副本:
bashstep ca root root_ca.crt
输出:
The root certificate has been saved in root_ca.crt.
启动HTTPS安全Web服务器:
bash{ cat <<EOF > server.py import BaseHTTPServer, ssl class HelloHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200); self.send_header('content-type', 'text/html; charset=utf-8'); self.end_headers() self.wfile.write(b'\\n\\xf0\\x9f\\x91\\x8b Hello! Welcome to TLS \\xf0\\x9f\\x94\\x92\\xe2\\x9c\\x85\\n\\n') httpd = BaseHTTPServer.HTTPServer(('', 8443), HelloHandler) httpd.socket = ssl.wrap_socket(httpd.socket, server_side=True, keyfile="localhost.key", certfile="localhost.crt", ca_certs="root_ca.crt") httpd.serve_forever() EOF python server.py }
打开另一个终端查看运行的服务器:
bash$ curl https://localhost:8443 👋 Hello! Welcome to TLS 🔒✅
或在浏览器中访问 https://localhost:8443。
在树莓派上运行step-ca时,容器日志可能出现以下错误:
step-ca | badger 2021/05/08 20:13:12 INFO: All 0 tables opened in 0s step-ca | Error opening database of Type badger with source /home/step/db: error opening Badger database: Mmap value log file. Path=/home/step/db/000000.vlog. Error=cannot allocate memory
修复方法:编辑config/ca.json中的db配置块:
bashdocker run -v step:/home/step -it smallstep/step-ca vi /home/step/config/ca.json
将badgerFileLoadingMode的值从""改为"FileIO":
json"db": { "type": "badger", "dataSource": "/home/step/db", "badgerFileLoadingMode": "FileIO" },
保存并重启容器。
有问题?在 GitHub Discussions 或 *** 上向我们提问。
来自真实用户的反馈,见证轩辕镜像的优质服务
免费版仅支持 Docker Hub 加速,不承诺可用性和速度;专业版支持更多镜像源,保证可用性和稳定速度,提供优先客服响应。
免费版仅支持 docker.io;专业版支持 docker.io、gcr.io、ghcr.io、registry.k8s.io、nvcr.io、quay.io、mcr.microsoft.com、docker.elastic.co 等。
当返回 402 Payment Required 错误时,表示流量已耗尽,需要充值流量包以恢复服务。
通常由 Docker 版本过低导致,需要升级到 20.x 或更高版本以支持 V2 协议。
先检查 Docker 版本,版本过低则升级;版本正常则验证镜像信息是否正确。
使用 docker tag 命令为镜像打上新标签,去掉域名前缀,使镜像名称更简洁。
探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
在 Linux 系统配置镜像加速服务
在 Docker Desktop 配置镜像加速
Docker Compose 项目配置加速
Kubernetes 集群配置 Containerd
在宝塔面板一键配置镜像加速
Synology 群晖 NAS 配置加速
飞牛 fnOS 系统配置镜像加速
极空间 NAS 系统配置加速服务
爱快 iKuai 路由系统配置加速
绿联 NAS 系统配置镜像加速
QNAP 威联通 NAS 配置加速
Podman 容器引擎配置加速
HPC 科学计算容器配置加速
ghcr、Quay、nvcr 等镜像仓库
无需登录使用专属域名加速
需要其他帮助?请查看我们的 常见问题 或 官方QQ群: 13763429