[FIPS] Test that ES client will not connect to ES with invalid TLS certificate#5088
[FIPS] Test that ES client will not connect to ES with invalid TLS certificate#5088ycombinator merged 13 commits intoelastic:mainfrom
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
|
We don't have unit tests that run with the FIPS provider here, we should probably change that if it's now required |
|
@v1v @oakrizan @pazone @pkoutsovasilis could one of you please help me understand why CI is failing on this PR? See https://buildkite.com/elastic/fleet-server/builds/9107#0197e9e5-3d2b-407b-90cc-b958d69a7747. I don't understand which command is exiting with status 126. In general, what can be done to make it easier to debug such issues? I tried added |
Does it work in i can see https://buildkite.com/elastic/fleet-server/builds/9100#0197e5b8-3de9-447a-b0de-0c0f679427f2/1 used regardless, I see it uses I can see some errors when invoking IIUC, this project does not use
The platform productivity team enabled a feature to launch VM images, so you can create a VM based on I've just found you added
That's the reason some references for I see you changed recently and https://buildkite.com/elastic/fleet-server/builds/9114#0197ead1-94ad-477c-8830-9063843a8b55/138-191 is failing for other reasons |
|
Thanks @v1v for the prompt response, as always! ❤️
Yes, this was something @michel-laterman suggested to me off-PR (thanks!) and it seems to have got us past the |
Thanks @v1v. I created an EC2 instance with this image and am able to reproduce the failure seen in CI over there. 👍 |
ada8418 to
582d93f
Compare
|
Both FIPS unit test steps are failing in CI on this PR like so: I manually spun up an EC2 VM with the same AMI as used in this PR, But I haven't figured out why it's happening or how to fix it. Some observations that might give some hints: If I run the If I don't use the @v1v @michel-laterman have you seen this error before? any ideas as to what might be going on or how to try and fix this? |
83ac0b6 to
bc2796f
Compare
v1v
left a comment
There was a problem hiding this comment.
LGTM (I only reviewed the CI changes)
|
…rtificate (#5088) * Adding unit test for connecting to FIPS-incapable ES * Make linter happy * Reordering imports * Run FIPS unit tests on FIPS VM * Install Microsoft Go if FIPS=true * Debugging * Use fleet server FIPS VM image * Debugging: extracting microsoft/go outside of fleet-server folder * Explicitly specify Go distribution for tests * Use temporary folder for microsoft/go SDK * Don't pass GOEXPERIMENT=systemcrypto when running tests with Go stdlib * Remove debugging statements * Reduce VM size (cherry picked from commit c0ae099)
…rtificate (#5088) * Adding unit test for connecting to FIPS-incapable ES * Make linter happy * Reordering imports * Run FIPS unit tests on FIPS VM * Install Microsoft Go if FIPS=true * Debugging * Use fleet server FIPS VM image * Debugging: extracting microsoft/go outside of fleet-server folder * Explicitly specify Go distribution for tests * Use temporary folder for microsoft/go SDK * Don't pass GOEXPERIMENT=systemcrypto when running tests with Go stdlib * Remove debugging statements * Reduce VM size (cherry picked from commit c0ae099)
…rtificate (#5088) (#5142) * Adding unit test for connecting to FIPS-incapable ES * Make linter happy * Reordering imports * Run FIPS unit tests on FIPS VM * Install Microsoft Go if FIPS=true * Debugging * Use fleet server FIPS VM image * Debugging: extracting microsoft/go outside of fleet-server folder * Explicitly specify Go distribution for tests * Use temporary folder for microsoft/go SDK * Don't pass GOEXPERIMENT=systemcrypto when running tests with Go stdlib * Remove debugging statements * Reduce VM size (cherry picked from commit c0ae099) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
…rtificate (#5088) (#5141) * Adding unit test for connecting to FIPS-incapable ES * Make linter happy * Reordering imports * Run FIPS unit tests on FIPS VM * Install Microsoft Go if FIPS=true * Debugging * Use fleet server FIPS VM image * Debugging: extracting microsoft/go outside of fleet-server folder * Explicitly specify Go distribution for tests * Use temporary folder for microsoft/go SDK * Don't pass GOEXPERIMENT=systemcrypto when running tests with Go stdlib * Remove debugging statements * Reduce VM size (cherry picked from commit c0ae099) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>






What is the problem this PR solves?
This PR ensures that any connections made by a FIPS-capable Fleet Server to Elasticsearch will only succeed if Elasticsearch is also FIPS-capable.
How does this PR solve the problem?
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 Fleet Server's connection to Elasticsearch will fail with a TLS error.
If not running in FIPS mode, the test asserts that Fleet Server's connection to Elasticsearch will succeed.
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:
Design Checklist
I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragmentsusing the changelog toolRelated issues