Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateAuthorizedKeys ¶
CreateAuthorizedKeys returns a single string built of a set of keys all separated with a newline (\n). This can be used in SSH authorized_key files.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is a connection to an SSH agent, along with some supplementray data for manageing the connection.
func NewSSHAgent ¶
NewSSHAgent establishes a connection to a unix socket at the given path representing an SSH agent. Options can be given to configure the connection and how the agent is used. Options are executed in the order provided. Returned is an SSH agent connection or an error if unsuccessful.
func (*Agent) Close ¶
Close closes the underlying socket connection used to communicate with the SSH agent.
func (*Agent) GetKeys ¶
GetKeys uses the SSH agent connection to retreive all the keys present in the agent in the authorized key format. If the agent is locked and the correct passphrase option has been provided, the agent will be unlocked and re-locked as required. Returned are the keys present in the agent or an error if unsuccessful.
type AgentOpt ¶
type AgentOpt func(*Agent)
AgentOpt is a configuration option for an SSH agent connection.
func AgentPassphraseOpt ¶
AgentPassphraseOpt should be provided when creating a new agent if the SSH agent is locked by a passphrase.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key represents an SSH public key in the authorized_keys format.
func NewKey ¶
NewKey returns a new key based on the raw key string and the key name (comment). If the key can not be parsed as a valid authorized key, an error is returned.
func NewKeyFromFile ¶
NewKeyFromFile returns a new key based on the contents of a public key file. If the file can not be opened or the key can not be parsed as a valid authorized key, an error is returned.
func (Key) Fingerprint ¶
Fingerprint returns the SHA256 fingerprint of the key.