-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #33: Added support for cert based auth for apps
- Loading branch information
Showing
20 changed files
with
510 additions
and
27 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
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,42 @@ | ||
#!/bin/bash | ||
# Based on https://github.com/haoel/mTLS/blob/main/key.sh | ||
# run twice, first mv certs testcerts1 and then mv certs testcerts2 | ||
|
||
set -e | ||
|
||
pushd `dirname $0` > /dev/null | ||
SCRIPTPATH=`pwd -P` | ||
popd > /dev/null | ||
SCRIPTFILE=`basename $0` | ||
|
||
mkdir -p ${SCRIPTPATH}/certs | ||
|
||
cd ${SCRIPTPATH}/certs | ||
|
||
DAYS=3650 | ||
|
||
# generate a self-signed rootCA file that would be used to sign both the server and client cert. | ||
# Alternatively, we can use different CA files to sign the server and client, but for our use case, we would use a single CA. | ||
openssl req -newkey rsa:2048 \ | ||
-new -nodes -x509 \ | ||
-days ${DAYS} \ | ||
-out ca.crt \ | ||
-keyout ca.key \ | ||
-subj "/C=SO/ST=Earth/L=Mountain/O=IntTest/OU=IntCloud/CN=localhost" | ||
|
||
function generate_client() { | ||
CLIENT=$1 | ||
O=$2 | ||
OU=$3 | ||
openssl genrsa -out ${CLIENT}.key 2048 | ||
openssl req -new -key ${CLIENT}.key -out ${CLIENT}.csr \ | ||
-subj "/C=SO/ST=Earth/L=Mountain/O=$O/OU=$OU/CN=localhost" | ||
openssl x509 -req -in ${CLIENT}.csr \ | ||
-extfile <(printf "subjectAltName=DNS:localhost") \ | ||
-CA ca.crt -CAkey ca.key -out ${CLIENT}.crt -days ${DAYS} -sha256 -CAcreateserial | ||
} | ||
|
||
generate_client client.a Client-A Client-A-OU | ||
generate_client client.b Client-B Client-B-OU | ||
|
||
rm *.csr *.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDszCCApugAwIBAgIUV/xSc/ZUdzxRmjpNCdzn39Ue/6UwDQYJKoZIhvcNAQEL | ||
BQAwaTELMAkGA1UEBhMCU08xDjAMBgNVBAgMBUVhcnRoMREwDwYDVQQHDAhNb3Vu | ||
dGFpbjEQMA4GA1UECgwHSW50VGVzdDERMA8GA1UECwwISW50Q2xvdWQxEjAQBgNV | ||
BAMMCWxvY2FsaG9zdDAeFw0yNDA5MTQyMjMwNTVaFw0zNDA5MTIyMjMwNTVaMGkx | ||
CzAJBgNVBAYTAlNPMQ4wDAYDVQQIDAVFYXJ0aDERMA8GA1UEBwwITW91bnRhaW4x | ||
EDAOBgNVBAoMB0ludFRlc3QxETAPBgNVBAsMCEludENsb3VkMRIwEAYDVQQDDAls | ||
b2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDwza/O8MMa | ||
e1GfW6POO+1No2oB7E1FuBDW2IzWRXBuQ0+a6l7z9rf7dKV7hiscY8CnR5jG2k+q | ||
Fgv1CIjg9F7lUtwZ0/yF+vyO9YCuljagpe7zNn2nNgC/T9Kmpn9+kXzjCff3rC04 | ||
kxpcmeBukqF86fWMuiaexyQ5O8or9PPfF6ztZm/nt16A8rW4RG+9/4eXrESOkc/K | ||
ryhU4/7bCtYyUOmcCwNhoi0Q6ZgNZyyMV2bC5YvFb6j3u06fK8VW19yQKF1g/Wnh | ||
TiRJ/nBhgtMoD4HlhCiLO1iz/GnvzmmS3qmNuRCMByCwl9rujauEGn/30lVzRiPd | ||
ohJcmroaS2S9AgMBAAGjUzBRMB0GA1UdDgQWBBQrvkEu/Q4G7J/hQcZb2R0uY7zI | ||
lTAfBgNVHSMEGDAWgBQrvkEu/Q4G7J/hQcZb2R0uY7zIlTAPBgNVHRMBAf8EBTAD | ||
AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQDpv5ATJo9iv5VmgGd+k5V5jxzxtGlBticU | ||
S3zMCvI2wG/U/Q0TzUQIvb97FUp4FNl+sP0zGUmNLUHx1UPeq17E2+lEcJGtq1Xz | ||
xHEEo6w5PEvdXHKh7S/m7HWd1xoIcYBpWa+dtsMH25aanRJcXLVnVFvJ2s4bpOBs | ||
3h+CagPnso/zxKTci4ar9OVmVH68f+CodzKLxZP1JYc5FDT4t5WIkkMzeJSevwWC | ||
g0m4/kxhG/Doy9+foQK3U2MQyFLf7OrVYs8D+MfUWmEpP7NSFNYEg30mWI3+jw9I | ||
W8Y1ftmWnKqhN4sGkK9MhrAuKAV8vzDnGqtYI8ynaWzPq4dmzXHp | ||
-----END CERTIFICATE----- |
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,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDwza/O8M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hAVPPI92e/TGq95g8n2ewsCt | ||
7EfEknL2FwKBgFbQOmOVAqFBKbB5BrvMQQ2ZUvVPgB1dg6+wWPo6TJLRh2RaG2yD | ||
NHTHcquH/Pedy0BomfnOOy0nCSyaH8qQgtvPhzwNUXDlZlRnl3EW+Lui8y/7i0w7 | ||
y7VEwlk97celSqhByzI4UVbMExb+LrXrW/152XYgEz+pf/0DOYEpahjhAoGAew7G | ||
TrJ6scpbgjwkHabtA6Yti8OXto/CLkCsPm1EOTHOKQ8eoFVB+qLlL4SinBxOPnNe | ||
8ugmfJbUFBHsx980k3Lzm32NjXX5S3UZAQ1k+qgxJ0L5wWWvs3bVUrSJzW8JLgMf | ||
oPOUFGDvZsWXODVDBPmUC6zkjdyvK8/uB7Co5YUCgYEAxbbxDryPRZZ4j82lqQ4n | ||
jjHJSF5y3QxXQpgqKVJg2YqiQMLLhmISBciMU4dUTm/Tj2qwrl6tc0Xk2dUYcLB3 | ||
9z6pQMqV3AJrQu4dLp4m39cMHSJV39yyxwGUFOG7jJlbhcl2iuzpsBmB5iw9Az6x | ||
F/RKdj/xBeL9maYjO83zTN8= | ||
-----END PRIVATE 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,22 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDvDCCAqSgAwIBAgIUK50cAFltk8nri254afjfpf6lFOIwDQYJKoZIhvcNAQEL | ||
BQAwaTELMAkGA1UEBhMCU08xDjAMBgNVBAgMBUVhcnRoMREwDwYDVQQHDAhNb3Vu | ||
dGFpbjEQMA4GA1UECgwHSW50VGVzdDERMA8GA1UECwwISW50Q2xvdWQxEjAQBgNV | ||
BAMMCWxvY2FsaG9zdDAeFw0yNDA5MTQyMjMwNTVaFw0zNDA5MTIyMjMwNTVaMG0x | ||
CzAJBgNVBAYTAlNPMQ4wDAY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