util

package
v0.0.0-...-1743a1b Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchPatternList

func MatchPatternList(patterns []*Pattern, input string) bool

MatchPatternList returns true if the input matches any of the patterns in the list. Negated patterns are matched first; if a negated pattern matches, the function returns false immediately. If no patterns match, the function

func ParseSSHTimespec

func ParseSSHTimespec(value string) (time.Time, error)

Types

type AllowedSigner

type AllowedSigner struct {
	Key         ssh.PublicKey
	Principals  []*Pattern
	Namespaces  []*Pattern
	IsCA        bool
	ValidAfter  *time.Time
	ValidBefore *time.Time
}

func ParseAllowedSigners

func ParseAllowedSigners(in []byte) ([]AllowedSigner, error)

ParseAllowedSigners parses a list of AllowedSigners from a byte slice.

type AuthorizedKey

type AuthorizedKey struct {
	Key             ssh.PublicKey
	Comment         string
	Principals      []string
	IsCA            bool
	Command         sql.NullString
	Environment     map[string]string
	ExpiryTime      sql.NullTime
	AgentForwarding bool
	From            []*Pattern
	PortForwarding  bool
	Pty             bool
	UserRC          bool
	X11Forwarding   bool
	PermitListen    sql.NullString
	PermitOpen      sql.NullString
	NoTouchReq      bool
	VerifyReq       bool
	Tunnel          sql.NullString
}

AuthorizedKey represents an SSH authorized_keys entry

func NewAuthorizedKey

func NewAuthorizedKey(key ssh.PublicKey, comment string, options []string) (*AuthorizedKey, error)

func (*AuthorizedKey) MatchesPrincipal

func (k *AuthorizedKey) MatchesPrincipal(input string) bool

type Pattern

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

Pattern is a pattern in a Host declaration. Patterns are read-only values; create a new one with NewPattern().

func NewPattern

func NewPattern(s string) (*Pattern, error)

NewPattern creates a new Pattern for matching hosts. NewPattern("*") creates a Pattern that matches all hosts.

From the manpage, a pattern consists of zero or more non-whitespace characters, `*' (a wildcard that matches zero or more characters), or `?' (a wildcard that matches exactly one character). For example, to specify a set of declarations for any host in the ".co.uk" set of domains, the following pattern could be used:

Host *.co.uk

The following pattern would match any host in the 192.168.0.[0-9] network range:

Host 192.168.0.?

func (Pattern) String

func (p Pattern) String() string

String prints the string representation of the pattern.

Jump to

Keyboard shortcuts

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