diff options
author | Sara Golemon <sara.golemon@mongodb.com> | 2018-08-29 18:14:39 +0000 |
---|---|---|
committer | Sara Golemon <sara.golemon@mongodb.com> | 2018-09-10 21:08:05 +0000 |
commit | 1070aa3880ac73bc1923b44a372c61c209a35f61 (patch) | |
tree | 7c306e5f83b026d59a13ed698b1b719d5753a27c /jstests/ssl | |
parent | 643fa66bfa58e17f70e528f2f2ed5b09c745b951 (diff) | |
download | mongo-1070aa3880ac73bc1923b44a372c61c209a35f61.tar.gz |
SERVER-36919 Add server setParameter tlsSuppressClientCertificate
Diffstat (limited to 'jstests/ssl')
-rw-r--r-- | jstests/ssl/ssl_withhold_client_cert.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/jstests/ssl/ssl_withhold_client_cert.js b/jstests/ssl/ssl_withhold_client_cert.js new file mode 100644 index 00000000000..3839e5d6aef --- /dev/null +++ b/jstests/ssl/ssl_withhold_client_cert.js @@ -0,0 +1,45 @@ +// Test setParameter tlsWithholdClientCertificate + +(function() { + "use strict"; + + function testRS(opts, expectWarning) { + const rsOpts = { + nodes: {node0: opts, node1: opts}, + }; + const rs = new ReplSetTest(rsOpts); + rs.startSet(); + rs.initiate(); + rs.awaitReplication(); + + const test = rs.getPrimary().getDB('test'); + test.foo.insert({bar: "baz"}); + rs.awaitReplication(); + + function checkWarning(member) { + const observed = + /no SSL certificate provided by peer/.test(cat(member.fullOptions.logFile)); + assert.eq(observed, expectWarning); + } + checkWarning(rs.getPrimary()); + checkWarning(rs.getSecondary()); + rs.stopSet(); + } + + const base_options = { + tlsMode: 'requireTLS', + tlsPEMKeyFile: 'jstests/libs/server.pem', + tlsCAFile: 'jstests/libs/ca.pem', + tlsAllowInvalidHostnames: '', + useLogFiles: true, + }; + testRS(base_options, false); + + const test_options = Object.extend({ + tlsAllowConnectionsWithoutCertificates: '', + setParameter: 'tlsWithholdClientCertificate=true', + }, + base_options); + + testRS(test_options, true); +}()); |