Documentation
¶
Index ¶
- Constants
- func CreateUsers(user, key string, sudoer bool) error
- func DemoteUser(user string) error
- func PromoteUser(user string) error
- func SliceToString(slice []string) string
- func ValidateSudoersGroup() error
- func ValidateSudoersPermissions() error
- func ValidateUsersGroup() error
- type Config
- type Members
- type State
Constants ¶
const ( // SudoersGroup represent a sudoers unix group name SudoersGroup string = "ssh-manager-sudoers" // UsersGroup represent a users unix group name UsersGroup string = "ssh-manager-users" )
const Version string = "1.0.4"
Version contains current application version
Variables ¶
This section is empty.
Functions ¶
func CreateUsers ¶
CreateUsers will create a local users and assign them to the relevant groups.
func SliceToString ¶
SliceToString is a helper function to format a slice of strings into a comma separated string.
func ValidateSudoersGroup ¶
func ValidateSudoersGroup() error
ValidateSudoersGroup ensures that custom sudoers group exists
func ValidateSudoersPermissions ¶
func ValidateSudoersPermissions() error
ValidateSudoersPermissions ensures that sudoers file contains a custom sudoers group.
func ValidateUsersGroup ¶
func ValidateUsersGroup() error
ValidateUsersGroup ensures that custom users group exists
Types ¶
type Config ¶
type Config struct {
Users map[string]string `json:"users"`
ServerGroups map[string]*Members `json:"server_groups"`
}
Config represents a remote configuration
func GetConfig ¶
func GetConfig(service *secretsmanager.SecretsManager, name string) (*Config, error)
GetConfig fetches an AWS Secret and returns an application configuration
func (*Config) GetSudoers ¶
GetSudoers returns a map of sudo users and their public ssh keys for a matching server groups
type State ¶
State represents local application state and reflects a current status and a results of a previous run.
func (*State) DeleteUsers ¶
DeleteUsers that exists in a runtime state but not in a provided slices, which provided from a remote configuration.
func (*State) SudoersLoop ¶
SudoersLoop is a main loop for sudo users creation and standard users promotion