-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split domains for client cert authentication
There are a lot of problems with the optional client certificate authentication on a single domain. As soon as a valid client cert for the domain in present in the keychain (MDM for example), it will be used by santa, or safari. With this commit, we undo the recent work, but we try to keep only one certificate, using the Subject Alternative Name extension. This way, only one chain has to be distributed to the clients.
- Loading branch information
Showing
15 changed files
with
140 additions
and
310 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,22 @@ | ||
server { | ||
listen 443 ssl http2; | ||
server_name zentral-clicertauth; | ||
|
||
ssl_certificate /etc/nginx/tls/zentral-clicertauth.crt; | ||
ssl_certificate_key /etc/nginx/tls/zentral-clicertauth.key; | ||
|
||
ssl_verify_client on; | ||
ssl_client_certificate /scep_CA/ca.pem; | ||
ssl_crl /scep_CA/crl.pem; | ||
|
||
location / { | ||
proxy_pass http://web:8000; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Url-Scheme $scheme; | ||
proxy_set_header X-SSL-Client-Cert $ssl_client_escaped_cert; | ||
proxy_set_header X-SSL-Client-S-DN $ssl_client_s_dn; | ||
client_max_body_size 10m; | ||
} | ||
} |
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 @@ | ||
zentral_ca.key | ||
zentral_ca.srl |
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 |
---|---|---|
@@ -1,22 +1,42 @@ | ||
# TLS material | ||
|
||
The files in this directory are provided as examples. DO NOT USE THEM IN PRODUCTION. | ||
The files in this directory are provided as examples. DO NOT USE THEM IN PRODUCTION!!! | ||
|
||
## How? | ||
|
||
Self signed certificate for the CA | ||
Create a self signed certificate for the CA: | ||
|
||
``` | ||
openssl genrsa -out zentral_ca.key 2048 | ||
openssl req -x509 -new -nodes -key zentral_ca.key -sha256 -days 3650 -out zentral_ca.crt | ||
openssl req -x509 -out zentral_ca.crt \ | ||
-newkey rsa:2048 -nodes -keyout zentral_ca.key \ | ||
-sha256 -days 3650 \ | ||
-extensions ext \ | ||
-config <(printf "[req]\nprompt=no\ndistinguished_name=dn\nreq_extensions=ext\n[dn]\nC=DE\nST=Hamburg\nL=Hamburg\nO=Zentral\nOU=IT\nCN=Zentral CA\nemailAddress=info@zentral.io\n[ext]\nbasicConstraints=CA:TRUE\nsubjectKeyIdentifier=hash\nkeyUsage=keyCertSign,cRLSign\n") | ||
``` | ||
|
||
Then, for each service: | ||
Create a certificate request for zentral: | ||
|
||
``` | ||
openssl genrsa -out zentral.key 2048 | ||
openssl req -new -key zentral.key -out zentral.csr | ||
openssl x509 -req -in zentral.csr -CA zentral_ca.crt -CAkey zentral_ca.key -CAcreateserial -out zentral.crt -days 3650 -sha256 | ||
openssl req \ | ||
-newkey rsa:2048 -nodes -keyout zentral.key \ | ||
-subj '/CN=zentral' \ | ||
-out zentral.csr | ||
``` | ||
|
||
We add the root cert to the generated certs for nginx. | ||
Add the extensions and sign the request with the CA, to build the certificate: | ||
|
||
For the fullchains, we add the cert again. | ||
``` | ||
openssl x509 \ | ||
-req -in zentral.csr \ | ||
-CA zentral_ca.crt -CAkey zentral_ca.key \ | ||
-CAcreateserial \ | ||
-days 3650 -sha256 \ | ||
-extensions ext \ | ||
-extfile <(printf "[ext]\nsubjectAltName=DNS:zentral,DNS:zentral-clicertauth\nkeyUsage=digitalSignature\nextendedKeyUsage=serverAuth,emailProtection") \ | ||
-out zentral.crt | ||
``` | ||
|
||
Create the fullchain: | ||
``` | ||
cat zentral.crt zentral_ca.crt > zentral_fullchain.crt | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,48 +1,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDhTCCAm0CCQDHjTs+1Tm9HjANBgkqhkiG9w0BAQsFADCBhTELMAkGA1UEBhMC | ||
REUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAOBgNVBAcTB0hhbWJ1cmcxEDAOBgNVBAoT | ||
B1plbnRyYWwxCzAJBgNVBAsTAklUMRMwEQYDVQQDEwpaZW50cmFsIENBMR4wHAYJ | ||
KoZIhvcNAQkBFg9pbmZvQHplbnRyYWwuaW8wHhcNMTcxMDE2MTUxOTU4WhcNMjcx | ||
MDE0MTUxOTU4WjCBgjELMAkGA1UEBhMCREUxEDAOBgNVBAgTB0hhbWJ1cmcxEDAO | ||
BgNVBAcTB0hhbWJ1cmcxEDAOBgNVBAoTB1plbnRyYWwxCzAJBgNVBAsTAklUMRAw | ||
DgYDVQQDEwd6ZW50cmFsMR4wHAYJKoZIhvcNAQkBFg9pbmZvQHplbnRyYWwuaW8w | ||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDGsF5240E/QVecjCfxW5XM | ||
/vIsp0Zwyk+TyvykOGSKbANXkAqSyh/1ped7MHGx+RTfgXOBhWHuxQfMEaUVy8wu | ||
zDXZxroOR40Y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y00RdHgeQJnhzbhauD7ELW3UPW26r | ||
M3/hrpMTwmJaqa5ZHAygwMCEcsasB5WFDQCZuVOTpYBv21IIgqG6REskf1Xx8Xmd | ||
1BXmOL0TEIjnWqOkm77WLMH1hnxHMorztE5O1V8JCcM46u1l5y3cp/rStPPzg1ky | ||
rADUMx83/gKFjdKEuDtFCSwNs9KOzXjeeysD39Mv7e54e74Y5kSP+W/hUxaIX0oL | ||
KKbzX9i21E/u9379kpBdfZE18RWsDw== | ||
-----END CERTIFICATE----- |
Oops, something went wrong.