This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fleetctl: fixed incorrect "[email protected]" behavior
fixes: #1425
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,14 @@ import ( | |
type SSHForwardingClient struct { | ||
agentForwarding bool | ||
*gossh.Client | ||
agentForwardingEnabled bool | ||
} | ||
|
||
func (s *SSHForwardingClient) ForwardAgentAuthentication(session *gossh.Session) error { | ||
if s.agentForwarding { | ||
if s.agentForwarding && !s.agentForwardingEnabled { | ||
// We are allowed to send "[email protected]" request only once per channel | ||
// otherwise ssh daemon replies with the "SSH2_MSG_CHANNEL_FAILURE 100" | ||
s.agentForwardingEnabled = true | ||
return gosshagent.RequestAgentForwarding(session) | ||
} | ||
return nil | ||
|
@@ -50,7 +54,7 @@ func newSSHForwardingClient(client *gossh.Client, agentForwarding bool) (*SSHFor | |
return nil, err | ||
} | ||
|
||
return &SSHForwardingClient{agentForwarding, client}, nil | ||
return &SSHForwardingClient{agentForwarding, client, false}, nil | ||
} | ||
|
||
// makeSession initializes a gossh.Session connected to the invoking process's stdout/stderr/stdout. | ||
|