Skip to content

Commit 3823d23

Browse files
committed
Use hard coded values for SSH env vars
1 parent bab3c85 commit 3823d23

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

agent/agent.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,12 @@ func (a *agent) handleSSHSession(session ssh.Session) (retErr error) {
428428
return err
429429
}
430430
// Set SSH connection environment variables, from the clients perspective.
431-
srcAddr, srcPort := addrToSSHEnvAddr(session.RemoteAddr())
432-
dstAddr, dstPort := addrToSSHEnvAddr(session.LocalAddr())
431+
// Set SSH connection environment variables (these are also set by OpenSSH
432+
// and thus expected to be present by SSH clients). Since the agent does
433+
// networking in-memory, trying to provide accurate values here would be
434+
// nonsensical. For now, we hard code these values so that they're present.
435+
srcAddr, srcPort := "0.0.0.0", "0"
436+
dstAddr, dstPort := "0.0.0.0", "0"
433437
cmd.Env = append(cmd.Env, fmt.Sprintf("SSH_CLIENT=%s %s %s", srcAddr, srcPort, dstPort))
434438
cmd.Env = append(cmd.Env, fmt.Sprintf("SSH_CONNECTION=%s %s %s %s", srcAddr, srcPort, dstAddr, dstPort))
435439

0 commit comments

Comments
 (0)