Documentation
¶
Overview ¶
Code generated by "idlimitsgenerator"; DO NOT EDIT.
Package users support all common action on the system for user handling.
Index ¶
- Variables
- type Config
- type IDGenerator
- type IDGeneratorIface
- type IDGeneratorMock
- type IDOwner
- type Manager
- func (m *Manager) AllGroups() ([]types.GroupEntry, error)
- func (m *Manager) AllShadows() ([]types.ShadowEntry, error)
- func (m *Manager) AllUsers() ([]types.UserEntry, error)
- func (m *Manager) BrokerForUser(username string) (string, error)
- func (m *Manager) GroupByID(gid uint32) (types.GroupEntry, error)
- func (m *Manager) GroupByName(groupname string) (types.GroupEntry, error)
- func (m *Manager) IsUserLocked(username string) (bool, error)
- func (m *Manager) LockUser(username string) error
- func (m *Manager) RegisterUserPreAuth(name string) (uid uint32, err error)
- func (m *Manager) SetGroupID(name string, gid uint32) (resp *SetGroupIDResp, err error)
- func (m *Manager) SetUserID(name string, uid uint32) (resp *SetUserIDResp, err error)
- func (m *Manager) ShadowByName(username string) (types.ShadowEntry, error)
- func (m *Manager) Stop() error
- func (m *Manager) UnlockUser(username string) error
- func (m *Manager) UpdateBrokerForUser(username, brokerID string) error
- func (m *Manager) UpdateUser(u types.UserInfo) (err error)
- func (m *Manager) UsedGIDs() ([]uint32, error)
- func (m *Manager) UsedUIDs() ([]uint32, error)
- func (m *Manager) UserByID(uid uint32) (types.UserEntry, error)
- func (m *Manager) UserByName(username string) (types.UserEntry, error)
- type NoDataFoundError
- type Option
- type SetGroupIDResp
- type SetUserIDResp
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{
UIDMin: 10000,
UIDMax: 60000,
GIDMin: 10000,
GIDMax: 60000,
}
DefaultConfig is the default configuration for the user manager.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
UIDMin uint32 `mapstructure:"uid_min" yaml:"uid_min"`
UIDMax uint32 `mapstructure:"uid_max" yaml:"uid_max"`
GIDMin uint32 `mapstructure:"gid_min" yaml:"gid_min"`
GIDMax uint32 `mapstructure:"gid_max" yaml:"gid_max"`
}
Config is the configuration for the user manager.
type IDGenerator ¶
type IDGenerator struct {
UIDMin uint32
UIDMax uint32
GIDMin uint32
GIDMax uint32
// contains filtered or unexported fields
}
IDGenerator is an ID generator that generates UIDs and GIDs in a specific range.
func (*IDGenerator) GenerateGID ¶
func (g *IDGenerator) GenerateGID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uint32, func(), error)
GenerateGID generates a random GID in the configured range.
func (*IDGenerator) GenerateUID ¶
func (g *IDGenerator) GenerateUID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uint32, func(), error)
GenerateUID generates a random UID in the configured range.
type IDGeneratorIface ¶
type IDGeneratorIface interface {
GenerateUID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (uid uint32, cleanup func(), err error)
GenerateGID(lockedEntries *localentries.UserDBLocked, owner IDOwner) (gid uint32, cleanup func(), err error)
}
IDGeneratorIface is the interface that must be implemented by the ID generator.
type IDGeneratorMock ¶
IDGeneratorMock is a mock implementation of the IDGenerator interface.
func (*IDGeneratorMock) GenerateGID ¶
func (g *IDGeneratorMock) GenerateGID(_ *localentries.UserDBLocked, _ IDOwner) (uint32, func(), error)
GenerateGID generates a GID.
func (*IDGeneratorMock) GenerateUID ¶
func (g *IDGeneratorMock) GenerateUID(_ *localentries.UserDBLocked, _ IDOwner) (uint32, func(), error)
GenerateUID generates a UID.
type IDOwner ¶
IDOwner is the interface that must be implemented by the IDs owner to provide the currently used UIDs and GIDs.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the manager for any user related operation.
func NewManager ¶
NewManager creates a new user manager.
func (*Manager) AllGroups ¶
func (m *Manager) AllGroups() ([]types.GroupEntry, error)
AllGroups returns all groups.
func (*Manager) AllShadows ¶
func (m *Manager) AllShadows() ([]types.ShadowEntry, error)
AllShadows returns all shadow entries.
func (*Manager) BrokerForUser ¶
BrokerForUser returns the broker ID for the given user.
func (*Manager) GroupByID ¶
func (m *Manager) GroupByID(gid uint32) (types.GroupEntry, error)
GroupByID returns the group information for the given group ID.
func (*Manager) GroupByName ¶
func (m *Manager) GroupByName(groupname string) (types.GroupEntry, error)
GroupByName returns the group information for the given group name.
func (*Manager) IsUserLocked ¶
IsUserLocked returns true if the user with the given user name is locked, false otherwise.
func (*Manager) RegisterUserPreAuth ¶
RegisterUserPreAuth registers a temporary user with a unique UID in our NSS handler (in memory, not in the database).
The temporary user record is removed when UpdateUser is called with the same username.
func (*Manager) SetGroupID ¶
func (m *Manager) SetGroupID(name string, gid uint32) (resp *SetGroupIDResp, err error)
SetGroupID updates the GID of the group with the given name to the specified GID.
func (*Manager) SetUserID ¶
func (m *Manager) SetUserID(name string, uid uint32) (resp *SetUserIDResp, err error)
SetUserID updates the UID of the user with the given name to the specified UID.
func (*Manager) ShadowByName ¶
func (m *Manager) ShadowByName(username string) (types.ShadowEntry, error)
ShadowByName returns the shadow information for the given user name.
func (*Manager) UnlockUser ¶
UnlockUser sets the "locked" field to false for the given user.
func (*Manager) UpdateBrokerForUser ¶
UpdateBrokerForUser updates the broker ID for the given user.
func (*Manager) UpdateUser ¶
UpdateUser updates the user information in the db.
func (*Manager) UsedGIDs ¶
UsedGIDs returns all group IDs, including the GIDs of temporary pre-auth users.
func (*Manager) UsedUIDs ¶
UsedUIDs returns all user IDs, including the UIDs of temporary pre-auth users.
type NoDataFoundError ¶
type NoDataFoundError = db.NoDataFoundError
NoDataFoundError is the error returned when no entry is found in the db.
type Option ¶
type Option func(*options)
Option is a function that allows changing some of the default behaviors of the manager.
func WithIDGenerator ¶
func WithIDGenerator(g IDGeneratorIface) Option
WithIDGenerator makes the manager use a specific ID generator. This option is only useful in tests.
type SetGroupIDResp ¶
SetGroupIDResp is the response type of SetGroupID.
type SetUserIDResp ¶
SetUserIDResp is the response type of SetUserID.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package db handles transaction with an underlying database to store user and group information.
|
Package db handles transaction with an underlying database to store user and group information. |
|
bbolt
Package bbolt handles transaction with the deprecated bbolt database
|
Package bbolt handles transaction with the deprecated bbolt database |
|
Package localentries provides functions to access the local user and group database.
|
Package localentries provides functions to access the local user and group database. |
|
testutils
Package localgrouptestutils export users test functionalities used by other packages to change cmdline and group file.
|
Package localgrouptestutils export users test functionalities used by other packages to change cmdline and group file. |
|
Package userslocking implements locking of the local user and group files (/etc/passwd, /etc/groups, /etc/shadow, /etc/gshadow) via the libc lckpwdf() function.
|
Package userslocking implements locking of the local user and group files (/etc/passwd, /etc/groups, /etc/shadow, /etc/gshadow) via the libc lckpwdf() function. |
|
Package proc contains utilities for checking processes via /proc.
|
Package proc contains utilities for checking processes via /proc. |
|
Package tempentries provides a temporary pre-authentication records.
|
Package tempentries provides a temporary pre-authentication records. |
|
Package userstestutils export db test functionalities used by other packages.
|
Package userstestutils export db test functionalities used by other packages. |
|
Package types provides types for the users package.
|
Package types provides types for the users package. |