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

policy: Enforce ingress policy for Ingress #351

Merged
merged 3 commits into from Sep 27, 2023
Merged

Conversation

jrajahalme
Copy link
Member

@jrajahalme jrajahalme commented Sep 12, 2023

Store the original source identity for enforcing ingress policy for Ingress, that otherwise only enforces the egress policy, as it operates on the egress path. Now both ingress and egress policies defined for the ingress identity are enforced when configured with the new enforce_policy_on_l7lb option.

Ingress arrives to Cilium nodes at node ports, which are meaningless for Cilium Network Policies. To remedy this the destination port of the selected backend is used also in ingress path policy enforcement. Note that this destination port may be different from the one the traffic was first received at the external load balancer.

An allow-all Egress policy at Ingress continues to be supported until Cilium 1.14 is EOL. Newer Cilium versions properly generate an allow-all ingress and egress network policy for the Ingress identity also when policy is not enforced.

See cilium/cilium#28126 for reference on how this is used.

@jrajahalme jrajahalme marked this pull request as draft September 12, 2023 19:01
@jrajahalme jrajahalme force-pushed the ingress-endpoint-policy branch 4 times, most recently from 5c8c12c to 412c5b9 Compare September 13, 2023 13:22
@jrajahalme jrajahalme marked this pull request as ready for review September 13, 2023 13:24
@jrajahalme jrajahalme force-pushed the ingress-endpoint-policy branch 5 times, most recently from fb8bfea to f212570 Compare September 15, 2023 13:08
Envoy can assert fail if local close reason is not set:

  envoy bug failure: !local_close_reason.empty(). Details: Local Close Reason was not set!

Set error detail on local close to prevent this.

Also Flush on proxylib close so that any remaining data is not cut off.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Add enforce_policy_on_l7_lb to bpf_metadata config to maintain backwards
compatibility by explicitly turning on policy enforcement on Ingress to
support older Cilium releases on the same Envoy build.

Store the original source identity for enforcing ingress policy for
Ingress, that otherwise only enforces the egress policy, as it operates
on the egress path. Now both ingress and egress policies for the ingress
identity are enforced when enforce_policy_on_l7_lb is configured as
'true'.

Ingress arrives to Cilium nodes at node ports, which are meaningless for
Cilium Network Policies. To remedy this the destination port of the
selected backend is used also in ingress path policy enforcement. Note
that this destination port may be different from the one the traffic was
first received at the external load balancer.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>

info: patch template saved to `-`
Refactor Config::getMetadata() processing of L7 LB config to be more
explicit and to error out on invalid config so that invalid traffic does
not accidentally slip through.

Adjust tests accordingly and add new tests to cover the new
'enforce_policy_on_l7lb' option.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme jrajahalme added this pull request to the merge queue Sep 27, 2023
Merged via the queue into main with commit ee919e1 Sep 27, 2023
4 checks passed
@sayboras sayboras deleted the ingress-endpoint-policy branch November 27, 2023 03:47
@sayboras sayboras added the needs-backport/1.26 Needs backport for v1.26 branch label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-backport/1.26 Needs backport for v1.26 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants