keys

package
v0.0.0-...-ea18b5b Latest Latest
Warning

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

Go to latest
Published: May 18, 2017 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fingerprint

func Fingerprint(k ssh.PublicKey) string

func HostKey

func HostKey(path string) (ssh.Signer, error)

func PublicKeyFile

func PublicKeyFile(path string) ssh.AuthMethod

func PublicKeyIsAuthorized

func PublicKeyIsAuthorized(key ssh.PublicKey) (bool, error)

func SSHAgent

func SSHAgent() ssh.AuthMethod

ParsePrivateKey returns a Signer from a PEM encoded private key. It supports the same keys as ParseRawPrivateKey.

Types

type Keystore

type Keystore struct {
	sync.Mutex
	Users []User
}

Keystore represents a concurrency safe collection of public keys associated with usernames.

func NewKeystore

func NewKeystore() *Keystore

NewKeystore provides a standard way to instiantiate a Keystore.

func (*Keystore) Add

func (store *Keystore) Add(user User)

Add keys associated with a username safely.

func (*Keystore) Get

func (store *Keystore) Get(command string, usernames ...string)

Get queries external sources for the public keys associated with the specified usernames.

func (*Keystore) Read

func (store *Keystore) Read(usernames ...string)

Read the ```authorized_keys``` file contents to identify managed settings.

func (*Keystore) Remove

func (store *Keystore) Remove(usernames ...string)

Remove the usernames from the key collection. If no usernames were specified all associated users will be removed.

func (*Keystore) Save

func (store *Keystore) Save()

Save writes the key store to the ```authorized_keys``` file while attempting to preserve non-generated settings.

func (*Keystore) String

func (store *Keystore) String(prefix string, usernames ...string) string

String outputs a pretty-ish display of the public keys affected by the action(s) taken.

func (*Keystore) Sync

func (store *Keystore) Sync(command string, usernames ...string)

Sync will requery the given users (or all users if nothing was specified) and refresh there public key stores.

type User

type User struct {
	Name     string
	Keys     []string
	Commands []string
}

User represents a Git user and there publicly accessible SSH keys.

Jump to

Keyboard shortcuts

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