diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2019-02-06 21:49:47 -0600 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2019-03-01 16:06:08 +0000 |
commit | 987e5fc980b2288371ebd2c133b58466cc646d60 (patch) | |
tree | dfa2cb994cc27c23964aad50b040e83595b2d338 /jstests/libs | |
parent | 6b601f1005a683fb5fd6050b8ecb618c49fd6e59 (diff) | |
download | mongo-987e5fc980b2288371ebd2c133b58466cc646d60.tar.gz |
SERVER-39217 SecureTransport with Intermediate CA
Diffstat (limited to 'jstests/libs')
-rw-r--r-- | jstests/libs/server-intermediate-ca.pem | 69 | ||||
-rwxr-xr-x | jstests/libs/server-intermediate-ca.pem.sh | 33 |
2 files changed, 102 insertions, 0 deletions
diff --git a/jstests/libs/server-intermediate-ca.pem b/jstests/libs/server-intermediate-ca.pem new file mode 100644 index 00000000000..49177236cdf --- /dev/null +++ b/jstests/libs/server-intermediate-ca.pem @@ -0,0 +1,69 @@ +-----BEGIN CERTIFICATE----- +MIIDeTCCAmECFHw+FnGIXPbuzpqG28urvjff3s2tMA0GCSqGSIb3DQEBCwUAMHUx +CzAJBgNVBAYTAlVTMREwDwYDVQQIDAhOZXcgWW9yazEWMBQGA1UEBwwNTmV3IFlv +cmsgQ2l0eTEQMA4GA1UECgwHTW9uZ29EQjEPMA0GA1UECwwGS2VybmVsMRgwFgYD +VQQDDA9JbnRlcm1lZGlhdGUgQ0EwHhcNMTkwMjI3MTY0NjExWhcNMjkwMjI0MTY0 +NjExWjB9MQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcM +DU5ldyBZb3JrIENpdHkxEDAOBgNVBAoMB01vbmdvREIxDzANBgNVBAsMBktlcm5l +bDEgMB4GA1UEAwwXU2VydmVyIFZpYSBJbnRlcm1lZGlhdGUwggEiMA0GCSqGSIb3 +DQEBAQUAA4IBDwAwggEKAoIBAQCZ7sGixY2OsOTWzB1Ww08iFToqFxdo7/nqoE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ggEBAGO+3qQVjmwtjnoJY3DnWV15ySBj4b6Ir1LlKfngXfpfwlksOZaQsg0mLv3S +sNfWK1BgQAZZ6iRxIc+T4stpIe3GppDB+a194s7ZuhXP1HpdEZEjr5CkD5cQ5YKv +OgDry6iGeHnUkaATRHR1iXHCnbAWVkKRNObkcL5Haxa1jLlyiHdMJmqwlfVWVOlx +NlpEz/Nw6eVXE6vOfYx5lRCVxzP4Ym1RH8+D/c+xoixEgXpif5PpEeEP4IYm1xkr +nUCpkvESWaAVGnBpeHUs5WuovyvBrvxBSB6sjIvrr45jLMwX0agJ8rx8RzZ9IShA +WyA3ZWFlGiMWYzxi/2B/z+GhIS8= +-----END CERTIFICATE----- diff --git a/jstests/libs/server-intermediate-ca.pem.sh b/jstests/libs/server-intermediate-ca.pem.sh new file mode 100755 index 00000000000..3860ca899b9 --- /dev/null +++ b/jstests/libs/server-intermediate-ca.pem.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Create an intermediate signing authority and use it to sign a server certificate. +# Run this from the base directory of the server source. +set -ev + +PREFIX="/C=US/ST=New York/L=New York City/O=MongoDB/OU=Kernel" +OPENSSL="/opt/mongodbtoolchain/v3/bin/openssl" + +cd jstests/libs + +# Build intermediate CA. +$OPENSSL req -new -subj "${PREFIX}/CN=Intermediate CA" \ + -keyout intermediate-ca.key -out intermediate-ca.csr \ + -nodes -batch -sha256 -newkey rsa:2048 +$OPENSSL rsa -in intermediate-ca.key -out intermediate-ca.rsa +$OPENSSL x509 -in intermediate-ca.csr -out intermediate-ca.pem \ + -req -CA ca.pem -days 3650 -CAcreateserial + +# Build leaf cert signed by intermediate CA. +$OPENSSL req -new -subj "${PREFIX}/CN=Server Via Intermediate" \ + -keyout server-intermediate-ca.key -out server-intermediate-ca.csr \ + -nodes -batch -sha256 -newkey rsa:2048 +$OPENSSL rsa -in server-intermediate-ca.key -out server-intermediate-ca.rsa +$OPENSSL x509 -in server-intermediate-ca.csr -out server-intermediate-ca.pem \ + -req -CA intermediate-ca.pem -CAkey intermediate-ca.rsa \ + -days 3650 -CAcreateserial + +# Create final bundle and cleanup. +cat server-intermediate-ca.rsa intermediate-ca.pem >> server-intermediate-ca.pem + +rm ca.srl intermediate-ca.srl +rm server-intermediate-ca.key server-intermediate-ca.rsa server-intermediate-ca.csr +rm intermediate-ca.pem intermediate-ca.rsa intermediate-ca.key intermediate-ca.csr |