-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for ssh remote port forwarding
This change adds support for a new type of ssh tunnel, the [remote port forwarding](https://www.ssh.com/ssh/tunneling/example#remote-forwarding). Other significant changes: * Adds a new TunnelType attribute to TunnelFlags so it can be passed to the Tunnel object, preparing it to support different types of port forwarding It also improves the description of `start local` command. * Hides how the `SSHChannel` objects are built under `tunnel.New`, opening room to create either ssh `local` or `remote` forwarding tunnels * Adds support for reading `RemoteForward` configuration from the ssh configuration file * Extends the ssh server implementation using for tests to handle "tcpip-forward" requests Partially implements #22.
- Loading branch information
David Pinheiro
committed
Aug 9, 2020
1 parent
905e590
commit b4239ad
Showing
18 changed files
with
492 additions
and
243 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
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cmd | ||
|
||
import ( | ||
"os" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var remoteCmd = &cobra.Command{ | ||
Use: "remote", | ||
Short: "Starts a ssh remote port forwarding tunnel", | ||
Long: `Remote Forwarding allows anyone to expose a service running locally to a remote machine. | ||
This could be particular useful for giving someone on the outside access to an internal web application, for example. | ||
Source endpoints are addresses on the jump server where clients can connect to access services running on the corresponding destination endpoints. | ||
Destination endpoints are addresses of services running on the same machine where mole is getting executed. | ||
`, | ||
Args: func(cmd *cobra.Command, args []string) error { | ||
tunnelFlags.TunnelType = "remote" | ||
return nil | ||
}, | ||
Run: func(cmd *cobra.Command, arg []string) { | ||
start("", tunnelFlags) | ||
}, | ||
} | ||
|
||
func init() { | ||
err := bindFlags(tunnelFlags, remoteCmd) | ||
if err != nil { | ||
log.WithError(err).Error("error parsing command line arguments") | ||
os.Exit(1) | ||
} | ||
|
||
startCmd.AddCommand(remoteCmd) | ||
} |
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
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
Oops, something went wrong.