Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions certificates-generation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN chmod 700 /ca/private && \
COPY openssl_config_ca.cnf /ca/openssl_config_ca.cnf
COPY openssl_config_host.cnf /ca/openssl_config_host.cnf
COPY openssl_config_user.cnf /ca/openssl_config_user.cnf
COPY openssl_config_pilot.cnf /ca/openssl_config_pilot.cnf

# Generate CA private key and certificate
RUN openssl genrsa -out /ca/private/ca.key 2048
Expand Down
28 changes: 27 additions & 1 deletion certificates-generation/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if ! openssl ca -config /ca/openssl_config_ca.cnf \
exit 1
fi

### User
### User (for DIRAC client)

if ! openssl genrsa -out /ca/certs/client.key 2048; then
echo "Failed to generate user private key"
Expand All @@ -55,6 +55,32 @@ if ! openssl ca -config /ca/openssl_config_ca.cnf \
exit 1
fi

### DIRAC Pilot

if ! openssl genrsa -out /ca/certs/pilot.key 2048; then
echo "Failed to generate pilot private key"
exit 1
fi
chmod 400 pilot.key

if ! openssl req -config /ca/openssl_config_pilot.cnf \
-key /ca/certs/pilot.key \
-new \
-out /ca/requests/pilot.req; then
echo "Failed to generate pilot certificate signing request"
exit 1
fi

if ! openssl ca -config /ca/openssl_config_ca.cnf \
-extensions usr_cert \
-batch \
-days 5 \
-in /ca/requests/pilot.req \
-out /ca/certs/pilot.pem; then
echo "Failed to generate pilot certificate"
exit 1
fi

###

echo "DIRAC Certificates generated and available in /ca/certs"
Expand Down
3 changes: 0 additions & 3 deletions certificates-generation/openssl_config_host.cnf
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# OpenSSL root CA configuration file


[ req ]
# Options for the `req` tool (`man req`).
default_bits = 2048
Expand Down
20 changes: 20 additions & 0 deletions certificates-generation/openssl_config_pilot.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[ req ]
default_bits = 2048
encrypt_key = yes
distinguished_name = req_dn
prompt = no
req_extensions = v3_req

# Generates the following subject
# Subject: O=DIRAC CI, O=CERN, CN=pilot
[ req_dn ]
C = ch
O = DIRAC
OU = DIRAC CI
CN = pilot

[ v3_req ]
# Extensions for client certificates (`man x509v3_config`).
nsComment = "OpenSSL Generated Client Certificate"
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth