Fix ssh tunnel syntax

This commit is contained in:
Jose Gracia 2024-06-06 09:42:10 +02:00
parent 40645ed7ec
commit 2f325f46e2

View file

@ -17,14 +17,14 @@ Common use cases include:
- access to package registries for languages such as Golang, Rust, etc. - access to package registries for languages such as Golang, Rust, etc.
When following this guide, you will have to execute actions or command on Hawk, but also on your local workstation or laptop. For clarity, examples below will use prompts `local>` and `hawk>`, respectively. When following this guide, you will have to execute actions or commands on Hawk, but also on your local workstation or laptop. For clarity, examples below will use prompts `hawk>` and`local>`, respectively.
## Setting up a proxy with ssh ## Setting up a proxy with ssh
Please note, that there is numerous ways to set up proxies. However, HLRS only supports the method describe in the following. Please note, that there is numerous ways to set up proxies. However, HLRS only supports the method describe in the following.
Ssh allows to create reverse tunnels from Hawk back to your local machine. In addition, it can run a proxy, more specifically a SOCKS5 proxy, on the local end of this tunnel. SOCKS5 is a widely supported standard which allows many applications to use such proxies to connect to remote hosts. Ssh allows to create reverse tunnels from Hawk back to your local machine. In addition, it can run a proxy, more specifically a SOCKS5 proxy, on the end of this tunnel. SOCKS5 is a widely supported standard which allows many applications to use such proxies to connect to remote hosts.
Note however, that the tunnel is open on the remote side. Every user on Hawk will be able to use the tunnel and thus have a network connection to your local network. We strongly suggest to keep the tunnel open only when necessary. Note however, that the tunnel is open on the remote side. Every user on Hawk will be able to use the tunnel and thus have a network connection to your local network. We strongly suggest to keep the tunnel open only when necessary.
@ -32,10 +32,10 @@ Tunnels are associated to _ports_. In the following, you will have to specify a
Ok, let's do it. Ok, let's do it.
The following will open a regular ssh connection to Hawk. In addition, the argument `-D $MY_PROXY_PORT` will establish a reverse dynamic port forwarding tunnel which opens at port `$MY_PROXY_PORT` on the Hawk side and connects to a SOCKS5 proxy on your local side. The following will open a regular ssh connection to Hawk. In addition, the argument `-R $MY_PROXY_PORT` will establish a reverse port forwarding tunnel which opens at port `$MY_PROXY_PORT` on the Hawk side and provides a SOCKS5 proxy.
```bash ```bash
local> MY_PROXY_PORT=XXXX # choose a port number between 10000 and 60000 local> MY_PROXY_PORT=XXXX # choose a port number between 10000 and 60000
local> ssh -D $MY_PROXY_PORT hawk.hww.hlrs.de local> ssh -R $MY_PROXY_PORT hawk.hww.hlrs.de
``` ```
The tunnel will remain open as long as the connection to Hawk is open. The tunnel will close as soon as your connection closes. Please note, that we do recommend to _not use_ command line arguments to keep the connection open in the background as you may loose track of open reverse tunnels. The tunnel will remain open as long as the connection to Hawk is open. The tunnel will close as soon as your connection closes. Please note, that we do recommend to _not use_ command line arguments to keep the connection open in the background as you may loose track of open reverse tunnels.
@ -60,6 +60,7 @@ hawk> curl ifconfig.me # timeout, no connection to internet
hawk> export https_proxy=socks5://localhost:$MY_PROXY_PORT # set proxy environment variables hawk> export https_proxy=socks5://localhost:$MY_PROXY_PORT # set proxy environment variables
hawk> export http_proxy=$https_proxy hawk> export http_proxy=$https_proxy
hawk> curl ifconfig.me hawk> curl ifconfig.me
hawk> # last command should show your IP address
hawk> # close terminal to close reverse tunnel when done hawk> # close terminal to close reverse tunnel when done
``` ```