summaryrefslogtreecommitdiff
path: root/jstests/ssl/ssl_fips.js
blob: ebcac31e91b4897ca09e7f8e6a4a660950335587 (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
// Test mongod start with FIPS mode enabled
ports = allocatePorts(1);
port1 = ports[0];
var baseName = "jstests_ssl_ssl_fips";


var md = startMongod("--port", port1, "--dbpath",
                     MongoRunner.dataPath + baseName, "--sslMode", "requireSSL",
                     "--sslPEMKeyFile", "jstests/libs/server.pem",
                     "--sslFIPSMode");

var mongo = runMongoProgram("mongo", "--port", port1, "--ssl", "--sslAllowInvalidCertificates",
                            "--sslPEMKeyFile", "jstests/libs/client.pem",
                            "--sslFIPSMode",
                            "--eval", ";");

// if mongo shell didn't start/connect properly
if (mongo != 0) {
    print("mongod failed to start, checking for FIPS support");
    assert(rawMongoProgramOutput().match(
            /this version of mongodb was not compiled with FIPS support/));
}
else {
    // kill mongod
    stopMongod(port1);
}