client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 29 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InstallCert

func InstallCert(a agent.Agent, cert *ssh.Certificate, key Key) error

InstallCert adds the private key and signed certificate to the ssh agent.

func SavePrivateFiles

func SavePrivateFiles(prefix string, cert *ssh.Certificate, key Key) error

SavePrivateFiles installs the private part of the key.

func SavePublicFiles

func SavePublicFiles(prefix string, cert *ssh.Certificate, pub ssh.PublicKey) error

SavePublicFiles installs the public part of the cert and key.

func Sign

func Sign(pub ssh.PublicKey, token string, conf *Config) (*ssh.Certificate, error)

Sign sends the public key to the CA to be signed.

Types

type Config

type Config struct {
	CA                     string `mapstructure:"ca"`
	Keytype                string `mapstructure:"key_type"`
	Keysize                int    `mapstructure:"key_size"`
	Validity               string `mapstructure:"validity"`
	ValidateTLSCertificate bool   `mapstructure:"validate_tls_certificate"`
	PublicFilePrefix       string `mapstructure:"key_file_prefix"`
}

Config holds the client configuration.

func ReadConfig

func ReadConfig(path string) (*Config, error)

ReadConfig reads the client configuration from a file into a Config struct.

type Key

type Key crypto.Signer

Key is a private key.

func GenerateKey

func GenerateKey(options ...func(*options)) (Key, ssh.PublicKey, error)

GenerateKey generates a ssh key-pair according to the type and size specified.

type KeyOption

type KeyOption func(*options)

A KeyOption is used to generate keys of different types and sizes.

func KeySize

func KeySize(size int) KeyOption

KeySize sets the size of the key in bits. RSA keys must be a minimum of 1024 bits. The default is 2048 bits. ECDSA keys must be one of 256, 384, or 521 bits. The default is 256 bits. Ed25519 keys are of a fixed size. This option is ignored.

func KeyType

func KeyType(keyType string) KeyOption

KeyType sets the type of key to generate. Valid types are: "rsa", "ecdsa", "ed25519". Default is "rsa"

Jump to

Keyboard shortcuts

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