Pass $HTTPS_PROXY to ssh server (#205)

* Pass $HTTPS_PROXY to ssh server
* Emit additional error when failing to set HostKeyFile
pull/219/head v1.6.9
Simon Roberts 3 years ago committed by GitHub
parent dfaa8d0c3a
commit 6b6a18d38a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
//+build !windows
//go:build !windows
// +build !windows
package ssh
@ -196,6 +197,9 @@ func (s *Server) ListenAndServe() error {
cmd := exec.CommandContext(cmdCtx, s.executableBinary, flags...)
cmd.Env = append(sshSession.Environ(), fmt.Sprintf("TERM=%s", ptyReq.Term))
if proxy, ok := os.LookupEnv("HTTPS_PROXY"); ok {
cmd.Env = append(cmd.Env, fmt.Sprintf("HTTPS_PROXY=%s", proxy))
}
f, err := pty.Start(cmd)
if err != nil {
@ -238,7 +242,7 @@ func (s *Server) ListenAndServe() error {
err := s.sshServer.SetOption(ssh.HostKeyFile(s.hostKeyFile))
if err != nil {
return err
return fmt.Errorf("error setting HostKeyFile: %s: %v", s.hostKeyFile, err)
}
return s.sshServer.ListenAndServe()

Loading…
Cancel
Save