libstns

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2018 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NSS_STATUS_SUCCESS  = 1
	NSS_STATUS_NOTFOUND = 0
	NSS_STATUS_UNAVAIL  = -1
	NSS_STATUS_TRYAGAIN = -2
)

http://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html

View Source
const (
	NSS_LIST_PRESET = 0
	NSS_LIST_PURGE  = 1
)
View Source
const (
	PAM_AUTH_ERR         = 7
	PAM_AUTHINFO_UNAVAIL = 9
	PAM_SUCCESS          = 0
)

Variables

This section is empty.

Functions

func Setlog

func Setlog() error

Types

type Config

type Config struct {
	ApiEndPoint     []string          `toml:"api_end_point"`
	RequestTimeOut  int               `toml:"request_timeout"`
	RequestRetry    int               `toml:"retry_request"`
	User            string            `toml:"user"`
	Password        string            `toml:"password"`
	SslVerify       bool              `toml:"ssl_verify"`
	WrapperCommand  string            `toml:"wrapper_path"`
	ChainSshWrapper string            `toml:"chain_ssh_wrapper"`
	HttpProxy       string            `toml:"http_proxy"`
	RequestHeader   map[string]string `toml:"request_header"`
	TlsCa           string            `toml:"tls_ca"`
	TlsCert         string            `toml:"tls_cert"`
	TlsKey          string            `toml:"tls_key"`
	UIDShift        int               `toml:"uid_shift"`
	GIDShift        int               `toml:"gid_shift"`
}

func LoadConfig

func LoadConfig(filePath string) (*Config, error)

type Nss

type Nss struct {
	// contains filtered or unexported fields
}

func NewNss

func NewNss(config *Config, rtype string, list stns.Attributes, position *int) *Nss

func (*Nss) Get

func (n *Nss) Get(column, value string) (stns.Attributes, error)

func (*Nss) PresetList

func (n *Nss) PresetList() int

func (*Nss) PurgeList

func (n *Nss) PurgeList()

func (*Nss) Set

func (n *Nss) Set(s NssEntry, column, value string) int

func (*Nss) SetByList

func (n *Nss) SetByList(s NssEntry) int

type NssEntry

type NssEntry interface {
	Set(stns.Attributes) int
}

type Pam

type Pam struct {
	AuthType string
	// contains filtered or unexported fields
}

func NewPam

func NewPam(config *Config, argc int, argv []string) *Pam

func (*Pam) PasswordAuth

func (p *Pam) PasswordAuth(user string, password string) int

func (*Pam) SudoUser

func (p *Pam) SudoUser() string

type Request

type Request struct {
	ApiPath      string
	Config       *Config
	ResourceType string
}

func NewRequest

func NewRequest(config *Config, paths ...string) (*Request, error)

func (*Request) GetByWrapperCmd

func (r *Request) GetByWrapperCmd() (*ResponseFormat, error)

func (*Request) GetRawData

func (r *Request) GetRawData() ([]byte, error)

only use wrapper command

func (*Request) TlsConfig

func (r *Request) TlsConfig() *tls.Config

func (*Request) TlsKeysExists

func (r *Request) TlsKeysExists() bool

type ResponseFormat

type ResponseFormat struct {
	Items stns.Attributes `json:"items"`
}

func (ResponseFormat) First

func (r ResponseFormat) First() *stns.Attribute

Jump to

Keyboard shortcuts

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