ssh

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ssh provides SSH connectivity to StereOS sandbox VMs.

Index

Constants

View Source
const (
	// SSHKeyFilename is the name of the ephemeral private key file
	// stored in the VM directory.
	SSHKeyFilename = "ssh_key"

	// SSHPubKeyFilename is the name of the ephemeral public key file
	// stored in the VM directory.
	SSHPubKeyFilename = "ssh_key.pub"
)

Variables

This section is empty.

Functions

func ExecSSH

func ExecSSH(user, host string, port int, identityFile string) error

ExecSSH replaces the current process with the ssh binary, providing a clean interactive experience. Signal handling, terminal resizing, SSH agent forwarding, and ~. escape sequences all work correctly because the user talks directly to OpenSSH.

If identityFile is non-empty, it is passed as -i to ssh along with -o IdentitiesOnly=yes to prevent the SSH agent or default keys from being tried (which could exhaust MaxAuthTries before the correct ephemeral key is attempted).

func GenerateKeyPair

func GenerateKeyPair(dir, comment string) (privateKeyPath, publicKey string, err error)

GenerateKeyPair creates a fresh Ed25519 SSH keypair in the given directory. It writes the private key (OpenSSH PEM format, mode 0600) and the public key (authorized_keys format, mode 0644) to <dir>/ssh_key and <dir>/ssh_key.pub respectively.

Returns the absolute path to the private key and the public key string (suitable for injection into authorized_keys).

func SSHKeyPath

func SSHKeyPath(vmDir string) string

SSHKeyPath returns the path to the ephemeral SSH private key for a VM directory, or empty string if it doesn't exist.

func WaitForSSH

func WaitForSSH(address string, timeoutSeconds int) error

WaitForSSH polls the given address (host:port) until a TCP connection succeeds or the timeout (in seconds) expires.

Types

This section is empty.

Jump to

Keyboard shortcuts

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