Documentation
¶
Overview ¶
Package askpass provides a backchannel to handle ssh password prompts from the calling instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewUnstartedServer ¶
NewUnstartedServer creates an unstarted server to handle askpass prompts.
func (*Server) IsSubprocess ¶
IsSubprocess returns true if it detects that it was started as a SSH_ASKPASS subprocess. In this case the main program should shutdown immediately (stdout handling already happened before returning).
func (*Server) NewSubprocess ¶
NewSubprocess indicates the intent to start a subprocess which might need a password.
- started must be called with the pid of a parent process of the askpass invocation (to ensure that the password is only given to proper processes)
- cancel must be called when the subprocess is done
- env contains the env variables for the askpass override (never nil)
func (*Server) Serve ¶
Serve calls askpass to retrieve the password and give it to askpass (must be called after Server.StartListening) It will return an error only if the unix socket returns an error on ln.Accept.
- name comes from Server.NewSubprocess
- prompt is the prompt line provided by askpass
- done will be closed when the parent process returned (hence the password is no longer needed)
func (*Server) StartListening ¶
StartListening starts listening on the unix socket (must be called before Server.Serve)