-
Notifications
You must be signed in to change notification settings - Fork 34
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
[BUG] AdminNetworkPolicy Core can't express allow/deny all #248
Comments
Right I acknowledge this issue its something that sets apart ANP from NetPol
All in all this explicit requirement in the API AFAIK was intentionally done, without expressing what you want to deny all to we didn't want the denyAll to be an assumption of implicit things Like I think its by design and not a bug per say. Let's see what others thing in our next meeting |
I do think that not being able to express "deny all", in particular, is a significant limitation that prevents the admin from imposing "guard rails" around the cluster. I can live with "deny all" requiring something (for example a CIDR) to be specified given that it was done for extensibility reasons. It's a very common pattern amongst our tiered policy users to use the "admin" tiers for something like this:
I'm not sure that everyone in the group has internalised this limitation. For example, the docs for
Admittedly, that is an egress-only feature, where CIDRs are available (as an extension). |
One potential "fix" for this would be to have a field in the Peer that is explicitly for matching all:
Then we have a specific non-zero field to mean "match all". |
From @danwinship : let's not use a |
one question I have is denyAll would mean what? Would it mean same as "0.0.0.0/0" or is there more to it? from use case perspective |
I think ANP is entirely focused on L3/4 and only IP protocols, so, with that caveat, I think it means "all IP traffic" which is pretty much the same as 0.0.0.0/0 and ::/0. How you do that match is implementation dependent though, in iptables, you'd say
Rather than needing to say
Note that, at least in Calico's implementation, we always allow "necessary" ICMP traffic for IPv6 bootstrap (and we don't use L2), so, I suppose our interpretation is "all user traffic". |
Right, this is what I was getting at with maybe not just using a bool. Things "deny all" might mean:
1 and 2 change over time (and between clusters). 3 and 4 have the problem that they may not deny everything that the admin wants to deny. 5 and 6 have the problem that they deny traffic that ANP itself does not currently have the ability to re-allow. So we can pick one of these and say "that's what 'match all' means", but I feel like there are possibly use cases for both 3/4 and 5/6... |
If we have an enum for this, we could also specify that some of these well-known options MUST be supported by all implementations, and others may be optional but if implemented should conform to expected behavior. |
oh I was thinking "not a boolean" as in a struct. like
vs
(but I didn't really think about this deeply) struct is much more future-proof though... |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale
Thinking about this some more, this is wrong: if we have any sort of So maybe we should just implement 6: "all" means "all L2 or L3 traffic that isn't required to make other allowed traffic work". (We would need to be very specific about what that means, and whether there's any implementation-defined behavior in there.) I still think the struct version is better than the boolean version. Among other things, if we use a boolean, then you can say: egress:
- action: Deny
to:
- all: false which is silly. Better to have: egress:
- action: Deny
to:
- all: {} and then we can potentially extend it later |
Various use cases of ANP require a "deny all" following a set of Pass/Allow rules but it looks like that's hard to express in the current structure. We require at least one ANPXXXPeer in a rule and then a peer can't be empty. I think "deny all" requires the Networks extension to be present so that you can write
0.0.0.0/0
and::/0
into the list of CIDRsI suppose this is a consequence of the requirement to fail closed if the policy is "empty" but it struck me as awkward to need to think of something to put in a Peer when I want to create a "blanket" rule. (It'd be easy to forget the IPv6 CIDR, for example, resulting in only blocking IPv4 traffic.)
The text was updated successfully, but these errors were encountered: