Skip to content

Conversation

addaleax
Copy link
Collaborator

No description provided.

@addaleax addaleax marked this pull request as ready for review May 31, 2022 12:32
tasks:
- name: e2e_tests_linux_x64
- name: e2e_tests_linux_x64_openssl11
- name: e2e_tests_linux_x64_openssl11_fips
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only variant where FIPS support worked out of the box. For other OSes, I guess the docker tests have to be enough (although I was pleasantly surprised to see that FIPS support works even for their docker images).

RUN yum repolist
RUN yum install -y /tmp/*mongosh*.rpm
RUN /usr/bin/mongosh --version
RUN /usr/bin/mongosh --build-info
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just so that we can see the openssl config values more easily for debugging

4. Create a bundle with client key and certificate to use for connecting:
4. Create an encrypted client key file from the existing unencrypted one:
```
openssl pkcs8 -topk8 -in client.key -v2 aes-256-cbc -out client.encrypted.key -passout pass:p4ssw0rd
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to use the openssl pkcs8 command here, because it gives a different format than openssl rsa, and in particular the password derviation algorithm used by the latter isn’t FIPS-compatible (you can tell the difference by the different section names in the client.bundle.encrypted.pem file)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have never figured this one

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,111 @@
Certificate:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not used by tests, but it’s part of the setup described in the README. It should either be included or in the .gitignore list, no strong preference, for now I just decided to include it.

}

for (const { input, output, testArgs } of [{
const skipFipsWithOpenSSL3 = process.env.MONGOSH_SMOKE_TEST_OS_SKIP_FIPS_WITH_OPENSSL3 && buildInfo().opensslVersion.startsWith('3.');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to add this option since the docker images that provide a OpenSSL-3-capable OS don’t provide FIPS support in a usable way. That’s okay – we are being clear here about the fact that what we provide is shared OpenSSL support and the ability to put OpenSSL in FIPS mode. Making sure that their local OpenSSL works in FIPS mode is the user’s responsibility.

4. Create a bundle with client key and certificate to use for connecting:
4. Create an encrypted client key file from the existing unencrypted one:
```
openssl pkcs8 -topk8 -in client.key -v2 aes-256-cbc -out client.encrypted.key -passout pass:p4ssw0rd
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have never figured this one

@addaleax addaleax merged commit b1af047 into main Jun 1, 2022
@addaleax addaleax deleted the 1222-dev branch June 1, 2022 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants