-
Notifications
You must be signed in to change notification settings - Fork 259
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
Adding policy for Linux capabilities. #1683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments, I'll review more to digest the rego bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few comments. Also, we should address the rego code duplication...
@anmaxvl should we squash this now? |
if len(caps.Bounding) > 0 { | ||
out["bounding"] = caps.Bounding | ||
} else { | ||
out["bounding"] = make([]string, 0) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in all these cases, caps.Bounding
and co should be equivalent to make([]string, 0)
if len() == 0
.
Is there a reason why we need to make a new slice in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it can be nil which is still a 0 for size (thanks go!) but then we have to deal with nil and empty list down the road.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh, yeah .....
can you add a comment above L504 to the effect of // create new empty []string in case caps has nil array
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added this comment and squashed the branch.
This commit adds enforcement of policy over the capabilities provided to a process, either the init process of the container, or a process being executed inside a container (*i.e.* this affects the `EnforceCreateContainerPolicy` and `EnforceExecInContainerPolicy` enforcement points). Linux capabilities enumerate the things a process can do, and as such a malicious host could grant or deny specific capabilities to processes to create an unexpected and potentially compromised state for the container group. Users can now specify an exact list of capabilities for each of the five sets (bounding, effective, inheritable, permitted, and ambient). Users can also specify that they wish to enable *capabilities dropping*, whereby any extraneous capabilities which are granted by the host can be dropped down to a minimum set of needed capabilities. Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
And pick up defaults from runtime Signed-off-by: Sean T. Allen <seanallen@microsoft.com>
Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
hm. forgot that if you resolve the merge conflicts through github UI it does a merge. we should be fine though. I'll just squash merge. |
This commit adds enforcement of policy over the capabilities provided to a process, either the init process of the container, or a process being executed inside a container (*i.e.* this affects the `EnforceCreateContainerPolicy` and `EnforceExecInContainerPolicy` enforcement points). Linux capabilities enumerate the things a process can do, and as such a malicious host could grant or deny specific capabilities to processes to create an unexpected and potentially compromised state for the container group. Users can now specify an exact list of capabilities for each of the five sets (bounding, effective, inheritable, permitted, and ambient). Users can also specify that they wish to enable *capabilities dropping*, whereby any extraneous capabilities which are granted by the host can be dropped down to a minimum set of needed capabilities. Signed-off-by: Matthew A Johnson <matjoh@microsoft.com> Signed-off-by: Sean T. Allen <seanallen@microsoft.com>
This PR adds enforcement of policy over the capabilities provided to a process, either the init process of the container, or a process being executed inside a container (i.e. this affects the
EnforceCreateContainerPolicy
andEnforceExecInContainerPolicy
enforcement points). Linux capabilities enumerate the things a process can do, and as such a malicious host could grant or deny specific capabilities to processes to create an unexpected and potentially compromised state for the container group. Users can now specify an exact list of capabilities for each of the five sets (bounding, effective, inheritable, permitted, and ambient).Users can also specify that they wish to enable capabilities dropping, whereby any extraneous capabilities which are granted by the host can be dropped down to a minimum set of needed capabilities.