Documentation ¶
Overview ¶
Package config provide the ssh_config(5) parser and getter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config contains mapping of host's patterns and its options from SSH configuration file.
type PermittedCNAMEs ¶
type PermittedCNAMEs struct {
// contains filtered or unexported fields
}
type Section ¶
type Section struct { AddKeysToAgent string AddressFamily string BindAddress string BindInterface string CanonicalDomains []string CanonicalizeHostname string CanonicalizeMaxDots int CanonicalizePermittedCNAMEs *PermittedCNAMEs CASignatureAlgorithms []string CertificateFile []string ConnectionAttempts int ConnectTimeout int // Environments contains system environment variables that will be // passed to Execute(). // The key and value is derived from "SendEnv" and "SetEnv". Environments map[string]string Hostname string IdentityFile []string Port string User string XAuthLocation string IsBatchMode bool IsCanonicalizeFallbackLocal bool IsChallengeResponseAuthentication bool IsCheckHostIP bool IsClearAllForwardings bool UseCompression bool UseVisualHostKey bool // WorkingDir contains the directory where the SSH client started. // This value is required when client want to copy file from/to // remote. // This field is optional, default to current working directory from // os.Getwd() or user's home directory. WorkingDir string // The first IdentityFile that exist and valid. PrivateKeyFile string // PrivateKeys contains IdentityFile that has been parsed. // This field will be set once the Signers has been called. PrivateKeys map[string]any // contains filtered or unexported fields }
Section is the type that represent SSH client Host and Match section in configuration.
func (*Section) GetIdentityAgent ¶ added in v0.32.0
GetIdentityAgent get the identity agent either from section config variable IdentityAgent or from environment variable SSH_AUTH_SOCK. It will return empty string if IdentityAgent set to "none" or SSH_AUTH_SOCK is empty.
func (*Section) Signers ¶
Signers convert the IdentityFile to ssh.Signer for authentication using PublicKey and store the parsed-unsigned private key into PrivateKeys.
This method will ask for passphrase from terminal, if one of IdentityFile is protected. Unless the value of IdentityFile changes, this method should be called only once, otherwise it will ask passphrase on every call.