ssh

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fingerprint

type Fingerprint struct {
	Hash      string `json:"hash"`
	Randomart string `json:"randomart"`
}

func ExtractFingerprint

func ExtractFingerprint(privateKeyPath, hashAlgo string) (Fingerprint, error)

Fingerprint extracts and returns the hash and randomart of the public key associated with the specified private key.

type KeyBitsValue

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

KeyBitsValue is an OptionalValue allowing specification of the -b argument to ssh-keygen.

func (*KeyBitsValue) Set

func (kbv *KeyBitsValue) Set(s string) error

func (*KeyBitsValue) Specified

func (kbv *KeyBitsValue) Specified() bool

func (*KeyBitsValue) String

func (kbv *KeyBitsValue) String() string

func (*KeyBitsValue) Type

func (kbv *KeyBitsValue) Type() string

type KeyFormatValue added in v1.19.0

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

KeyFormatValue is an OptionalValue allowing specification of the -m argument to ssh-keygen.

func (*KeyFormatValue) Set added in v1.19.0

func (ktv *KeyFormatValue) Set(s string) error

func (*KeyFormatValue) Specified added in v1.19.0

func (ktv *KeyFormatValue) Specified() bool

func (*KeyFormatValue) String added in v1.19.0

func (ktv *KeyFormatValue) String() string

func (*KeyFormatValue) Type added in v1.19.0

func (ktv *KeyFormatValue) Type() string

type KeyRing

type KeyRing interface {
	KeyPair() (publicKey PublicKey, privateKeyPath string)
	Regenerate() error
}

KeyRing is an abstraction providing access to a managed SSH key pair. Whilst the public half is available in byte form, the private half is left on the filesystem to avoid memory management issues.

func NewNopSSHKeyRing

func NewNopSSHKeyRing() KeyRing

NewNopSSHKeyRing returns a KeyRing that doesn't do anything. It is meant for local development purposes when running fluxd outside a Kubernetes container.

type KeyTypeValue

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

KeyTypeValue is an OptionalValue allowing specification of the -t argument to ssh-keygen.

func (*KeyTypeValue) Set

func (ktv *KeyTypeValue) Set(s string) error

func (*KeyTypeValue) Specified

func (ktv *KeyTypeValue) Specified() bool

func (*KeyTypeValue) String

func (ktv *KeyTypeValue) String() string

func (*KeyTypeValue) Type

func (ktv *KeyTypeValue) Type() string

type OptionalValue

type OptionalValue interface {
	pflag.Value
	Specified() bool
}

OptionalValue is an extension of pflag.Value that remembers if it has been set.

type PublicKey

type PublicKey struct {
	Key          string                 `json:"key"`
	Fingerprints map[string]Fingerprint `json:"fingerprints"`
}

func ExtractPublicKey

func ExtractPublicKey(privateKeyPath string) (PublicKey, error)

ExtractPublicKey extracts and returns the public key from the specified private key, along with its fingerprint hashes.

func KeyGen

func KeyGen(keyBits, keyType, keyFormat OptionalValue, tmpfsPath string) (privateKeyPath string, privateKey []byte, publicKey PublicKey, err error)

KeyGen generates a new keypair with ssh-keygen, optionally overriding the default type and size. Each generated keypair is written to a new unique subdirectory of tmpfsPath, which should point to a tmpfs mount as the private key is not encrypted.

Jump to

Keyboard shortcuts

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