Documentation
¶
Overview ¶
Package ssh provides SSH connectivity to Kernel browser VMs.
Index ¶
- func BuildSSHCommand(vmDomain, keyFile string, cfg Config) *exec.Cmd
- func CheckServicesScript() string
- func CheckWebsocatInstalled() error
- func ExtractVMDomain(cdpURL string) (string, error)
- func SetupScript(publicKey string) string
- func WriteTempKey(privateKeyPEM string, sessionID string) (string, error)
- type BrowserProcessService
- type Config
- type KeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSSHCommand ¶
BuildSSHCommand constructs the SSH command with websocat ProxyCommand.
func CheckServicesScript ¶
func CheckServicesScript() string
CheckServicesScript returns a script to check if SSH services are already running.
func CheckWebsocatInstalled ¶
func CheckWebsocatInstalled() error
CheckWebsocatInstalled verifies websocat is available in PATH. Returns nil if found, error with install instructions if not.
func ExtractVMDomain ¶
ExtractVMDomain extracts the VM FQDN from a CDP WebSocket URL by decoding the JWT. The CDP URL contains a JWT with the actual Unikraft FQDN in the payload. Example CDP URL: wss://proxy.xxx.dev.onkernel.com:8443/browser/cdp?jwt=eyJ... The JWT payload contains: {"session": {"fqdn": "actual-vm-domain.onkernel.app"}}
func SetupScript ¶
SetupScript generates the bash script to setup SSH services on the VM.
Types ¶
type BrowserProcessService ¶
type BrowserProcessService interface {
Exec(ctx context.Context, id string, body kernel.BrowserProcessExecParams, opts ...interface{}) (*kernel.BrowserProcessExecResponse, error)
}
BrowserProcessService defines the interface for executing commands on the VM. This matches the kernel SDK's BrowserProcessService.
type Config ¶
type Config struct {
BrowserID string
IdentityFile string // empty = generate ephemeral
LocalForward string // -L flag value
RemoteForward string // -R flag value
SetupOnly bool
}
Config holds SSH connection configuration
type KeyPair ¶
type KeyPair struct {
PrivateKeyPEM string // PEM-encoded private key (OpenSSH format)
PublicKeyOpenSSH string // OpenSSH authorized_keys format
}
KeyPair holds an SSH keypair
func GenerateKeyPair ¶
GenerateKeyPair creates an ed25519 SSH keypair suitable for OpenSSH. Returns the private key in PEM format and public key in authorized_keys format.