summaryrefslogtreecommitdiff
path: root/jstests/ssl/macos_encrypted_pem.js
blob: a154ca72d090c29fdf3c200508a6d05773c63641 (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
// Test macOS refusing to start up with encrypted PEM file.

load('jstests/ssl/libs/ssl_helpers.js');
requireSSLProvider('apple', function() {
    'use strict';

    jsTest.log("Verifying that mongod will fail to start using an encrypted PEM file");

    const config = MongoRunner.mongodOptions({
        sslPEMKeyFile: "jstests/libs/password_protected.pem",
        sslMode: "requireSSL",
        sslPEMKeyPassword: "qwerty",
        sslCAFile: "jstests/libs/ca.pem",
        useLogFiles: true,
    });

    const mongod = MongoRunner.runMongod(config);
    assert(mongod === null, "MongoD unexpectedly started up");

    const logFile = cat(config.logFile);
    assert.eq(logFile.includes(
                  "Using encrypted PKCS#1/PKCS#8 PEM files is not supported on this platform"),
              true,
              logFile);
});