Documentation ¶
Overview ¶
Package SSH provides tooling for generating a temporary SSH keypair, and provides tooling for connecting to an instance via a tunnel.
Index ¶
- func FileSigner(path string) (ssh.Signer, error)
- func FileSignerWithCert(path string, certificatePath string) (ssh.Signer, error)
- func ParseTunnelArgument(forward string, direction ssh.TunnelDirection) (ssh.TunnelSpec, error)
- func ReadCertificate(certificatePath string, keySigner ssh.Signer) (ssh.Signer, error)
- type CreateKeyPairConfig
- type FromPrivateKeyConfig
- type KeyPair
- type KeyPairType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileSigner ¶
FileSigner returns an ssh.Signer for a key file.
func FileSignerWithCert ¶
FileSigner returns an ssh.Signer for a key file.
func ParseTunnelArgument ¶
func ParseTunnelArgument(forward string, direction ssh.TunnelDirection) (ssh.TunnelSpec, error)
ParseTunnelArgument parses an SSH tunneling argument compatible with the openssh client form. Valid formats: `port:host:hostport` NYI `[bind_address:]port:host:hostport`
Types ¶
type CreateKeyPairConfig ¶
type CreateKeyPairConfig struct { // Type describes the key pair's type. Type KeyPairType // Bits represents the key pair's bits of entropy. E.g., 4096 for // a 4096 bit RSA key pair, or 521 for a ECDSA key pair with a // 521-bit curve. Bits int // Comment is the resulting key pair's comment. This is typically // used to identify the key pair's owner in the SSH user's // 'authorized_keys' file. Comment string }
CreateKeyPairConfig describes how an SSH key pair should be created.
type FromPrivateKeyConfig ¶
type FromPrivateKeyConfig struct { // RawPrivateKeyPemBlock is the raw private key that the key pair // should be loaded from. RawPrivateKeyPemBlock []byte // Comment is the key pair's comment. This is typically used // to identify the key pair's owner in the SSH user's // 'authorized_keys' file. Comment string }
FromPrivateKeyConfig describes how an SSH key pair should be loaded from an existing private key.
type KeyPair ¶
type KeyPair struct { // PrivateKeyPemBlock represents the key pair's private key in // ASN.1 Distinguished Encoding Rules (DER) format in a // Privacy-Enhanced Mail (PEM) block. PrivateKeyPemBlock []byte // PublicKeyAuthorizedKeysLine represents the key pair's public key // as a line in OpenSSH authorized_keys. PublicKeyAuthorizedKeysLine []byte // Comment is the key pair's comment. This is typically used // to identify the key pair's owner in the SSH user's // 'authorized_keys' file. Comment string }
KeyPair represents an SSH key pair.
func KeyPairFromPrivateKey ¶
func KeyPairFromPrivateKey(config FromPrivateKeyConfig) (KeyPair, error)
KeyPairFromPrivateKey returns a KeyPair loaded from an existing private key.
Supported key pair types include:
- DSA (NOTE: deprecated from Go as DSA is not regarded as secure anymore, please consider RSA or ED25519 instead)
- ECDSA
- ED25519
- RSA
func NewKeyPair ¶
func NewKeyPair(config CreateKeyPairConfig) (KeyPair, error)
NewKeyPair generates a new SSH key pair using the specified CreateKeyPairConfig.
type KeyPairType ¶
type KeyPairType string
KeyPairType represents different types of SSH key pairs. See the 'const' block for details.
const ( // Markers for various SSH key pair types. Default KeyPairType = "" Rsa KeyPairType = "RSA" Ecdsa KeyPairType = "ECDSA" Dsa KeyPairType = "DSA" Ed25519 KeyPairType = "ED25519" )
func (KeyPairType) String ¶
func (o KeyPairType) String() string