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

Allow project admins to create/edit/delete NetworkPolicies #14830

Merged
merged 1 commit into from
Jun 29, 2017

Conversation

danwinship
Copy link
Contributor

This is how it's supposed to work.

Some customers have argued that they don't actually want this behavior, but as far as we've been able to tell, that has always been based on the mistaken belief that this would allow project admins to give themselves access to other projects. But anyway, we can adjust the permissions for 3.7 if really necessary. This is definitely the right default behavior for 3.6.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1461208
https://trello.com/c/CBQ3Rc00

@knobunc

Copy link
Contributor

@knobunc knobunc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@knobunc
Copy link
Contributor

knobunc commented Jun 27, 2017

@openshift/networking PTAL

@liggitt I assume this is ok by you?

@liggitt
Copy link
Contributor

liggitt commented Jun 27, 2017

What facility allows cluster admins to lock down network access to/from a namespace?

@danwinship
Copy link
Contributor Author

You mean "as a cluster admin, I want to be able to block two projects from communicating, even when both of those projects want to communicate with each other"? This PR does not allow for that. Do we need to?

(If you just meant "can cluster admins prevent project admins from creating policies allowing themselves to access particular other namespaces?" then that's the misunderstanding about NetworkPolicy I mentioned above. NetworkPolicy doesn't work that way. You can only allow other people to connect to your namespace, not allow yourself to connect to other people's namespaces.)

@eparis
Copy link
Member

eparis commented Jun 27, 2017

[test]

@openshift openshift deleted a comment from openshift-bot Jun 28, 2017
@openshift openshift deleted a comment from openshift-bot Jun 28, 2017
@danwinship
Copy link
Contributor Author

transient networking problem ("Docker registry lookup failed"). [test]

@danwinship
Copy link
Contributor Author

flake #14043 [test]

@knobunc
Copy link
Contributor

knobunc commented Jun 28, 2017

[test] Last was flake #14897 logs

@deads2k
Copy link
Contributor

deads2k commented Jun 28, 2017

But anyway, we can adjust the permissions for 3.7 if really necessary. This is definitely the right default behavior for 3.6.

You can't actually. We never auto-tighten and tightening by hand is generally scary for people.

@deads2k
Copy link
Contributor

deads2k commented Jun 28, 2017

So a few things about this need be very clear in our docs:

  1. this API could be removed as early as 3.8 since networkpolicies is moving
  2. you cannot label your namespaces, so you can't use this to select particular namespaces
  3. If we do allow users to label their namespaces, then it becomes easy to search for likely matches when attacking another namespace
  4. When choosing a namespace label selector, you probably need it to be a UID or something

@smarterclayton This will significantly complicate any, "let users label their namespaces" feature in the future. Are we going to give up on the self-labeling feature (which makes this resource far less useful), lock down the allowed label selectors for networkpolicies (which has compatibility problems), or something else?

@danwinship
Copy link
Contributor Author

Hrmph. Where were you when I was trying to convince everyone of all that upstream a few months ago.

I'm assuming that eventually upstream will add a new selector to NetworkPolicy to allow you to select namespaces by name (or else require that all namespaces have certain well-known labels with values that can't be modified by users). Until then, yes, NetworkPolicy NamespaceSelectors are either useless or insecure, depending on how other things are configured.

But anyway, that's not really relevant to this PR: we're already shipping NetworkPolicy (as Tech Preview), people are already using it, and there are use cases for it even without using NamespaceSelectors. (And there are even scenarios where project admins can write NetworkPolicies using NamespaceSelectors, if the cluster admins modify the default project template to automatically add a "name" label to every namespace).

So, anyway, this PR makes it so that project admins can create/edit their own NetworkPolicies. Is anyone objecting to merging this?

@deads2k
Copy link
Contributor

deads2k commented Jun 28, 2017

Hrmph. Where were you when I was trying to convince everyone of all that upstream a few months ago.

I remember bringing it up in a sig-auth call quite some time ago and suggesting a specific whitelist of namespace names to avoid accidents and increase clarity for the simplest cases. It would also have eliminated the labelling need problem. Doing that would have effectively discouraged label selection except by cluster-admins which I think would work well.

So, anyway, this PR makes it so that project admins can create/edit their own NetworkPolicies. Is anyone objecting to merging this?

I'm currently against because I'm concerned about unexpected interactions with work on a feature to allow for namespace labelling by users. If we flesh one or other other out more completely, perhaps we can come up with a set of rules that will work properly. Throwing out the first idea that pops into my head, admission plugin (so that we can enforce on any cluster with webhook admission) that only allows namespace labels under a particular namespace. You get most of the power you want today and we don't get excessively boxed in for namespace labels later.

@danwinship danwinship changed the title Allow project admins to create/edit/delete NetworkPolicies Allow project admins to create/edit/delete NetworkPolicies [DO NOT MERGE] Jun 28, 2017
@smarterclayton
Copy link
Contributor

smarterclayton commented Jun 28, 2017 via email

@smarterclayton
Copy link
Contributor

smarterclayton commented Jun 28, 2017 via email

@deads2k
Copy link
Contributor

deads2k commented Jun 29, 2017

Alright, ret[test] (others touched this file) and [merge].

@deads2k
Copy link
Contributor

deads2k commented Jun 29, 2017

So a few things about this need be very clear in our docs:

  1. this API could be removed as early as 3.8 since networkpolicies is moving
  2. you cannot label your namespaces, so you can't use this to select particular namespaces
  3. If we do allow users to label their namespaces, then it becomes easy to search for likely matches when attacking another namespace

These should still be documented. This could easily become pretend protection in an update that allows labeling and online dedicated admins in particular may care.

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 292931f

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 292931f

@adelton
Copy link
Contributor

adelton commented Jun 29, 2017

@danwinship, should this PR get merged? The title (still) contains [DO NOT MERGE] so it's confusing ...

@deads2k deads2k changed the title Allow project admins to create/edit/delete NetworkPolicies [DO NOT MERGE] Allow project admins to create/edit/delete NetworkPolicies Jun 29, 2017
@deads2k
Copy link
Contributor

deads2k commented Jun 29, 2017

@danwinship, should this PR get merged? The title (still) contains [DO NOT MERGE] so it's confusing ...

He added it when I wanted the hold (very polite). I've updated it now.

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/2808/) (Base Commit: 91c5480) (PR Branch Commit: 292931f)

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge FAILURE (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/1173/) (Base Commit: 91c5480) (PR Branch Commit: 292931f)

@deads2k
Copy link
Contributor

deads2k commented Jun 29, 2017

green test on recent head with no other permission changes at the top of the queue or in master after base.

@deads2k deads2k merged commit 73cdfc3 into openshift:master Jun 29, 2017
@danwinship danwinship deleted the networkpolicy-roles branch October 19, 2017 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants