Documentation ¶
Index ¶
- func AddNamespaceRangesUser(name string) (int, int, error)
- func CreateIDMappings(username, groupname string) ([]IDMap, []IDMap, error)
- func GetRootUIDGID(uidMap, gidMap []IDMap) (int, int, 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 username and uses the standard system utility to create a system user/group pair used to hold the /etc/sub{uid,gid} ranges which will be used for user namespace mapping ranges in containers.
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 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 ¶
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.