gensign

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gensign contains the concrete functions to process user requests and to generate CSRs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrorOfType

func IsErrorOfType(err interface{}, typ ErrorType) bool

IsErrorOfType returns true if the error matches to the given error type.

func Run

func Run(ctx context.Context, params *csr.ReqParam, handlers []Handler, signer csr.Signer) (err error)

Run is the main function of gensign. We assume the user has been authenticated via SSH (OpenSSH Server) before entering this function.

Types

type CreateHandler

type CreateHandler func(gensignConf *config.GensignConfig, conn net.Conn) (Handler, error)

CreateHandler is the interface function to initialize Handler.

type Error

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

Error defines the format of an error coming from gensign handlers.

func IsError

func IsError(err interface{}) (*Error, bool)

IsError returns true if the given error is in the gensign error type.

func NewError

func NewError(t ErrorType, handlerName string, err ...error) *Error

NewError returns a new Error. param err is optional.

func NewErrorWithMsg

func NewErrorWithMsg(t ErrorType, handlerName string, msg string) *Error

NewErrorWithMsg returns a new Error with a message.

func (Error) Error

func (e Error) Error() string

Error returns the Error's string representation.

func (Error) Type

func (e Error) Type() ErrorType

Type returns the Error's ErrorType.

type ErrorType

type ErrorType uint8

ErrorType specifies possible error types returned from CA.

const (

	// Unknown indicates the type of the error is unknown.
	Unknown ErrorType
	// HandlerDisabled indicates the handler is disabled (by config).
	HandlerDisabled
	// HandlerAuthN indicates the handler fails with authentication.
	HandlerAuthN
	// InvalidParams indicates the request parameter is invalid.
	InvalidParams
	// HandlerGenCSRErr indicates the handler fails to generate a certificate request.
	HandlerGenCSRErr
	// HandlerConfErr indicates the handler fails to parse the handler config.
	HandlerConfErr
	// Panic indicates a panic raised from the handler.
	Panic
)

func (ErrorType) String

func (t ErrorType) String() string

String returns the ErrorType's string representation.

type Handler

type Handler interface {
	csr.Generator
	Name() string
	Authenticate(params *csr.ReqParam) error
}

Handler describes an external handler that can extend the functionality of a standard gensign command.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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