Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x](backport #5889) Add integration tests using a proxy with mTLS for control plane with Elastic Defend installed #5943

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Nov 5, 2024

What does this PR do?

Add integration tests for the Elastic Agent running Elastic Defend with a mTLS proxy
See #5716 for tje covered test cases

Why is it important?

To have automated tests covering mTLS and Elastic Defend

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • [ ] I have added an entry in ./changelog/fragments using the [changelog tool](https://github.com/elastic/elastic-agent#changelog)
  • I have added an integration test or an E2E test

Disruptive User Impact

  • N/A

How to test this PR locally

In short, manually reproduce the tests described on #5716.

The long version:

  • run 3 proxies:

    • mTLScli -> a proxy with mTLS to be passed as cli arguments
    • mTLSpolicy -> a proxy with mTLS configured through the policy
    • oneWayTLSpolicy -> a proxy with simple/one way TLS which defines its CA in the policy
    • all the certificates must be RSA because of an Elastic Defend restriction
  • set up the proxies:

    • add a test to testing/integration/endpoint_security_test.go to configure and run the needed proxies:
func TestDebugTestProxies(t *testing.T) {
	prepareProxies(t, &url.URL{Host: "a.wrong.fleet.host"}, "the.real.fleet.host")

	t.Logf("CTRL + C to exit")
	<-make(chan struct{})
}
  • run the test with:
go test -v -timeout 0 -tags integration -run TestDebugTestProxies ./testing/integration/

=== RUN   TestDebugTestProxies
    endpoint_security_test.go:1333: [mtlsCLI] certificates saved on: /tmp/TestDebugTestProxies-mtlsCLI2475114678
    endpoint_security_test.go:1333: [mtlsPolicy] certificates saved on: /tmp/TestDebugTestProxies-mtlsPolicy1317235685
    endpoint_security_test.go:1333: [oneWayTLSPolicy] certificates saved on: /tmp/TestDebugTestProxies-oneWayTLSPolicy327431283

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

This is an automatic backport of pull request #5889 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner November 5, 2024 16:35
@mergify mergify bot added the backport label Nov 5, 2024
@mergify mergify bot requested review from blakerouse and pkoutsovasilis and removed request for a team November 5, 2024 16:35
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Nov 5, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@pierrehilbert pierrehilbert requested review from AndersonQ and removed request for blakerouse and pkoutsovasilis November 5, 2024 17:08
@michalpristas
Copy link
Contributor

@AndersonQ test failure seems related right?

@AndersonQ
Copy link
Member

@AndersonQ test failure seems related right?

related to my changes? Yes, however if the request itself was wrong, I'd expect it fail for all tests, not just for 1. I'll have a look.

@AndersonQ AndersonQ force-pushed the mergify/bp/8.x/pr-5889 branch 3 times, most recently from 1d9013b to 031c6d4 Compare November 7, 2024 15:48
@AndersonQ AndersonQ force-pushed the mergify/bp/8.x/pr-5889 branch from 4be3917 to e5a5cca Compare November 7, 2024 16:30
@AndersonQ AndersonQ enabled auto-merge (squash) November 7, 2024 16:31
Copy link

@AndersonQ AndersonQ disabled auto-merge November 8, 2024 10:58
@AndersonQ AndersonQ merged commit 81196cc into 8.x Nov 8, 2024
14 checks passed
@AndersonQ AndersonQ deleted the mergify/bp/8.x/pr-5889 branch November 8, 2024 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants