[FIPS] Test that libbeat ES client will not connect to ES with invalid TLS certificate#45158
Conversation
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
CI, specifically the This test passes locally for me when I run it on a FIPS-configured VM. I believe this test fails in CI because we're running it on the same VM we use for all other tests, not on a FIPS-configured VM: beats/.buildkite/libbeat/pipeline.libbeat.yml Line 102 in 0b1170f |
belimawr
left a comment
There was a problem hiding this comment.
Aside from the failing tests: LGTM.
I'll wait for CI to be green before a final approval.
@ycombinator, just to understand, what is your plan here? Update Beats to use FIPS-enabled VMs before merging this PR? If so, would this be part of this PR?
@michel-laterman has put up #45199 to use FIPS-enabled VMS for the FIPS unit tests in Beats. Once that PR is merged, I'll rebase this PR here on |
|
@belimawr, @AndersonQ, could you please review? |
belimawr
left a comment
There was a problem hiding this comment.
LGMT
The certificate will expire in 5 years, if you want you could generate them every test like we do in elastic-agent-libs: https://github.com/elastic/elastic-agent-libs/blob/main/transport/tlscommontest/test_helper.go so we'll never have to update the tests to renew certificates.
…d TLS certificate (#45158) Add a new test under libbeat, TestConnectionTLS, that fakes an Elasticsearch HTTPS server that returns a TLS certificate that's been created with a key length of < 2048 bits, making it invalid for FIPS-compliant use. If running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will fail with a TLS error. If not running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will succeed. (cherry picked from commit 4db5493)
…d TLS certificate (#45158) Add a new test under libbeat, TestConnectionTLS, that fakes an Elasticsearch HTTPS server that returns a TLS certificate that's been created with a key length of < 2048 bits, making it invalid for FIPS-compliant use. If running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will fail with a TLS error. If not running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will succeed. (cherry picked from commit 4db5493)
…d TLS certificate (#45158) (#45596) Add a new test under libbeat, TestConnectionTLS, that fakes an Elasticsearch HTTPS server that returns a TLS certificate that's been created with a key length of < 2048 bits, making it invalid for FIPS-compliant use. If running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will fail with a TLS error. If not running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will succeed. (cherry picked from commit 4db5493) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
…d TLS certificate (#45158) (#45595) Add a new test under libbeat, TestConnectionTLS, that fakes an Elasticsearch HTTPS server that returns a TLS certificate that's been created with a key length of < 2048 bits, making it invalid for FIPS-compliant use. If running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will fail with a TLS error. If not running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will succeed. (cherry picked from commit 4db5493) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Proposed commit message
This PR adds a new test,
TestConnectionTLS, that fakes an Elasticsearch HTTPS server that returns a TLS certificate that's been created with a key length of < 2048 bits, making it invalid for FIPS-compliant use.If running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will fail with a TLS error.
If not running in FIPS mode, the test asserts that the Beat's connection to Elasticsearch will succeed.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry inCHANGELOG.next.asciidocorCHANGELOG-developer.next.asciidoc.Disruptive User Impact
None; this PR just adds a new unit test.
How to test this PR locally
In a non-FIPS environment:
In a FIPS environment, i.e. with the Microsoft Go fork installed and with the OpenSSL FIPS provider installed: