summaryrefslogtreecommitdiff
path: root/jstests/ssl/ssl_cluster_file.js
blob: 3b21f0896ee4af98670222d214ea21e8ee40de9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(function() {
"use strict";

var CA_CERT = "jstests/libs/ca.pem";
var SERVER_CERT = "jstests/libs/server.pem";
var CLIENT_CERT = "jstests/libs/client.pem";
var BAD_SAN_CERT = "jstests/libs/badSAN.pem";

var mongod = MongoRunner.runMongod({
    sslMode: "requireSSL",
    sslPEMKeyFile: SERVER_CERT,
    sslCAFile: CA_CERT,
    sslClusterFile: BAD_SAN_CERT
});

var mongo = runMongoProgram("mongo",
                            "--host",
                            "localhost",
                            "--port",
                            mongod.port,
                            "--ssl",
                            "--sslCAFile",
                            CA_CERT,
                            "--sslPEMKeyFile",
                            CLIENT_CERT,
                            "--eval",
                            ";");

// runMongoProgram returns 0 on success
assert.eq(
    0,
    mongo,
    "Connection attempt failed when an irrelevant sslClusterFile was provided to the server!");
MongoRunner.stopMongod(mongod);
}());