auth

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package auth - common auth functions for services, servers, and clients in Altid. Includes support for interacting with a local factotum

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listkeys

func Listkeys() ([]rsa.PublicKey, error)

Listkeys find our rsa public keys

func OpenRPC

func OpenRPC() (io.ReadWriteCloser, error)

OpenRPC returns an open file descriptor to an RPC

func RsaSign

func RsaSign(sha1 []byte) (signed []byte, err error)

RsaSign uses the factotum sign sha1, returning the bytes or an error

Types

type Info

type Info struct {
	Cuid   string
	Suid   string
	Cap    string
	Secret []byte
}

Info is returned after a successful authentication

func Proxy

func Proxy(rw io.ReadWriter, format string, a ...any) (*Info, error)

Proxy will proxy an RPC session through the local factotum

type Protocol added in v0.2.0

type Protocol struct {
}

TODO: Actual protocol

type RPC

type RPC struct {
	F   io.ReadWriteCloser
	Arg []byte
	Ai  *Info
}

RPC wraps an rpc session

func (*RPC) GetInfo

func (rpc *RPC) GetInfo() error

GetInfo attempts to retrieve an AuthInfo from an RPC

func (*RPC) Run

func (rpc *RPC) Run(overb string, arg string) (Ret, string)

Run initiates an RPC interaction

type Ret

type Ret int

Ret is a reply from an RPC session

const (
	ARok Ret = iota /* rpc return values */
	ARdone
	ARerror
	ARneedkey
	ARbadkey
	ARwritenext
	ARtoosmall
	ARtoobig
	ARrpcfailure
	ARphase

	RPCMax = 4096
)

All of the potential replies from an RPC

type UserPasswd

type UserPasswd struct {
	User, Password string
}

UserPasswd is return from a successful Getuserpasswd

func Getuserpasswd

func Getuserpasswd(params string, args ...any) (*UserPasswd, error)

Getuserpasswd - get a password. params i.e. proto=pass service=ssh role=client server=%s user=%s

Jump to

Keyboard shortcuts

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