Documentation
¶
Index ¶
Constants ¶
const ( AuthTypeKey = "key" AuthTypePassword = "password" )
Variables ¶
This section is empty.
Functions ¶
func ApplyAskpassEnv ¶
func ApplyAskpassEnv(contextName string)
ApplyAskpassEnv sets the askpass environment on the current process so that ssh children spawned indirectly (e.g. by docker connhelper) inherit it. Call with empty name to clear.
func AskpassEnv ¶
AskpassEnv returns environment variables that make any spawned ssh process use d4s itself as the askpass helper for this context.
func RunAskpassIfRequested ¶
func RunAskpassIfRequested() bool
RunAskpassIfRequested makes d4s act as an SSH_ASKPASS helper: when ssh invokes us with the askpass env set, print the stored secret and exit. Returns true if the process handled an askpass request.
func Save ¶
func Save(contextName string, creds SSHCredentials) error
Save stores credentials in the OS keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service). When no keyring is available (headless Linux), it falls back to an encrypted file in the d4s config dir.
Types ¶
type SSHCredentials ¶
type SSHCredentials struct {
AuthType string `json:"auth_type"`
KeyPath string `json:"key_path,omitempty"`
Passphrase string `json:"passphrase,omitempty"`
Password string `json:"password,omitempty"`
}
SSHCredentials holds the authentication settings of a remote SSH context. Passphrase/Password are stored in the OS keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service).
func Load ¶
func Load(contextName string) (*SSHCredentials, error)
func (*SSHCredentials) HasSecret ¶
func (c *SSHCredentials) HasSecret() bool
HasSecret reports whether ssh will need a non-interactive answer.
func (*SSHCredentials) SSHArgs ¶
func (c *SSHCredentials) SSHArgs() []string
SSHArgs returns extra ssh CLI flags for these credentials.
func (*SSHCredentials) Secret ¶
func (c *SSHCredentials) Secret() string
Secret returns the secret ssh should receive when prompting (key passphrase or login password).