This guide will show you how to create a Root CA and add it to your PKI system. System can have multiple Root CAs, for each CA you repeat the steps below.
-
Generate new Root CA key and certificate
I use here "The secure way" from Step CA to create the Root CA and Intermediate CA.
# On Client # Create file with password step crypto rand 40 > root_ca_password.txt # Create Root CA # 24h*365d*30y=262800h = 30 years step certificate create "<Your Root CA>" root_ca.crt root_ca.key --profile root-ca --not-after 262800h --password-file root_ca_password.txt
[!WARNING] Please store the root_ca.key and root_ca_password.txt in a secure places.
-
Create intermediate CA
Follow the steps in Intermediate CA to create an Intermediate CA.
-
Configure Docker
-
Run
python scripts root-ca <name> --intCa <intCa>
Where
<name>
is the name of the Root CA that will be used in the system. Should be simple and unique. Only letters, numbers and "-" are allowed. And<intCa>
is the name of the Intermediate CA created in step 2. -
Add new include to
docker-compose.yml
, path will be in output of step 4.1include: - project_directory: ./ path: - ./docker-main.yml ... - ./configs/test/root-ca.yml ...
-
-
Generate CRL
See Update CRL and OCSP for more information. Do not do last step. Not restart the OCSP container.
-
Add files to config in
data/volumes/<name>/ocsp-data/
ca.crt
is the CA certificate from step 1, this file shoud have 644 permissionsindex.txt
file created in step 3index.txt.attr
file with contentunique_subject=no
if you want to allow multiple certificates with the same subject orunique_subject=yes
if you want to allow only one certificate with the same subject
-
Generate proxy and OCSP certificates
- Run
python scripts generate-proxy-certs <name>
- Run
python scripts generate-ocsp-certs <name>
- Run
-
Add CNAME to DNS for
<name>.<serverName>
as<serverName>
. -
Restart the system
Run
docker compose up -d
On client copy root-ca
folder from repository and go to it.
-
Run
python format-cert.py <intermediate-file-name>
Where
<intermediate-file-name>
is the name of the Intermediate CA created in step 2. -
Run
openssl ca -gencrl -config openssl.conf -cert <root-ca-cert> -keyfile <root-ca-key> -out crl.crt
Where<root-ca-cert>
is the root CA certificate from step 1 and<root-ca-key>
is the root CA key from step 1. -
Copy
crl.crt
todata/configs/<name>/crl.crt
-
Copy
index.txt
todata/volumes/<name>/ocsp-data/index.txt
-
Restart ocsp container
Run
docker compose restart <name>-ocsp