hostkey

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package hostkey keeps the SSH host key of the SFTP server. The core, which is root, makes it before anyone has connected, so the panel can show its fingerprint. The server only reads it.

Index

Constants

View Source
const File = "host_key"

File is the name of the key inside its folder, and of the old one inside the SFTP server's state folder.

Variables

This section is empty.

Functions

func Ensure added in v0.7.4

func Ensure(dir string, gid int, legacyDir string) (ssh.Signer, error)

Ensure makes sure dir holds the host key and returns it. dir must be writable by root alone: the key belongs to root and the group gid, which may read it. If there is no key yet and legacyDir holds an ed25519 one, it is copied over so the fingerprint stays what clients have trusted; otherwise a new key is made. The old file is left alone, since an update may roll back to a binary that reads it.

legacyDir is the SFTP user's own folder, so nothing in it is trusted: the file is opened without following links and must be a small regular file. Nothing is ever written there.

func Load added in v0.7.4

func Load(path string) (ssh.Signer, error)

Load reads the key at path. It never writes, so the unprivileged SFTP server can use it on a folder it cannot change.

Types

This section is empty.

Jump to

Keyboard shortcuts

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