Documentation ¶
Index ¶
- func AddNamespaceRangesUser(name string) (int, int, error)
- func CanAccess(path string, uid, gid int) bool
- func CreateIDMappings(username, groupname string) ([]IDMap, []IDMap, error)
- func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, error)
- func LookupGID(gid int) (user.Group, error)
- func LookupGroup(groupname string) (user.Group, error)
- func LookupUID(uid int) (user.User, error)
- func LookupUser(username string) (user.User, error)
- func MkdirAllAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func MkdirAllNewAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func MkdirAs(path string, mode os.FileMode, ownerUID, ownerGID int) error
- func ToContainer(hostID int, idMap []IDMap) (int, error)
- func ToHost(contID int, idMap []IDMap) (int, error)
- type IDMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNamespaceRangesUser ¶
AddNamespaceRangesUser takes a name and finds an unused uid, gid pair and calls the appropriate helper function to add the group and then the user to the group in /etc/group and /etc/passwd respectively.
func CanAccess ¶ added in v1.13.0
CanAccess takes a valid (existing) directory and a uid, gid pair and determines if that uid, gid pair has access (execute bit) to the directory
func CreateIDMappings ¶
CreateIDMappings takes a requested user and group name and using the data from /etc/sub{uid,gid} ranges, creates the proper uid and gid remapping ranges for that user/group pair
func GetRootUIDGID ¶
GetRootUIDGID retrieves the remapped root uid/gid pair from the set of maps. If the maps are empty, then the root uid/gid will default to "real" 0/0
func LookupGID ¶ added in v1.13.0
LookupGID uses traditional local system files lookup (from libcontainer/user) on a group ID, followed by a call to `getent` for supporting host configured non-files passwd and group dbs
func LookupGroup ¶ added in v1.13.0
LookupGroup uses traditional local system files lookup (from libcontainer/user) on a group name, followed by a call to `getent` for supporting host configured non-files passwd and group dbs
func LookupUID ¶ added in v1.13.0
LookupUID uses traditional local system files lookup (from libcontainer/user) on a uid, followed by a call to `getent` for supporting host configured non-files passwd and group dbs
func LookupUser ¶ added in v1.13.0
LookupUser uses traditional local system files lookup (from libcontainer/user) on a username, followed by a call to `getent` for supporting host configured non-files passwd and group dbs
func MkdirAllAs ¶
MkdirAllAs creates a directory (include any along the path) and then modifies ownership to the requested uid/gid. If the directory already exists, this function will still change ownership to the requested uid/gid pair.
func MkdirAllNewAs ¶ added in v1.10.0
MkdirAllNewAs creates a directory (include any along the path) and then modifies ownership ONLY of newly created directories to the requested uid/gid. If the directories along the path exist, no change of ownership will be performed
func MkdirAs ¶
MkdirAs creates a directory and then modifies ownership to the requested uid/gid. If the directory already exists, this function still changes ownership
func ToContainer ¶
ToContainer takes an id mapping, and uses it to translate a host ID to the remapped ID. If no map is provided, then the translation assumes a 1-to-1 mapping and returns the passed in id
Types ¶
type IDMap ¶
type IDMap struct { ContainerID int `json:"container_id"` HostID int `json:"host_id"` Size int `json:"size"` }
IDMap contains a single entry for user namespace range remapping. An array of IDMap entries represents the structure that will be provided to the Linux kernel for creating a user namespace.