ssh

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: GPL-3.0, LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package ssh handles SSH key injection and host key collection for node containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectHostKey

func CollectHostKey(ctx context.Context, client *docker.Client, container docker.ContainerName) (string, error)

CollectHostKey retrieves the ed25519 host public key from a node container by running ssh-keyscan against localhost. Returns the key in "ssh-ed25519 AAAA..." format (without the hostname prefix).

func ExportConfig

func ExportConfig(ctx context.Context, client *docker.Client, fs afero.Fs, dir, realm string, sshContainer docker.ContainerName) error

ExportConfig exports SSH configuration to the given directory by reading the private key and known_hosts from the SSH relay container and writing ssh_config, id_ed25519, and known_hosts to dir.

func GenerateSSHConfig

func GenerateSSHConfig(sshContainer docker.ContainerName, dir, realm string) string

GenerateSSHConfig returns the SSH config snippet pointing to files in dir. For the default realm, it includes hostname canonicalization directives that enable short-name SSH access (e.g. "ssh controller").

func InjectPublicKey

func InjectPublicKey(ctx context.Context, client *docker.Client, container docker.ContainerName, pubKey string) error

InjectPublicKey writes the given SSH public key into the container's /root/.ssh/authorized_keys file, creating the directory if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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