Documentation
¶
Overview ¶
Package capability names the Linux capabilities and parses a capability bounding set as the capability_bounding_set keyword writes it, after the CapabilityBoundingSet of systemd: the capabilities the command keeps, all others dropped, or, the list prefixed with ~, the capabilities it drops.
Index ¶
Constants ¶
const All = "ALL"
All is the name standing for every capability, as the engines take it in --cap-add and --cap-drop.
Variables ¶
This section is empty.
Functions ¶
func Canonical ¶
Canonical returns the capability named s, in any case, with or without its CAP_ prefix, as the engines name it in --cap-add and --cap-drop: in upper case, without the prefix, as NET_BIND_SERVICE, or All. A name of no capability is an error.
func CanonicalList ¶
CanonicalList returns the capabilities of the whitespace separated list s as Canonical names them, each once, in the order they are first named. A name of no capability is an error.
func Name ¶
Name returns the name of the capability of number n, or "cap_<n>" for a number this package does not name, as one of a kernel newer than it.
func Number ¶
Number returns the number of the capability named s, in any case, and false when s names none.
func ValidateList ¶
ValidateList says whether s is a list of capabilities, for the keywords taking one: a name of no capability, as a typo or a comma separated list, is refused.
Types ¶
type BoundingSet ¶
type BoundingSet struct {
// Drop says the listed capabilities are the ones dropped, all others
// kept: the list was prefixed with ~.
Drop bool
// Caps are the numbers of the listed capabilities, sorted.
Caps []int
}
BoundingSet is a capability bounding set: the capabilities it lists, and whether they are the ones kept or the ones dropped.
func ParseBoundingSet ¶
func ParseBoundingSet(s string) (BoundingSet, error)
ParseBoundingSet parses s, a list of capability names separated by spaces, optionally prefixed with ~. A name it does not know is an error, so a typo does not leave the command with a capability its configuration meant to drop. An empty s is the empty set kept: every capability is dropped.
func (BoundingSet) Keeps ¶
func (t BoundingSet) Keeps(n int) bool
Keeps says whether the bounding set keeps the capability of number n.
func (BoundingSet) String ¶
func (t BoundingSet) String() string
String returns the bounding set as ParseBoundingSet parses it back, the names in upper case and in number order.