-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support ssh agent forwarding and X11 forwarding over UDP
- Loading branch information
Showing
9 changed files
with
241 additions
and
52 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
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
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 |
---|---|---|
|
@@ -39,6 +39,9 @@ var ( | |
agentClient agent.ExtendedAgent | ||
) | ||
|
||
type agentRequest struct { | ||
} | ||
|
||
func getAgentAddr(args *sshArgs, param *sshParam) (string, error) { | ||
if addr := getOptionConfig(args, "IdentityAgent"); addr != "" { | ||
if strings.ToLower(addr) == "none" { | ||
|
@@ -85,12 +88,10 @@ func getAgentClient(args *sshArgs, param *sshParam) agent.ExtendedAgent { | |
return agentClient | ||
} | ||
|
||
const channelType = "[email protected]" | ||
|
||
func forwardToRemote(client sshClient, addr string) error { | ||
channels := client.HandleChannelOpen(channelType) | ||
channels := client.HandleChannelOpen(kAgentChannelType) | ||
if channels == nil { | ||
return fmt.Errorf("agent: already have handler for %s", channelType) | ||
return fmt.Errorf("agent: already have handler for %s", kAgentChannelType) | ||
} | ||
conn, err := dialAgent(addr) | ||
if err != nil { | ||
|
@@ -122,7 +123,7 @@ func forwardAgentRequest(channel ssh.Channel, addr string) { | |
} | ||
|
||
func requestAgentForwarding(session sshSession) error { | ||
ok, err := session.SendRequest("[email protected]", true, nil) | ||
ok, err := session.SendRequest(kAgentRequestName, true, nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
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
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
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
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 |
---|---|---|
|
@@ -33,6 +33,13 @@ import ( | |
"golang.org/x/crypto/ssh" | ||
) | ||
|
||
const ( | ||
kX11ChannelType = "x11" | ||
kX11RequestName = "x11-req" | ||
kAgentChannelType = "[email protected]" | ||
kAgentRequestName = "[email protected]" | ||
) | ||
|
||
type sshClient interface { | ||
Wait() error | ||
Close() error | ||
|
Oops, something went wrong.