How to generate pem files locally?

What are the proper commands to generate the pem files locally

I tried moving m310-certs pem files into the shared directory in vagrant database vm but when I did mongod command I saw this:

vagrant@database:~ openssl x509 -in shared/client.pem -inform PEM -subject -nameopt RFC2253 -noout subject= C=US,ST=New York,L=New York City,O=MongoDB,OU=University2,CN=M310 Client vagrant@database:~ mongo --ssl --sslPEMKeyFile shared/client.pem --sslCAFile shared/c
ca.pem client.pem
vagrant@database:~$ mongo --ssl --sslPEMKeyFile shared/client.pem --sslCAFile shared/ca.pem
MongoDB shell version: 3.2.22
connecting to: test
2020-09-01T12:23:00.199+0000 E NETWORK [thread1] The server certificate does not match the host name 127.0.0.1
2020-09-01T12:23:00.200+0000 E QUERY [thread1] Error: socket exception [CONNECT_ERROR] for The server certificate does not match the host name 127.0.0.1 :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed

I would like to be able to know how to generate the pem files locally so that I can point the subject line and try to follow Lesson 1.4.2 on M310.

You are missing host parameter

Homework 1.3: Enabling Internal Authentication using X.509 - Not able to authen

1 Like

Thanks hostname was misssing indeed. I also had to generate my own certificates using openssl. I was hoping you could tell me the best commands to do that but if not no problem!

Please check this thread

How to create server.pem, client.pem and ca.pem files?

Thank you!