Documentation ¶
Index ¶
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 GetIDRange ¶
func GetIDRange(path string, uid uint32) (*specs.LinuxIDMapping, error)
GetIDRange determines UID/GID mappings based on configuration file provided in path.
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.