Documentation ¶
Index ¶
- Constants
- Variables
- func Normalize(capabilities []string) ([]string, []string)
- func RemoveDuplicated(caps []string) []string
- func Split(caps string) ([]string, []string)
- type Caplist
- type Config
- func (c *Config) AddGroupCaps(group string, caps []string) error
- func (c *Config) AddUserCaps(user string, caps []string) error
- func (c *Config) CheckGroupCaps(group string, caps []string) (authorized []string, unauthorized []string)
- func (c *Config) CheckUserCaps(user string, caps []string) (authorized []string, unauthorized []string)
- func (c *Config) DropGroupCaps(group string, caps []string) error
- func (c *Config) DropUserCaps(user string, caps []string) error
- func (c *Config) ListAllCaps() (Caplist, Caplist)
- func (c *Config) ListGroupCaps(group string) []string
- func (c *Config) ListUserCaps(user string) []string
- func (c *Config) WriteTo(w io.Writer) (int64, error)
Constants ¶
const ( // Permitted capability string constant. Permitted string = "permitted" // Effective capability string constant. Effective = "effective" // Inheritable capability string constant. Inheritable = "inheritable" // Ambient capability string constant. Ambient = "ambient" // Bounding capability string constant. Bounding = "bounding" )
Variables ¶
var Map = map[string]*capability{
"CAP_CHOWN": capChown,
"CAP_DAC_OVERRIDE": capDacOverride,
"CAP_DAC_READ_SEARCH": capDacReadSearch,
"CAP_FOWNER": capFowner,
"CAP_FSETID": capFsetid,
"CAP_KILL": capKill,
"CAP_SETGID": capSetgid,
"CAP_SETUID": capSetuid,
"CAP_SETPCAP": capSetpcap,
"CAP_LINUX_IMMUTABLE": capLinuxImmutable,
"CAP_NET_BIND_SERVICE": capNetBindService,
"CAP_NET_BROADCAST": capNetBroadcast,
"CAP_NET_ADMIN": capNetAdmin,
"CAP_NET_RAW": capNetRaw,
"CAP_IPC_LOCK": capIpcLock,
"CAP_IPC_OWNER": capIpcOwner,
"CAP_SYS_MODULE": capSysModule,
"CAP_SYS_RAWIO": capSysRawio,
"CAP_SYS_CHROOT": capSysChroot,
"CAP_SYS_PTRACE": capSysPtrace,
"CAP_SYS_PACCT": capSysPacct,
"CAP_SYS_ADMIN": capSysAdmin,
"CAP_SYS_BOOT": capSysBoot,
"CAP_SYS_NICE": capSysNice,
"CAP_SYS_RESOURCE": capSysResource,
"CAP_SYS_TIME": capSysTime,
"CAP_SYS_TTY_CONFIG": capSysTtyConfig,
"CAP_MKNOD": capMknod,
"CAP_LEASE": capLease,
"CAP_AUDIT_WRITE": capAuditWrite,
"CAP_AUDIT_CONTROL": capAuditControl,
"CAP_SETFCAP": capSetfcap,
"CAP_MAC_OVERRIDE": capMacOverride,
"CAP_MAC_ADMIN": capMacAdmin,
"CAP_SYSLOG": capSyslog,
"CAP_WAKE_ALARM": capWakeAlarm,
"CAP_BLOCK_SUSPEND": capBlockSuspend,
"CAP_AUDIT_READ": capAuditRead,
}
Map maps each capability name to a struct with details about the capability.
Functions ¶
func Normalize ¶
Normalize takes a slice of capabilities, normalizes and unwraps CAP_ALL. The return values are a two slices: normalized capabilities slice that are valid and a slice with unrecognized capabilities.
func RemoveDuplicated ¶
RemoveDuplicated removes duplicated capabilities from provided list. It does not make copy of a passed list.
Types ¶
type Config ¶
type Config struct { Users Caplist `json:"users,omitempty"` Groups Caplist `json:"groups,omitempty"` }
Config is the in memory representation of the user/group capability authorizations as set by an admin
func ReadFrom ¶
ReadFrom reads a capability configuration from an io.Reader and returns a capability config with the set of authorized user/group capabilities
func (*Config) AddGroupCaps ¶
AddGroupCaps adds an authorized capability set to group
func (*Config) AddUserCaps ¶
AddUserCaps adds an authorized capability set to user
func (*Config) CheckGroupCaps ¶
func (c *Config) CheckGroupCaps(group string, caps []string) (authorized []string, unauthorized []string)
CheckGroupCaps checks if provided capability list for group are whether or not authorized by returning two lists, the first one containing authorized capabilities and the second one containing unauthorized capabilities
func (*Config) CheckUserCaps ¶
func (c *Config) CheckUserCaps(user string, caps []string) (authorized []string, unauthorized []string)
CheckUserCaps checks if provided capability list for user are whether or not authorized by returning two lists, the first one containing authorized capabilities and the second one containing unauthorized capabilities
func (*Config) DropGroupCaps ¶
DropGroupCaps drops a set of capabilities for group
func (*Config) DropUserCaps ¶
DropUserCaps drops a set of capabilities for user
func (*Config) ListAllCaps ¶
ListAllCaps returns capability list for both authorized users and groups
func (*Config) ListGroupCaps ¶
ListGroupCaps returns a capability list authorized for group
func (*Config) ListUserCaps ¶
ListUserCaps returns a capability list authorized for user