sshushd

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package sshushd controls the sshush agent daemon: starting, stopping, reloading, and running the agent in the background. It spawns the sshushd binary and manages the pidfile.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAlreadyRunning

func CheckAlreadyRunning(socketPath string) bool

CheckAlreadyRunning returns true if something is already listening on the socket.

func FindBinary

func FindBinary() (string, error)

FindBinary resolves the sshushd binary path.

func ReloadDaemon

func ReloadDaemon(configPath, socketPath, pidFilePath string) error

ReloadDaemon stops any existing daemon and starts a new one.

func RunAgent

func RunAgent(ctx context.Context, socketPath string, keyPaths []string) error

RunAgent runs the agent in the current process: loads keys and serves on the socket until ctx is done. Does not detach or write a pidfile. Use for in-process (e.g. subshell) mode.

func RunDaemonOnly

func RunDaemonOnly(socketPath string, keyPaths []string, pidFilePath string) error

RunDaemonOnly runs the agent daemon in the current process: detaches from terminal, writes pidfile, loads keys, and serves on the socket. Call only from the sshushd binary. Removes pidfile and socket on exit.

func StartDaemon

func StartDaemon(configPath, socketPath string) error

StartDaemon starts sshushd with SSHUSH_CONFIG and waits for socket readiness.

func StopDaemon

func StopDaemon(pidFilePath string) error

StopDaemon sends SIGTERM to the process in pidFilePath and waits for it to exit.

func WaitForSocket

func WaitForSocket(socketPath string, maxAttempts int, interval time.Duration) bool

WaitForSocket waits until the socket at socketPath is accepting connections or timeout. Used by the CLI after starting sshushd to confirm the daemon is up before exiting.

Types

type Server

type Server struct {
	Addr        string
	Keyring     sshagent.Agent
	HostKeyPath string
}

Server is the SSH server that runs in sshushd; it uses an agent keyring for authentication.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

Jump to

Keyboard shortcuts

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