Documentation
¶
Overview ¶
Package ssh handles SSH key injection and host key collection for node containers.
Index ¶
- func CollectHostKey(ctx context.Context, client *docker.Client, container docker.ContainerName) (string, error)
- func ExportConfig(ctx context.Context, client *docker.Client, fs afero.Fs, dir, realm string, ...) error
- func GenerateSSHConfig(sshContainer docker.ContainerName, dir, realm string) string
- func InjectPublicKey(ctx context.Context, client *docker.Client, container docker.ContainerName, ...) error
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.