Correctly building the client cert subjectAltNames
Still haven't managed to try it due to: https://github.com/docker/docker/issues/8943
This commit is contained in:
1 parent
79cc2d6d25
commit
927d40f47f
2 files changed
+9
-3
No files matched your search
@@ -50,3 +50,4 @@ Vagrantfile.local
|
|||||||
test/tls/*.pem
|
test/tls/*.pem
|
||||||
test/tls/*.srl
|
test/tls/*.srl
|
||||||
test/tls/*.csr
|
test/tls/*.csr
|
||||||
|
test/tls/*.cnf
|
||||||
+8
-3
@@ -27,10 +27,15 @@ $(SERVER_PEMS): %.server.pem: %.server.csr ca-key.pem %.ca.pem
|
|||||||
client.csr: client-key.pem
|
client.csr: client-key.pem
|
||||||
openssl req -subj '/CN=client' -new -key client-key.pem -out $@
|
openssl req -subj '/CN=client' -new -key client-key.pem -out $@
|
||||||
|
|
||||||
$(CLIENT_PEMS): %.client.pem: client.csr ca-key.pem %.ca.pem
|
$(CLIENT_PEMS): %.client.pem: client.csr ca-key.pem %.ca.pem client-extfile.cnf
|
||||||
openssl x509 -req -days 3650 -in client.csr \
|
openssl x509 -req -days 3650 -in client.csr \
|
||||||
-CA $(@:.client.pem=.ca.pem) -CAkey ca-key.pem -CAcreateserial \
|
-CA $(@:.client.pem=.ca.pem) -CAkey ca-key.pem -CAcreateserial \
|
||||||
-extfile <(echo "extendedKeyUsage = clientAuth") -out $@
|
-extfile client-extfile.cnf \
|
||||||
|
-out $@
|
||||||
|
|
||||||
|
client-extfile.cnf:
|
||||||
|
IPS=$$(ip -4 addr ls | sed -n -e 's|\s*inet \([^/]*\).*|IP:\1|p' | tr '\n' ','); \
|
||||||
|
echo -e "extendedKeyUsage = clientAuth\nsubjectAltName = $${IPS%,}" > client-extfile.cnf
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.pem *.csr *.srl
|
rm -f *.pem *.csr *.srl *.cnf
|
||||||
Reference in new issue
Block a user