ssh

package
Version: v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeyPath = "~/.ssh/cp_simulator_rsa"

PrivateKeyPath is the path to the key to be generated and used by simulator

View Source
const PublicKeyPath = PrivateKeyPath + ".pub"

PublicKeyPath is the path to the key to be generated and used by simulator

View Source
const SSHConfigPath = "~/.ssh/cp_simulator_config"

SSHConfigPath is the path to write the simulator SSH config file

View Source
const SSHKnownHostsPath = "~/.ssh/cp_simulator_known_hosts"

SSHKnownHostsPath is the path to write the simulator SSH config file

Variables

This section is empty.

Functions

func Base64PrivateKey

func Base64PrivateKey(name string) (*string, error)

Base64PrivateKey returns a pointer to a string containing the base64 encoded private key or an error

func EnsureKey

func EnsureKey() (bool, error)

EnsureKey ensures there is a well-known simulator key available and returns true if it generates a new one or an error if any

func EnsureKnownHosts

func EnsureKnownHosts(bastion string) error

EnsureKnownHosts scans the bastion host for its SSH keys and writes them to a custom known hosts location for promptless interaction with the infrastructure. Return an error if any occurred

func EnsureSSHConfig

func EnsureSSHConfig(cfg string) error

EnsureSSHConfig writes the SSH config file for simulator that is needed for the `perturb.sh` scripts to run succesfully via the bastion

func GenerateKey

func GenerateKey(privatekeypath string) (*string, error)

GenerateKey runs ssh-keygen silently to create an SSH key with the same provided using preconfigured settings It returns a pointer to a string containing the buffered stdout or an error if any occurred

func GetAuthMethods

func GetAuthMethods() ([]ssh.AuthMethod, error)

GetAuthMethods tries to contact ssh-agent to get the AuthMethods and falls back to reading the keyfile directly in case of a missing SSH_AUTH_SOCK env var or an error dialing the unix socket

func KeyScan

func KeyScan(bastion string) (*string, error)

KeyScan runs ssh-keyscan silently against the provided bastion address. It returns a pointer to a string containing its buffered stdout or an error if any occurred

func PrivateKeyFile

func PrivateKeyFile() (ssh.AuthMethod, error)

PrivateKeyFile reads the private key at the path supplied and returns the ssh.AuthMethod to use or an error if any occurred

func PublicKey

func PublicKey() (*string, error)

PublicKey reads the public key and return a pointer to a string with its contents or any error

func SSH

func SSH(host string) error

SSH establishes an interactive Secure Shell session to the supplied host as user ubuntu and on port 22. SSH uses ssh-agent to get the key to use

func StartInteractiveSSHShell

func StartInteractiveSSHShell(sshConfig *ssh.ClientConfig, network string, host string, port string) error

StartInteractiveSSHShell starts an interactive SSH shell with the supplied ClientConfig

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL