Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit ea415ad

Browse files
committed
fleetctl: fixed incorrect "[email protected]" behavior
fixes: #1425
1 parent ece468e commit ea415ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ssh/ssh.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ import (
3030
type SSHForwardingClient struct {
3131
agentForwarding bool
3232
*gossh.Client
33+
agentForwardingEnabled bool
3334
}
3435

3536
func (s *SSHForwardingClient) ForwardAgentAuthentication(session *gossh.Session) error {
36-
if s.agentForwarding {
37+
if s.agentForwarding && !s.agentForwardingEnabled {
38+
// We are allowed to send "[email protected]" request only once per channel
39+
// otherwise ssh daemon replies with the "SSH2_MSG_CHANNEL_FAILURE 100"
40+
s.agentForwardingEnabled = true
3741
return gosshagent.RequestAgentForwarding(session)
3842
}
3943
return nil
@@ -50,7 +54,7 @@ func newSSHForwardingClient(client *gossh.Client, agentForwarding bool) (*SSHFor
5054
return nil, err
5155
}
5256

53-
return &SSHForwardingClient{agentForwarding, client}, nil
57+
return &SSHForwardingClient{agentForwarding, client, false}, nil
5458
}
5559

5660
// makeSession initializes a gossh.Session connected to the invoking process's stdout/stderr/stdout.

0 commit comments

Comments
 (0)