Skip to content

devlush/reachback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

SSH Reachback

Motivation

Allow access from a remote host to files on the origin host without a lot of extra commands. Http protocol would be nice because of its ubiquitous nature and simplicity. The web server traffic should be transported inside an ssh tunnel and made available only from the remote host. A concept using ssh control master sockets is proposed for flexibility and portability across different deployment scenarios.

Behavior

A single directory on the origin host is made accessible via http through a reverse ssh tunnel. When sshrb is invoked, a small python web server started on the origin host binds to a randomly selected port. An ssh tunnel is established which forwards traffic from an arbitrarily selected port on the remote host to the randomly selected web server port on the origin host. User applications on the remote host can now securely access the web server running on the origin host. Upon exiting the ssh session, sshrb terminates the web server and tears down the ssh tunnel.

Usage

[titus@origin ~]$ ./sshrb [email protected]

/var/tmp/basecamp ~~~~~~ http://localhost:54937

[titus@remote ~]$ wget http://localhost:54937
[titus@remote ~]$ exit

Features

  • doesn't require root permissions
  • syntax is interoperable with ssh
  • arbitrarily chooses an open port for http on the origin host
  • attempts IPv6 first, then falls back to IPv4
  • graceful session cleanup

Precedent

You can manually replicate sshrb behavior:

[titus@origin ~]$ echo "Hello World!" > ./index.html
[titus@origin ~]$ python -m SimpleHTTPServer 8080 &
[titus@origin ~]$ ssh -R 0:localhost:8080 [email protected]
54937

[titus@remote ~]$ wget http://localhost:54937
[titus@remote ~]$ exit

[titus@origin ~]$ pkill python

Note: This method compels python to listen on all interfaces

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages