Add dynamic-ssh-forwarding.md
This commit is contained in:
parent
766576abee
commit
0b1ff75233
36
networking/dynamic-ssh-forwarding.md
Normal file
36
networking/dynamic-ssh-forwarding.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
## Set up port forwarding
|
||||||
|
|
||||||
|
1. Set up port forwarding
|
||||||
|
```bash
|
||||||
|
$ ssh -D 8080 -N ubuntu@mercurial-manfifold.eu
|
||||||
|
```
|
||||||
|
2. Try out connection
|
||||||
|
```bash
|
||||||
|
$ curl --socks5 127.0.0.1:8080 http://example.com
|
||||||
|
```
|
||||||
|
|
||||||
|
## Set system-wide proxy configuration
|
||||||
|
|
||||||
|
1. Create `/etc/profile.d/proxy.sh` with the following content:
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -f "/etc/proxy-enabled" ]; then
|
||||||
|
export http_proxy="127.0.0.1:8080"
|
||||||
|
export https_proxy="127.0.0.1:8080"
|
||||||
|
export ftp_proxy="127.0.0.1:8080"
|
||||||
|
export HTTP_PROXY="127.0.0.1:8080"
|
||||||
|
export HTTPS_PROXY="127.0.0.1:8080"
|
||||||
|
export FTP_PROXY="127.0.0.1:8080"
|
||||||
|
export no_proxy="localhost,127.0.0.1,::1"
|
||||||
|
export NO_PROXY="localhost,127.0.0.1,::1"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
2. Add the following to `.zshrc`:
|
||||||
|
```bash
|
||||||
|
alias proxy-on='sudo touch /etc/proxy-enabled'
|
||||||
|
alias proxy-off='sudo rm -f /etc/proxy-enabled'
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that enabling or disabling the proxy only takes effect after logging out
|
||||||
|
and back in, as that is when `/etc/profile.d/proxy.sh` is sourced.
|
||||||
Loading…
Reference in New Issue
Block a user