Permalink
Browse files

SERVER-7202 test with certificates

Adjust unit tests to present certificates for validation at SSL handshake time.
  • Loading branch information...
1 parent 7f15a5c commit 1dfaa36f44989f41eadc1b7d8e108ca105be3a55 @milkie milkie committed Dec 11, 2012
Showing with 92 additions and 5 deletions.
  1. +8 −4 buildscripts/smoke.py
  2. +18 −0 jstests/libs/ca.pem
  3. +32 −0 jstests/libs/client.pem
  4. +32 −0 jstests/libs/server.pem
  5. +2 −1 jstests/ssl/replset1.js
View
@@ -196,8 +196,10 @@ def start(self):
argv += ['--auth']
self.auth = True
if self.kwargs.get('use_ssl'):
- argv += ['--sslOnNormalPorts', '--sslPEMKeyFile', 'jstests/libs/smoke.pem']
-
+ argv += ['--sslOnNormalPorts',
+ '--sslPEMKeyFile', 'jstests/libs/server.pem',
+ '--sslCAFile', 'jstests/libs/ca.pem']
+
print "running " + " ".join(argv)
self.proc = self._start(buildlogger(argv, is_global=True))
@@ -393,7 +395,9 @@ def runTest(test):
if small_oplog or small_oplog_rs:
argv += ["--eval", 'testingReplication = true;']
if use_ssl:
- argv += ["--ssl"]
+ argv += ["--ssl",
+ "--sslPEMKeyFile", "jstests/libs/client.pem",
+ "--sslCAFile", "jstests/libs/ca.pem"]
argv += [path]
elif ext in ["", ".exe"]:
# Blech.
@@ -406,7 +410,7 @@ def runTest(test):
argv = [test_path and os.path.abspath(os.path.join(test_path, path)) or path,
"--port", mongod_port]
else:
- raise Bug("fell off in extenstion case: %s" % path)
+ raise Bug("fell off in extension case: %s" % path)
if keyFile:
f = open(keyFile, 'r')
View
@@ -0,0 +1,18 @@
+-----BEGIN CERTIFICATE-----
+MIIC9DCCAl2gAwIBAgIJAJeYVdtunBOmMA0GCSqGSIb3DQEBBQUAMIGSMQswCQYD
+VQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENp
+dHkxDjAMBgNVBAoMBTEwR2VuMQ8wDQYDVQQLDAZLZXJuZWwxGjAYBgNVBAMMEU15
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sXtQUTru660LD0QrmDNSauhpEmlpJknicnGt
+hmwRAkEA12MI6bBPlir0/jgxQqxI1w7mJqj8Vg27zpEuO7dzzLoyJHddpcSNBbwu
+npaAakiZK42klj26T9+XHvjYRuAbMwJBAJ5WnwWEkGH/pUHGEAyYQdSVojDKe/MA
+Vae0tzguFswK5C8GyArSGRPsItYYA7D4MlG/sGx8Oh2C6MiFndkJzBECQDcP1y4r
+Qsek151t1zArLKH4gG5dQAeZ0Lc2VeC4nLMUqVwrHcZDdd1RzLlSaH3j1MekFVfT
+6v6rrcNLEVbeuk4=
+-----END PRIVATE KEY-----
@@ -1,4 +1,5 @@
ssl_options = {sslOnNormalPorts : "",
- sslPEMKeyFile : "jstests/libs/smoke.pem"};
+ sslPEMKeyFile : "jstests/libs/server.pem",
+ sslCAFile: "jstests/libs/ca.pem"};
load("jstests/replsets/replset1.js");

0 comments on commit 1dfaa36

Please sign in to comment.