File tree Expand file tree Collapse file tree 10 files changed +88
-188
lines changed
Expand file tree Collapse file tree 10 files changed +88
-188
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ PLATFORM ?= linux/amd64
77ACTION ?= load
88PROGRESS_MODE ?= plain
99
10- .PHONY : update-tags docker-build docker-push
10+ .PHONY : update-tags docker-build docker-push test-certificates
1111
1212docker-build :
1313 # https://github.com/docker/buildx#building
@@ -38,3 +38,6 @@ update-tags:
3838test :
3939 BUILDKIT_PROGRESS=plain docker compose -f ./docker/docker-compose.test.yml down
4040 BUILDKIT_PROGRESS=plain docker compose -f ./docker/docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from=sut
41+
42+ test-certificates :
43+ ./docker/tests/make-certs.sh
Original file line number Diff line number Diff line change @@ -8,27 +8,6 @@ make test
88
99### Re-Build the test certificate
1010
11- Source: [ MariaDB docs] ( https://mariadb.com/docs/security/data-in-transit-encryption/create-self-signed-certificates-keys-openssl/ )
12-
1311``` sh
14- openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
15- -subj " /C=FR/OU=Testing/O=Datacenters Network" \
16- -keyout ca.key -out ca.pem
17-
18- openssl req -new -newkey rsa:4096 -nodes \
19- -subj " /emailAddress=williamdes+sudo-bot-test-cert@wdes.fr/C=FR/OU=Testing/O=Datacenters Network/CN=openldap" \
20- -keyout server-key.pem -out server-req.pem
21-
22- openssl x509 -req -days 365 -set_serial 01 \
23- -in server-req.pem \
24- -out server-cert.pem \
25- -CA ca.pem \
26- -CAkey ca.key
27-
28- # Cleanup
29- rm server-req.pem
30- # Could be needed
31- # chmod 777 server-cert.pem server-key.pem ca.pem
32- # Verify
33- openssl verify -verbose -x509_strict -CAfile ca.pem server-cert.pem
12+ ./docker/tests/make-certs.sh
3413```
Original file line number Diff line number Diff line change 1+ /* .pem
2+ /* .key
3+ /* .srl
4+ /* .cer
5+ /* .crl
6+ /* .csr
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ [alt_names]
2+ DNS.1 = ldap.server.intranet
3+
4+ [ req_distinguished_name ]
5+ CN=ldap.server.intranet
6+
7+ [ req ]
8+ distinguished_name = req_distinguished_name
9+ req_extensions = v3_req
10+ x509_extensions = ext_cert
11+ prompt = no
12+
13+ [ v3_req ]
14+ extendedKeyUsage = serverAuth,clientAuth
15+ subjectAltName = @alt_names
16+ basicConstraints = CA:FALSE
17+
18+ [ ext_cert ]
19+ subjectKeyIdentifier = hash
20+ authorityKeyIdentifier = keyid,issuer
21+ keyUsage = critical, digitalSignature,keyEncipherment
22+ basicConstraints = critical,CA:FALSE
23+ extendedKeyUsage = serverAuth,clientAuth
24+ subjectAltName = @alt_names
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -eux
4+
5+ ME=$( realpath $( dirname $0 ) )
6+
7+ cd $ME
8+
9+ printf ' Running in: %s\n' " $ME "
10+
11+ DOMAIN=" ldap.server.intranet"
12+ SSL_PATH=" $ME /"
13+ CA_PATH=" $SSL_PATH /data/${DOMAIN} _ca"
14+ KEYCERT_PATH=" $SSL_PATH /data/${DOMAIN} "
15+
16+ # bake the keys
17+ if [ ! -f $CA_PATH .key ]; then
18+ openssl ecparam -out $CA_PATH .key -name prime256v1 -genkey
19+ fi
20+
21+ if [ ! -f $KEYCERT_PATH .key ]; then
22+ openssl ecparam -out $KEYCERT_PATH .key -name prime256v1 -genkey
23+ fi
24+
25+ # bake the CA
26+ openssl req -x509 -config $SSL_PATH /openssl.cnf -new -nodes -key $CA_PATH .key -sha384 -days 15 -out $CA_PATH .cer
27+
28+ # bake the CSR
29+ if [ ! -f $KEYCERT_PATH .csr ]; then
30+ openssl req -new -config ${SSL_PATH} /${DOMAIN} .csr.conf -key $KEYCERT_PATH .key -out $KEYCERT_PATH .csr
31+ fi
32+
33+ # bake the cert
34+ openssl x509 -req -extensions ext_cert -extfile ${SSL_PATH} /${DOMAIN} .csr.conf -in $KEYCERT_PATH .csr -CA $CA_PATH .cer -CAkey $CA_PATH .key \
35+ -CAcreateserial -out $KEYCERT_PATH .cer -days 7 -sha384
36+
37+ openssl req -in $KEYCERT_PATH .csr -noout -text
38+ openssl x509 -in $KEYCERT_PATH .cer -noout -text
39+
40+ cat $KEYCERT_PATH .cer > ${KEYCERT_PATH} _fullchain.cer
41+ cat $CA_PATH .cer >> ${KEYCERT_PATH} _fullchain.cer
Original file line number Diff line number Diff line change 1+ [req]
2+ distinguished_name =req_distinguished_name
3+ prompt = no
4+
5+ [ req_distinguished_name ]
6+ C =FR
7+ ST =Test State
8+ L =Test Locality
9+ O =Wdes SAS
10+ OU =Testing
11+ CN =Emails
12+ emailAddress =tech@test-ca.intranet
You can’t perform that action at this time.
0 commit comments