lookup

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContainerGroups

func GetContainerGroups(groups []string, containerMount string, override *Overrides) ([]uint32, error)

GetContainerGroups uses securejoin to get a list of numerical groupids from a container. Per the runc function it calls: If a group name cannot be found, an error will be returned. If a group id cannot be found, or the given group data is nil, the id will be returned as-is provided it is in the legal range.

func GetGroup

func GetGroup(containerMount, groupIDorName string) (*user.Group, error)

GetGroup takes a containermount path and a group name or ID and returns a match Group struct from /etc/group. If it cannot locate a group, an ErrNoGroupEntries error is returned. When the provided group name was an ID, a Group structure with Gid set is returned along with ErrNoGroupEntries.

func GetUser

func GetUser(containerMount, userIDorName string) (*user.User, error)

GetUser takes a containermount path and user name or ID and returns a matching User structure from /etc/passwd. If it cannot locate a user with the provided information, an ErrNoPasswdEntries is returned. When the provided user name was an ID, a User structure with Uid set is returned along with ErrNoPasswdEntries.

func GetUserGroupInfo

func GetUserGroupInfo(containerMount, containerUser string, override *Overrides) (*user.ExecUser, error)

GetUserGroupInfo takes string forms of the the container's mount path and the container user and returns a ExecUser with uid, gid, sgids, and home. And override can be provided for defaults.

Types

type Overrides

type Overrides struct {
	DefaultUser            *user.ExecUser
	ContainerEtcPasswdPath string
	ContainerEtcGroupPath  string
}

Overrides allows you to override defaults in GetUserGroupInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL