Documentation
¶
Overview ¶
Package sshadd provides the ssh-add utility — manage SSH agent keys.
It exposes a Config struct with a Parse method for command-line argument parsing, individual action functions (Add, List, ListPublicKeys, Delete, DeleteAll, Lock, Unlock), and a Run dispatcher that connects to the agent and executes the requested action.
Index ¶
- func Add(cfg *Config, client agent.ExtendedAgent, streams stdio.TerminalStreams) int
- func ConnectAgent() (net.Conn, error)
- func DefaultKeyFiles() []string
- func Delete(cfg *Config, client agent.ExtendedAgent, streams stdio.Streams) int
- func DeleteAll(client agent.ExtendedAgent, streams stdio.Streams) int
- func KeySize(key ssh.PublicKey) int
- func KeyTypeName(format string) string
- func List(client agent.ExtendedAgent, streams stdio.Streams) int
- func ListPublicKeys(client agent.ExtendedAgent, streams stdio.Streams) int
- func Lock(client agent.ExtendedAgent, streams stdio.TerminalStreams) int
- func Run(cfg *Config, streams stdio.TerminalStreams) int
- func Unlock(client agent.ExtendedAgent, streams stdio.TerminalStreams) int
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add(cfg *Config, client agent.ExtendedAgent, streams stdio.TerminalStreams) int
Add adds private keys to the agent. If cfg.Files is empty, default key files are tried.
func ConnectAgent ¶
ConnectAgent dials the SSH agent socket specified by SSH_AUTH_SOCK.
func DefaultKeyFiles ¶
func DefaultKeyFiles() []string
DefaultKeyFiles returns the paths of standard SSH private key files that exist in the user's ~/.ssh directory.
func Delete ¶
Delete removes specified keys from the agent. If cfg.Files is empty, default key files are tried.
func DeleteAll ¶
func DeleteAll(client agent.ExtendedAgent, streams stdio.Streams) int
DeleteAll removes all keys from the agent.
func KeyTypeName ¶
KeyTypeName returns a human-readable name for the SSH key type.
func List ¶
func List(client agent.ExtendedAgent, streams stdio.Streams) int
List lists keys in the agent with fingerprints.
func ListPublicKeys ¶
func ListPublicKeys(client agent.ExtendedAgent, streams stdio.Streams) int
ListPublicKeys lists keys in the agent in authorized_keys format.
func Lock ¶
func Lock(client agent.ExtendedAgent, streams stdio.TerminalStreams) int
Lock locks the agent with a passphrase read from the terminal.
func Run ¶
func Run(cfg *Config, streams stdio.TerminalStreams) int
Run connects to the SSH agent and dispatches to the appropriate action based on cfg. Returns a process exit code.
func Unlock ¶
func Unlock(client agent.ExtendedAgent, streams stdio.TerminalStreams) int
Unlock unlocks the agent with a passphrase read from the terminal.