Documentation ¶
Index ¶
- Constants
- func AddSSHKnownHost(host, port, pubkey string) error
- func AddSSHMatchBlock() (bool, error)
- func AgentHasCertificate(agent agent.ExtendedAgent, host string) (bool, error)
- func AgentIsRunning() bool
- func AgentRemoveCertificates(agent agent.ExtendedAgent, host string) error
- func GenerateKnownHosts(host, port, pubkey string) (string, error)
- func GenerateMatchBlock() string
- func GetAgent() (agent.ExtendedAgent, error)
- type FilePaths
Constants ¶
const ( SSH_CONFIG_USER = "config" SSH_CONFIG_SYSTEM = "ssh_config" SSH_KNOWN_HOSTS_USER = "known_hosts" SSH_KNOWN_HOSTS_SYSTEM = "ssh_known_hosts" HOSTS_USER = "oinit_hosts" HOSTS_SYSTEM = "ssh_oinit_hosts" )
const ( DEFAULT_SSH_PORT = 22 KNOWN_HOSTS_COMMENT = "Added by oinit" CONFIG_COMMENT = `` /* 214-byte string literal not displayed */ )
const (
PRINCIPAL = "oinit"
)
Variables ¶
This section is empty.
Functions ¶
func AddSSHKnownHost ¶
AddSSHKnownHost adds a "@cert-authority <hostport> <public key>" to the users known_hosts file if not already present there or system wide.
func AddSSHMatchBlock ¶
AddSSHMatchBlock adds the string generated by GenerateMatchBlock() to the user's ssh config file, if not already present there or system-wide. Returns boolean that indicates whether the match block was added or not.
func AgentHasCertificate ¶
func AgentHasCertificate(agent agent.ExtendedAgent, host string) (bool, error)
AgentHasCertificate returns a bool indicating whether a certificate issued by oinit-ca for the given host is currently present in the agent. An error is returned when communication with the agent is not possible, for example if it isn't running.
func AgentIsRunning ¶
func AgentIsRunning() bool
func AgentRemoveCertificates ¶ added in v1.1.0
func AgentRemoveCertificates(agent agent.ExtendedAgent, host string) error
AgentRemoveCertificates removes all certificates issued by oinit-ca for the given host from the agent. An error is returned when communication with the agent is not possible, for example if it isn't running.
func GenerateKnownHosts ¶
GenerateKnownHosts returns a string that can be added to the user or system known_hosts file. The returned string does not end with a line break.
func GenerateMatchBlock ¶
func GenerateMatchBlock() string
func GetAgent ¶
func GetAgent() (agent.ExtendedAgent, error)
Types ¶
type FilePaths ¶
func PathsHosts ¶
pathsHosts returns the user and system managed hosts file path.
On Unix or macOS, it returns:
user: $HOME/.ssh/oinit_hosts system: /etc/ssh/oinit_hosts
On Windows, it returns:
user: %userprofile%/.ssh/oinit_hosts system: %programdata%/ssh/oinit_hosts
func PathsSSHConfig ¶
pathsConfig returns the user and system config file path for OpenSSH.
On Unix or macOS, it returns:
user: $HOME/.ssh/config system: /etc/ssh/ssh_config
On Windows, it returns:
user: %userprofile%/.ssh/config system: %programdata%/ssh/ssh_config
func PathsSSHKnownHosts ¶
pathsKnownHosts returns the user and system known_hosts file path for OpenSSH.
On Unix or macOS, it returns:
user: $HOME/.ssh/known_hosts system: /etc/ssh/ssh_known_hosts
On Windows, it returns:
user: %userprofile%/.ssh/known_hosts system: %programdata%/ssh/ssh_known_hosts