Documentation ¶
Index ¶
- Constants
- func FindFake() (string, error)
- func GetFakeArgs() []string
- func GetFakeBinds(fakerootPath string) ([]string, error)
- func GetIDRange(path string, uid uint32) (*specs.LinuxIDMapping, error)
- func IsUIDMapped(uid uint32) bool
- func UnshareRootMapped(args []string, includeMountNamespace bool) error
- type Config
- type Entry
- type GetUserFn
Constants ¶
const ( // SubUIDFile is the default path to the subuid file. SubUIDFile = "/etc/subuid" // SubGIDFile is the default path to the subgid file. SubGIDFile = "/etc/subgid" )
Variables ¶
This section is empty.
Functions ¶
func FindFake ¶ added in v1.1.0
Look for fakeroot-sysv first and then fakeroot, since fakeroot-sysv is much faster than fakeroot-tcp.
func GetFakeArgs ¶ added in v1.1.0
func GetFakeArgs() []string
Get the args needed to execute the fakeroot mapped into the container
func GetFakeBinds ¶ added in v1.1.0
Get the binds needed to map the fakeroot command into the container The incoming parameter is the path to fakeroot
func GetIDRange ¶
GetIDRange determines UID/GID mappings based on configuration file provided in path.
func IsUIDMapped ¶ added in v1.1.0
IsUIDMapped returns true if the given uid is mapped in SubUIDFile and otherwise it returns false
func UnshareRootMapped ¶ added in v1.1.0
re-exec the command effectively under unshare -r or unshare -rm
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds all entries found in the corresponding configuration file and manages its configuration.
func GetConfig ¶
GetConfig parses a subuid/subgid configuration file and returns a Config holding all mapping entries, it allows to pass a custom function getUserFn used to lookup in a custom user database, if there is no custom function, the default one is used.
func (*Config) AddUser ¶
AddUser adds a user mapping entry, it will automatically find the first available range. It doesn't return any error if the user is already present and ignores the operation.
func (*Config) Close ¶
Close closes the configuration file handle, if there is any pending updates and the configuration was opened for writing, all entries are written before into the configuration file before closing it.
func (*Config) DisableUser ¶
DisableUser disables a user entry mapping entry. It returns an error if there is no entry for the user but will ignore the operation if the user entry is already disabled.
func (*Config) EnableUser ¶
EnableUser enables a previously disabled user mapping entry. It returns an error if there is no entry for the user but will ignore the operation if the user entry is already enabled.
func (*Config) GetUserEntry ¶
GetUserEntry returns a user entry associated to a user and returns an error if there is no entry for this user.
func (*Config) RemoveUser ¶
RemoveUser removes a user mapping entry. It returns an error if there is no entry for the user.