-
Notifications
You must be signed in to change notification settings - Fork 208
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
Adds a test case for L7 policy with TLS #1406
Conversation
cc @jrajahalme (i have no permissions to add you as a reviewer here) |
@meyskens looks like you have some linter issues to fix up before tests will pass. |
fa26abf
to
12024c1
Compare
Noticed, cleaned up the small mistake and added the proper gate to the 2nd TLS test :) |
Multicluster test failed (don't think this is releated to this PR):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few parts I am not sure of are in here: like the location of the cabundle in the project so feedback is welcome
Storing it in connectivity/check/assets
LGTM.
Some spelling nits inline, but feel free to ignore in case there are no other change requests.
Out of curiosity: how would a successful test run for these tests look? It seems like they are currently skipped on all CI workflows. So I guess we'd need to extend the cilium
ClusterRole in order to be able to test these?
@tklauser yes indeed, the helmchart has an option to set the secrets in the RBAC with a flag which we can set to run these in the CI. I discussed with @aanm yesterday to add this install option in this repo also to run them, but it seemed L7 wasn't even enabled in some test scenarios so we were unsure. When this is merged a follow up should be made in cilium/cilium to enable the tests there in a CI run. |
22f282f
to
0a173b3
Compare
install command needed to make them run |
1ffcbd6
to
71ec07a
Compare
EKS test seems to fail due to too many clusters |
71ec07a
to
ac5a4b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice work! I'd like to see the curl client verify the certificate to guard against possible bugs. We currently do not support proxy choosing a certificate based on the SNI, but we could in future. Or even simpler, Cilium agent could have a bug and pass a wrong cert to the proxy.
connectivity/tests/world.go
Outdated
// PodToWorldWithTLSIntercept sends an HTTPS request to one.one.one.one (default value of ExternalTarget) from from random client | ||
func PodToWorldWithTLSIntercept(curlOpts ...string) check.Scenario { | ||
s := &podToWorldWithTLSIntercept{ | ||
curlOpts: []string{"-k"}, // skip TLS verification as it will be our internal cert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping the certificate verification could hide bugs in our secret/policy handling, maybe? It is a bit more work to pass the cacert to curl, but I think it would be worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the ability to via a command inject the ca cert into the pod. It is not the best way IMO however we cannot restart the pod or change it's spec to load a secret as the design assumes it to be there "forever".
Any suggestions to improve the way it does this very welcome!
ct.NewTest("client-egress-l7-tls-deny-without-headers"). | ||
WithFeatureRequirements(check.RequireFeatureEnabled(check.FeatureL7Proxy)). | ||
WithFeatureRequirements(check.RequireFeatureEnabled(check.FeatureSecretBackendK8s)). | ||
WithCABundleSecret(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the CA bundle Secret be created automatically when needed by WithCertificate()
or WithSecret()
? As such it does not take any input and feels like unnecessary boilerplate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CA Bundle here refer to the public CA store and isn't really related to a certificate being created or not.
That is why i made the initial decision not to do that. Happy to change that if you want.
I tested this locally, and the first invocation failed:
Unfortunatly I did not have hubble enabled, so did not see the flows. I was not able to reproduce this, after enabling hubble it worked as expected, also after uninstall/install. I tried it like this:
|
ac5a4b6
to
12a57b9
Compare
Commit 583f9c6 does not contain "Signed-off-by". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
583f9c6
to
76feee7
Compare
https://github.com/cilium/cilium-cli/actions/runs/4293305139/jobs/7480818048#step:11:4833 This is quite interesting the test seems to flake... not entirely sure why, do no merge until this is fixed |
Not sure if this was caused by a flake in the test or an issue in the flow matching? |
76feee7
to
8a5366d
Compare
This adds a test to check if HTTPS traffic can get inspected in a CNP. To enable this it adds new helper functions to provision secrets, certificates and a public CA bundle into the test setup. It also adds the functionality to insert a file into a pod, this is done for having the certificate chain checked in curl. Signed-off-by: Maartje Eyskens <[email protected]>
This enables the Envoy l7 proxy backend in the test setups as well as the tls secrets backend to be k8s. This allows the L7 ans TLS connectivity tests to run. Signed-off-by: Maartje Eyskens <[email protected]>
8a5366d
to
a92cf38
Compare
This adds a test to check if HTTPS traffic can get inspected in a CNP. To enable this it adds new helper functions to provision secrets, certificates and a public CA bundle into the test setup.
It implements part of the work described in cilium/cilium#23784 (but not all, see comment in issue).
A few parts I am not sure of are in here: like the location of the cabundle in the project so feedback is welcome