Appendix A - OpenSSL CA Certificate for Testing¶
Disclaimer
This page is provided for testing purposes only and the certificates are for testing purposes only.
The following tutorial provides some guidelines for creating test x.509 certificates:
- Do not use these certificates for production. Instead, follow your security policies.
- For information on OpenSSL, refer to the official OpenSSL docs. Although this tutorial uses OpenSSL, the material should not be taken as an authoritative reference on OpenSSL.
Procedures¶
The following procedures outlines the steps to create a test CA PEM file. The procedure creates both the CA PEM file and an intermediate authority certificate and key files to sign server/client test certificates.
A. Create the OpenSSL Configuration File¶
Create a configuration file
openssl-test-ca.cnf
with the following content:Optional. You can update the default Distinguished Name (DN) values.
B. Generate the Test CA PEM File¶
Create the test CA key file
mongodb-test-ca.key
.Tip
This private key is used to generate valid certificates for the CA. Although this private key, like all files in this appendix, is intended for testing purposes only, you should engage in good security practices and secure this key file.
Create the CA certificate
mongod-test-ca.crt
using the generated key file. When asked for Distinguished Name values, enter the appropriate values for your test CA certificate.Create the private key for the intermediate certificate.
Tip
This private key is used to generate valid certificates for the intermediate authority. Although this private key, like all files in this appendix, is intended for testing purposes only, you should engage in good security practices and secure this key file.
Create the certificate signing request for the intermediate certificate. When asked for Distinguished Name values, enter the appropriate values for your test Intermediate Authority certificate.
Create the intermediate certificate
mongodb-test-ia.crt
.Create the test CA PEM file from the test CA certificate
mongod-test-ca.crt
and test intermediate certificatemongodb-test-ia.crt
.
You can use the test PEM file when configuring mongod
,
mongos
, or mongo
for TLS/SSL testing.
You can use the test intermediate authority to sign the test certificates for both the server(s) and client(s). A single authority must issue the certificates for both the client and the server.