-
Notifications
You must be signed in to change notification settings - Fork 557
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
Add ambient and bounding capability support #675
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,8 +44,8 @@ type Process struct { | |
// Cwd is the current working directory for the process and must be | ||
// relative to the container's root. | ||
Cwd string `json:"cwd"` | ||
// Capabilities are Linux capabilities that are kept for the container. | ||
Capabilities []string `json:"capabilities,omitempty" platform:"linux"` | ||
// Capabilities are Linux capabilities that are kept for the process. | ||
Capabilities *LinuxCapabilities `json:"capabilities,omitempty" platform:"linux"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jlbutler just removed the Linux-specific-ness of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No other systems have capabilities; there was a withdrawn Posix draft that the Linux implementation was based on, and then customised for Linux. They should have remained Linux specific. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
capabilies(7) references this for the withdrawn POSIX.1e draft, and that has:
I don't have access to Solaris or Irix for testing, or enough interest in them to find relevant docs, but I'd caution against making this Linux-specific (again) without consulting someone with Solaris access. On the other hand, maybe the policy is “unless you document your valid values, we may drop support for this property on your system”, and I'd be +1 for that, giving the Solaris folks some reasonable period to provide the valid-values docs, and then dropping Solaris capability support if they don't. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But here we are adding the Linux specific types such as ambient. Solaris capabilities are a bit similar by the look of it (they have E, I, P but different capabilities) but that doesn't mean they should be at the top level. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solaris docs are http://docs.oracle.com/cd/E23824_01/html/821-1456/prbac-2.html There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Is that “I don't think there is enough overlap to be worth sharing the same namespace”? If the Solaris folks are ok using On the other hand, if Windows has nothing equivalent, the pro-namespacing policy here suggests namespacing the whole |
||
// Rlimits specifies rlimit options to apply to the process. | ||
Rlimits []LinuxRlimit `json:"rlimits,omitempty" platform:"linux"` | ||
// NoNewPrivileges controls whether additional privileges could be gained by processes in the container. | ||
|
@@ -56,6 +56,21 @@ type Process struct { | |
SelinuxLabel string `json:"selinuxLabel,omitempty" platform:"linux"` | ||
} | ||
|
||
// LinuxCapabilities specifies the whitelist of capabilities that are kept for a process. | ||
// http://man7.org/linux/man-pages/man7/capabilities.7.html | ||
type LinuxCapabilities struct { | ||
// Bounding is the set of capabilities checked by the kernel. | ||
Bounding []string `json:"bounding,omitempty" platform:"linux"` | ||
// Effective is the set of capabilities checked by the kernel. | ||
Effective []string `json:"effective,omitempty" platform:"linux"` | ||
// Inheritable is the capabilities preserved across execve. | ||
Inheritable []string `json:"inheritable,omitempty" platform:"linux"` | ||
// Permitted is the limiting superset for effective capabilities. | ||
Permitted []string `json:"permitted,omitempty" platform:"linux"` | ||
// Ambient is the ambient set of capabilities that are kept. | ||
Ambient []string `json:"ambient,omitempty" platform:"linux"` | ||
} | ||
|
||
// Box specifies dimensions of a rectangle. Used for specifying the size of a console. | ||
type Box struct { | ||
// Height is the vertical dimension of a box. | ||
|
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.
the example should have
CAP_NET_BIND_SERVICE
in the bounding set or it cannot be applied as an ambient capability.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.
CAP_NET_BIND_SERVICE
also needs to be added to permitted/inherited.From capabilities(7)
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.
@mrunalp does that mean we should or should not have it in bounding?
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.
@crosbymichael We should have it in bounding, permitted and inheritable.