-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: local CA and forced ssl verification
- Loading branch information
1 parent
08eb78c
commit 0c5878a
Showing
5 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.crt | ||
*.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
OUTPUT=${CERTS_OUTPUT_DIR:-.} | ||
mkdir -p $OUTPUT | ||
|
||
openssl req -x509 -new -nodes -days 3650 -keyout "$OUTPUT/ca.key" -out "$OUTPUT/ca.crt" -subj "/CN=example-ca" | ||
|
||
openssl req -new -nodes -newkey rsa:2048 -keyout "$OUTPUT/server.key" -out "$OUTPUT/server.csr" -subj "/CN=db" | ||
|
||
openssl x509 -req -in "$OUTPUT/server.csr" -CA "$OUTPUT/ca.crt" -CAkey "$OUTPUT/ca.key" -CAcreateserial -out "$OUTPUT/server.crt" -days 3650 | ||
|
||
openssl req -new -key "$OUTPUT/server.key" -out "$OUTPUT/server.csr" -config san_config.cnf | ||
|
||
openssl x509 -req -in "$OUTPUT/server.csr" -CA "$OUTPUT/ca.crt" -CAkey "$OUTPUT/ca.key" -CAcreateserial -out "$OUTPUT/server.crt" -days 3650 -extfile san_config.cnf -extensions v3_req | ||
|
||
rm -f "$OUTPUT/server.csr" | ||
|
||
chmod 600 "$OUTPUT/ca.key" "$OUTPUT/server.key" | ||
chmod 644 "$OUTPUT/ca.crt" "$OUTPUT/server.crt" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[req] | ||
prompt = no | ||
default_bits = 2048 | ||
default_md = sha256 | ||
distinguished_name = dn | ||
req_extensions = req_ext | ||
|
||
[dn] | ||
CN = db | ||
|
||
[req_ext] | ||
subjectAltName = @alt_names | ||
|
||
[v3_req] | ||
keyUsage = digitalSignature, keyEncipherment | ||
extendedKeyUsage = serverAuth, clientAuth | ||
basicConstraints = CA:FALSE | ||
subjectAltName = @alt_names | ||
|
||
[alt_names] | ||
DNS.1 = db | ||
DNS.2 = localhost |