Skip to content

bnm3k/ssh_tunnel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SSH Tunnel

Implements SSH Tunneling via Local Port forwarding. It forwards a connection from the client to the SSH server host, which then forwards to the destination host port.

Usage

> ssh_tunnel  --help
Usage of ./ssh_tunnel:
  -i, --identity_file string   key file (default "/home/bnm/.ssh/id_ed25519")
  -l, --local_port uint16      local port. Defaults to 0 ie random port is picked
  -r, --remote_port uint16     remote port
  -s, --ssh string             the ssh endpoint (user and address) with the format user@host:port. Defaults is 22

Suppose you have an SSH server running at address 1.2.3.4 as user admin. At the server, you've got a service that's running at localhost:8000 that you want to connect to via SSH port forwarding:

For example, at the server, run the following

nc -lvk 8000

At your client, start ssh_tunnel. It will listen for local connections at localhost:9000:

ssh_tunnel -s admin@1.2.3.4 -i ~/.ssh/id_ed25519 -l 9000 -r 8000

You can then connect to the remote service:

nc -N localhost 9000

Build

make build

Install

make install

TODO

  • Validate server's host key

Credits

About

CLI tool for SSH Tunneling via local port forwarding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published