nss

package module
v0.0.0-...-7d1d1dd Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 6 Imported by: 4

README

⚠️ Avoid relying on Go for shared libraries. The runtime uses signals it assumed to be unused for concurrency management. Assumptions like this are why the verion of Go can not be updated for go-libnss and make Go less predicable when building shared libraries.

The current recommendation is to build services to be compatible with existing protocols like LDAP.

Go-Libnss

This is an abstracted library in Go that wraps around libnss, allowing you to write new nss modules purely in Go.

What's Working?

Right now we only have binding for passwd, group, and shadow. This may change in the future to also implement other NSS features. These are just the most obvious first targets.

How do I use it?

First you should go get the package:

go get github.com/protosam/go-libnss

Take a gander at the example directory. It includes information on how to compile the example and you can use the implementation as a boiler plate for your own project.

License

MIT License

Projects Using Go-Libnss

Go-Libnss-Etcd - An NSS package that stores passwd, group, and shadow data in etcd. It also comes with CLI tools for managing users and groups stored in etcd.

Documentation

Index

Constants

View Source
const (
	StatusTryagain = C.NSS_STATUS_TRYAGAIN
	StatusUnavail  = C.NSS_STATUS_UNAVAIL
	StatusNotfound = C.NSS_STATUS_NOTFOUND
	StatusSuccess  = C.NSS_STATUS_SUCCESS
)

Variables

View Source
var ErrNotFound error = errors.New("not found")

Functions

func SetImpl

func SetImpl(i Implementation)

setspnam

Types

type Implementation

type Implementation interface {
	//PasswdOpen() (Status)
	//PasswdClose() (Status)
	PasswdAll() (Status, []Passwd)
	PasswdByName(name string) (Status, Passwd)
	PasswdByUid(uid uint) (Status, Passwd)

	//GroupOpen() (Status)
	//GroupClose() (Status)
	GroupAll() (Status, []Group)
	GroupByName(name string) (Status, Group)
	GroupByGid(gid uint) (Status, Group)

	//ShadowOpen() (Status)
	//ShadowClose() (Status)
	ShadowAll() (Status, []Shadow)
	ShadowByName(name string) (Status, Shadow)
}

type LIBNSS

type LIBNSS struct{}

Prototype structure for people to embed

func (LIBNSS) GroupAll

func (self LIBNSS) GroupAll() (Status, []Group)

endgrent

func (LIBNSS) GroupByGid

func (self LIBNSS) GroupByGid(gid uint) (Status, Group)

getgrnam

func (LIBNSS) GroupByName

func (self LIBNSS) GroupByName(name string) (Status, Group)

getgrent

func (LIBNSS) PasswdAll

func (self LIBNSS) PasswdAll() (Status, []Passwd)

getpwent

func (LIBNSS) PasswdByName

func (self LIBNSS) PasswdByName(name string) (Status, Passwd)

getpwnam

func (LIBNSS) PasswdByUid

func (self LIBNSS) PasswdByUid(uid uint) (Status, Passwd)

getpwuid

func (LIBNSS) ShadowAll

func (self LIBNSS) ShadowAll() (Status, []Shadow)

endspent

func (LIBNSS) ShadowByName

func (self LIBNSS) ShadowByName(name string) (Status, Shadow)

getspent

type Status

type Status int32

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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