-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
how to add certs with SAN. go1.15 onwards would not take CN
- Loading branch information
Showing
4 changed files
with
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
all: ca-cert client-cert router-cert | ||
|
||
ca-cert: | ||
openssl genrsa -out ca/ca.key 4096 | ||
openssl req -x509 -new -key ca/ca.key \ | ||
-days 3650 -out ca/ca.crt \ | ||
-config ca/ca.cnf | ||
|
||
client-cert: | ||
openssl genrsa -out client/client.key 4096 | ||
openssl req -new -key client/client.key \ | ||
-out client/client.csr -config client/client.cnf | ||
openssl x509 -req -days 365 -in client/client.csr \ | ||
-CA ca/ca.crt -CAkey ca/ca.key \ | ||
-CAcreateserial -out client/client.crt | ||
|
||
router-cert: | ||
openssl genrsa -out router/router.key 4096 | ||
openssl req -new -key router/router.key \ | ||
-out router/router.csr -config router/router.cnf | ||
openssl x509 -req -days 365 -in router/router.csr \ | ||
-CA ca/ca.crt -CAkey ca/ca.key \ | ||
-CAcreateserial -out router/router.crt \ | ||
-extensions req_ext -extfile router/router.cnf | ||
cat router/router.crt router/router.key > router/router.pem | ||
|
||
read-ca-crt: | ||
openssl x509 -text -noout -in ca/ca.crt | ||
|
||
read-client-csr: | ||
openssl req -noout -text -in client/client.csr | ||
|
||
read-client-crt: | ||
openssl x509 -text -noout -in client/client.crt | ||
|
||
read-router-csr: | ||
openssl req -noout -text -in router/router.csr | ||
|
||
read-router-crt: | ||
openssl x509 -text -noout -in router/router.crt | ||
|
||
clean: | ||
rm */*.crt */*.key */*.csr */*.srl */*.pem |
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,10 @@ | ||
[req] | ||
distinguished_name = req_distinguished_name | ||
prompt = no | ||
|
||
[req_distinguished_name] | ||
countryName = US | ||
stateOrProvinceName = California | ||
localityName = Sunnyvale | ||
organizationalUnitName = Engineering | ||
commonName = Self Signed Root CA |
10 changes: 10 additions & 0 deletions
10
docs/howto-certs-san/x.509-certs-with-san/client/client.cnf
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,10 @@ | ||
[req] | ||
distinguished_name = req_distinguished_name | ||
prompt = no | ||
|
||
[req_distinguished_name] | ||
countryName = US | ||
stateOrProvinceName = California | ||
localityName = Sunnyvale | ||
organizationalUnitName = Engineering | ||
commonName = client |
19 changes: 19 additions & 0 deletions
19
docs/howto-certs-san/x.509-certs-with-san/router/router.cnf
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,19 @@ | ||
[req] | ||
distinguished_name = req_distinguished_name | ||
req_extensions = req_ext | ||
prompt = no | ||
|
||
[req_distinguished_name] | ||
countryName = US | ||
stateOrProvinceName = California | ||
localityName = Sunnyvale | ||
organizationalUnitName = Engineering | ||
commonName = router | ||
|
||
[req_ext] | ||
subjectAltName = @alt_names | ||
|
||
[alt_names] | ||
DNS.1 = router | ||
DNS.2 = router.englab.juniper.net | ||
DNS.3 = *.juniper.net |