CNs are important!!! -days 3650
openssl req -newkey rsa:2048 -new -x509 -days 3650 -nodes -subj '/C=US/ST=Massachusetts/L=Bedford/O=Personal/OU=Personal/[email protected]/CN=localhost' -out mongodb-cert.crt -keyout mongodb-cert.keycat mongodb-cert.key mongodb-cert.crt > mongodb.pemcp mongodb-cert.crt mongodb-ca.crt# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
ssl:
mode: allowSSL
PEMKeyFile: /etc/ssl/mongodb.pem
CAFile: /etc/ssl/mongodb-cert.crtsudo mongod --config /etc/mongod.confsudo service mongod restartmongo --ssl --sslAllowInvalidHostnames --sslCAFile mongodb-ca.crt --sslPEMKeyFile /etc/ssl/mongodb.pem{
ssl: true,
sslValidate: true,
sslKey: fs.readFileSync('/etc/ssl/mongodb.pem'),
sslCert: fs.readFileSync('/etc/ssl/mongodb-cert.crt'),
sslCA: fs.readFileSync('/etc/ssl/mongodb-ca.crt')
}
@todbapi @achesco
While using mongosh, you are passing both pem and crt. Why are we passing the file containing the private key? Should not the client use just the public key?
In my client application I only have provision to provide public key.