sshkeys

package
v0.7.0-rc.8 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sshkeys parses supported public keys and stores the operator's authorized_keys.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecognizedType

func RecognizedType(t string) bool

RecognizedType includes obsolete types so account inspection can report exclusions.

Types

type Key

type Key struct {
	Type        string
	Fingerprint string
	Comment     string
	RawLine     string
}

func Classify

func Classify(content string) ([]Key, int)

Classify excludes restricted, malformed and obsolete key entries rather than turning a restricted credential into an unrestricted one by removing options.

func Keys

func Keys(content []byte) []Key

Keys returns distinct supported credentials. Unmanaged lines are preserved by edits.

func Parse

func Parse(line string) (Key, error)

Parse accepts one bare public key. Options, certificates and multiple lines are unsupported.

type Source

type Source struct {
	User     string `json:"user"`
	Path     string `json:"path"`
	Keys     []Key  `json:"keys"`
	Excluded int    `json:"excluded"`
	Problem  string `json:"problem,omitempty"`
}

Source contains only supported public keys. Problem distinguishes an incomplete observation from a successfully read source with no supported keys.

type Store

type Store struct{ Path string }

Store uses the same directory lock for operator edits and the helper's disable guard. Locking the directory keeps the lock stable when authorized_keys is atomically replaced. External editors do not participate in this coordination.

func (Store) Read

func (s Store) Read() ([]byte, error)

func (Store) Update

func (s Store) Update(edit func([]byte) ([]byte, error)) (changed bool, err error)

Update evaluates the change while locked. changed is true once rename succeeds, even if syncing the directory then fails. Runtime callers retain their own UID.

func (Store) WithLock

func (s Store) WithLock(action func() error) error

WithLock refuses contention instead of waiting while the serialized helper might itself be needed by the current editor to read effective password authentication.

Jump to

Keyboard shortcuts

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