-
Notifications
You must be signed in to change notification settings - Fork 469
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
GA network policy does not reject if there is not a single source pod matching a policy #85
Comments
Thanks for the very detailed bug report! We're looking into it now. |
I'm also seeing behavior where networkpolicy does not get enforced until a pod that matches ingress whitelist rules is created/labeled. It seems that perhaps this is the root issue, policy enforcement depends on a whitelist match resource existing first. Here's a script that expects the networkpolicy manifest @lorenz posted, tests various scenarios, shows errors when expected behavior is not seen, and logs iptables and ipset between each test stage: https://gist.github.com/bzub/7d7f3f1704b2b7e04819c4b5232de8fb#file-np-test-sh I've put the output of one run here: https://gist.github.com/bzub/7d7f3f1704b2b7e04819c4b5232de8fb#file-00-results-output-txt and the detailed iptables/ipset logs are attached to this ticket here: |
… matching a policy Fix ensures below two cases are explicitly handled - in the network policy spec for the ingress rule, its optionsl to give 'ports' and 'from' details when not specified it translates to match all ports, match all sources respectivley - user may explicitly give the 'ports' and 'from' details in the ingress rule. But at any given point its possible there is no matching pods (with labels defined in 'from') in the namespace. Before the fix both the cases were handled similarly resulting in unexpected behaviour Fixes #85
Confirmed working with the mentioned merge, thanks! |
Thanks @lorenz for confirming. |
Version: c85e02a (current master)
How to reproduce:
np-test: protected
np-test: allowed
which which can successfully access the servernp-test: allowed
podIn iptables it seems like the issue is that on the network policy chain the source filter is dropped when there are no sources which fails open and not closed.
The text was updated successfully, but these errors were encountered: