sshkeymgr

package module
v0.0.0-...-4a5339b Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: BSD-2-Clause Imports: 6 Imported by: 0

README

Capabilities

  • Create a managed authorized_keys file from a directory of source files.
  • Remove keys from a revocation file
  • Remove unmanaged keys
  • Add a single key
  • Delete a single key

Requirements

  • Preserve Key Order
  • Preserve associated comments

Documentation

Index

Constants

View Source
const (
	MANAGED_TAG = "sshkeymgr:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyData

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

func LoadKeydata

func LoadKeydata(lines []string) (*KeyData, error)

Parse the key from lines of data Expects 0 or more comment lines beginning with a # followed by a single line in authorized_keys format.

func ReadKeyDataFromReader

func ReadKeyDataFromReader(rdr io.Reader) (*KeyData, error)

Read a single key from a reader. This may advance past the end of the key

func ReadKeydataFromScanner

func ReadKeydataFromScanner(sc *bufio.Scanner) (*KeyData, error)

Read a single key from a scanner. Leave the scanner at the next line (or EOF)

func (*KeyData) AddManagedComment

func (kd *KeyData) AddManagedComment()

func (*KeyData) Equals

func (kd *KeyData) Equals(kd2 *KeyData) bool

Compare two KeyData instances. They compare as true iff the fingerprints of the keys match. Note that they explicitly *don't* care about options.

func (*KeyData) MatchesFingerprint

func (kd *KeyData) MatchesFingerprint(pk string) bool

func (*KeyData) WriteKeydata

func (kd *KeyData) WriteKeydata(w io.Writer) error

type KeySet

type KeySet struct {
	Keys []*KeyData
}

func LoadKeySet

func LoadKeySet(r io.Reader) (*KeySet, error)

func (*KeySet) RemoveKeyBySpec

func (ks *KeySet) RemoveKeyBySpec(spec string) bool

Removes any keys matching the keyspec. We expect either a public key or an MD5 or SHA256 based fingerprint. Returns true if found, false if not found

func (*KeySet) WriteKeySet

func (ks *KeySet) WriteKeySet(w io.Writer) error

Directories

Path Synopsis
cmd
sshkeymgr command

Jump to

Keyboard shortcuts

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