Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecSSH ¶
func ExecSSH(ctx context.Context, id Identity, cmd []string, opts plugin.ExecOptions) (plugin.ExecCommand, error)
ExecSSH executes against a target via SSH. It will look up port, user, and other configuration by exact hostname match from default SSH config files. Identity can be used to override the user configured in SSH config. If opts.Elevate is true, will attempt to `sudo` as root.
If present, a local SSH agent will be used for authentication.
Lots of SSH configuration is currently omitted, such as global known hosts files, finding known hosts from the config, identity file from config... pretty much everything but port and user from config as enumerated in https://github.com/kevinburke/ssh_config/blob/0.5/validators.go.
The known hosts file will be ignored if StrictHostKeyChecking=no, such as in
Host *.compute.amazonaws.com StrictHostKeyChecking no
Types ¶
type Identity ¶
type Identity struct { Host string `json:"host"` User string `json:"user"` FallbackUser string `json:"fallback_user"` Password string `json:"password"` IdentityFile string `json:"identity_file"` KnownHosts string `json:"known_hosts"` HostKeyAlias string `json:"host_key_alias"` // Retries can be set to a non-zero value to retry every 500ms for that many times. Retries uint `json:"retries"` Port uint `json:"port"` }
Identity identifies how to connect to a target.