Prevent users to modify gatekeeper #225
Unanswered
lelouchviesp
asked this question in
Gatekeeper
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm new to OPA and Rego and I try to put in place a policy who prevent users to modify everything in gatekeeper-system namespace.
The context is that I want to give them cluster-admin role and use gatekeeper to manage what they can do or use. I have already template and constraint for quota storageclass and quota LB but I'm stuck on the security part of gatekeeper.
I try this template:
TEMPLATE YAML
listed variable list group that the user who do the request have
contains is a function who list what we pass in the first argument and try to find what we put in the second argument.
At the end the violation is triggered if we do not find a precise admin group in the list of group from the user who request something.
I apply the constraint only on gatekeeper namespace and for every action:
CONSTRAINT YAML
But this way, gatekeeper cannot do nothing too. User without admin group seems able to modify gatekeeper object and a weird side effect is that, for example, if I try a kubectl top node "a node" the action is prevent with the error message from the template who prevent user to touch gatekeeper but it's not a request about gatekeeper object.
It seems to work properly when during my test I use a constraint only on one k8s resources and without namespace like this:
But the final purpose would be to extent that at gatekeeper object while allowing him to do actions on himself.
Beta Was this translation helpful? Give feedback.
All reactions