users

package
v0.0.0-...-666a0c5 Latest Latest
Warning

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

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

Documentation

Overview

Package users contains methods for creating and managing users and their ssh keys.

Index

Constants

View Source
const (
	NullAction UserAction = "null"
	Create                = "create"
	Disable               = "disable"
)
View Source
const DefaultHomeBase = "/home"
View Source
const DefaultShell = "/bin/bash"

Variables

This section is empty.

Functions

func MakeNewGroup

func MakeNewGroup(groupName string) error

func ProcessUsers

func ProcessUsers(userList []*User) error

ProcessUsers updates or create users as needed.

Types

type User

type User struct {
	*user.User
	AuthorizedKeys []string
	Shell          string
	Action         UserAction
	Groups         []string
	PrimaryGroup   string
	// contains filtered or unexported fields
}

func Get

func Get(username string) (*User, error)

Get a user, if it exists.

func New

func New(userName string, fullName string, homeDir string, shell string, action UserAction, groups []string, authorizedKeys []string) (*User, error)

New creates a new user. It's a pass-through to an OS-specific function, see the appropriate one for details.

func (*User) Disable

func (u *User) Disable() error

func (*User) Update

func (u *User) Update() error

type UserAction

type UserAction string

type UserExtDataClient

type UserExtDataClient struct {
	*consul.Client
	// contains filtered or unexported fields
}

func NewUserExtDataClient

func NewUserExtDataClient(c *consul.Client, userKeyPrefix string) *UserExtDataClient

func (*UserExtDataClient) GetUsers

func (c *UserExtDataClient) GetUsers(userList []*groups.Member) ([]*User, error)

get user information out of consul, get any that are present on the

func (*UserExtDataClient) UpdateUsers

func (c *UserExtDataClient) UpdateUsers(userGaggle []*User) error

type UserInfo

type UserInfo struct {
	Username       string     `json:"username"`
	Name           string     `json:"full_name"`
	Groups         []string   `json:"groups"`
	PrimaryGroup   string     `json:"primary_group"`
	HomeDir        string     `json:"home_dir"`
	Shell          string     `json:"shell"`
	Action         UserAction `json:"action"`
	DoesNotExist   bool       `json:"does_not_exist"`
	AuthorizedKeys []string   `json:"authorized_keys"`
}

Jump to

Keyboard shortcuts

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