Skip to content

Commit

Permalink
Added SAN extension to the generated certs
Browse files Browse the repository at this point in the history
While signing the certificate, a SAN extension for the CN is added using a temporary configuration file which in the end gets removed.
  • Loading branch information
michschl authored Jun 20, 2024
1 parent 9b6ccb3 commit dd3c7a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion certs/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@ cert() {
-out ${FILENAME}.csr \
-subj "/C=${COUNTRY_CODE}/ST=${STATE}/L=${CITY}/O=${COMPANY}/CN=${COMMON_NAME}"

# Creating SAN extension which is needed by modern browsers
echo "subjectAltName=DNS:${COMMON_NAME}" > client-ext.cnf

# Create a new certificate using our own CA
openssl x509 -req -sha256 -passin pass:${AUTHORITY_PASSWORD} -days 3650 \
-in ${FILENAME}.csr -CA ca.crt -CAkey ca.key \
-out ${FILENAME}.crt
-out ${FILENAME}.crt \
-extfile client-ext.cnf

# Rename files and remove useless ones
mv ${FILENAME}.crt ${FILENAME}.pem
cp ca.crt ${FILENAME}_chain.pem
mv ${FILENAME}.key ${FILENAME}_rsa.key
rm ${FILENAME}.csr
rm client-ext.cnf
}

# Create /certs folder if it does not exist
Expand Down

0 comments on commit dd3c7a5

Please sign in to comment.