Skip to content

Instantly share code, notes, and snippets.

View sanikolaev's full-sized avatar

Sergey Nikolaev sanikolaev

View GitHub Profile
@achesco
achesco / generate-mongo-ssl.md
Last active April 29, 2024 11:18
Generate self-signed SSL certificates for MongoDb server and client

CNs are important!!! -days 3650

Make PEM containig a public key certificate and its associated private key

openssl req -newkey rsa:2048 -new -x509 -days 3650 -nodes -subj '/C=US/ST=Massachusetts/L=Bedford/O=Personal/OU=Personal/emailAddress=example@example.com/CN=localhost' -out mongodb-cert.crt -keyout mongodb-cert.key
cat mongodb-cert.key mongodb-cert.crt > mongodb.pem