- func Base64PrivateKey(name string) (*string, error)
- func EnsureKey() (bool, error)
- func EnsureKnownHosts(bastion string) error
- func EnsureSSHConfig(cfg string) error
- func GenerateKey(privatekeypath string) (*string, error)
- func GetAuthMethods() (ssh.AuthMethod, error)
- func KeyScan(bastion string) (*string, error)
- func PrivateKeyFile() (ssh.AuthMethod, error)
- func PublicKey() (*string, error)
- func SSH(host string) error
- func StartInteractiveSSHShell(sshConfig *ssh.ClientConfig, network string, host string, port string) error
const PrivateKeyPath = "~/.ssh/cp_simulator_rsa"
PrivateKeyPath is the path to the key to be generated and used by simulator
PublicKeyPath is the path to the key to be generated and used by simulator
const SSHConfigPath = "~/.ssh/cp_simulator_config"
SSHConfigPath is the path to write the simulator SSH config file
const SSHKnownHostsPath = "~/.ssh/cp_simulator_known_hosts"
SSHKnownHostsPath is the path to write the simulator SSH config file
This section is empty.
func Base64PrivateKey ¶
Base64PrivateKey returns a pointer to a string containing the base64 encoded private key or an 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 ¶
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 ¶
EnsureSSHConfig writes the SSH config file for simulator that is needed for the `perturb.sh` scripts to run succesfully via the bastion
func GenerateKey ¶
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 ¶
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
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 ¶
PrivateKeyFile reads the private key at the path supplied and returns the ssh.AuthMethod to use or an error if any occurred
PublicKey reads the public key and return a pointer to a string with its contents or any 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
This section is empty.