Commit 2abb63d1 authored by Willi Rath's avatar Willi Rath

Merge branch '14-add-tunneling-from-windows' into 'master'

Resolve "Generalize tunneling script"

Closes #14

See merge request !31
parents 9e32b490 e50dccb1
......@@ -135,6 +135,13 @@ And run it to connect to `host.example.com`:
Note that these steps will only work, if `host.example.com` (or whatever the real address of the remote computer) is a known host in `.ssh/known_hosts`. (To test this, simply create an SSH connection to `host.example.com`, if it is not yet a known host, you will be asked whether to continue and if you do, `host.example.com` will be added to `.ssh/known_hosts`.)
### Wrapped in a script on Windows
First, make sure to have `Git bash` installed. You can obtain it by installing <https://gitforwindows.org/>. (Note that you don't really need Git for all the following, but we'll use it to get a fully functional Bash on Windows.)
Then, follow the steps above but replace `run_chromium_through_ssh_tunnel.sh` by `run_chromium_through_ssh_tunnel_WINDOWS.sh`.
## Appendix: Trouble Shooting
- If you get `ImportError: [...]: version GLIBC_[...] not found` errors on relatively old machines, make sure to priorize the `defaults` channel over `conda-forge`. This is done by specifying `-c defaults` **before** `-c conda-forge` in `conda install` or `conda create` commands.
......
......@@ -45,6 +45,6 @@ tmp_user_data_dir="/tmp/chromium_user_data_$(date +%s%N)"
"${browser}" \
--new-window --no-first-run \
--user-data-dir="${tmp_user_data_dir}" \
--proxy-bypass-list="<-loopback>;${add_proxy_bypass}" \
--proxy-bypass-list="<-loopback>;${add_proxy_bypass}" \
--proxy-server="socks5://localhost:${socks_5_port}" \
${URL}
#!/bin/bash
# check inputs and print USAGE message
if [ $# -lt 1 ]; then
echo "USAGE: " $0 "<tunnel-host> [URL]"
echo "where <tunnel-host> can be of the form user@host."
echo ""
exit
fi
# read tunnel host and print info to screen
tunnel_host=$1
echo will route traffic through ${tunnel_host}
# read URL
URL=$2
# find free port
socks_5_port=54321
echo using port $socks_5_port
# Open socks5 proxy which will close after 15 Seconds if the tunnel is not
# used. Extension of sleep time necessary?
ssh -f -D ${socks_5_port} ${tunnel_host} sleep 60
# cycle through possible browsers
browser=$(
[ -e /c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe ] \
&& { echo '/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'; return; }
)
# Proxy bypass list (this will make sure certain domains are _not_ contacted
# through the proxy):
add_proxy_bypass=$(
echo {'*.',}{google.,googleapis.}{com,fr,de} '*.gvt1.com' '*.gstatic.com' \
| tr '[:blank:]' '\n' | paste -s -d ';' -)
echo "Won't use proxy for any of:" ${add_proxy_bypass}
"${browser}" \
--new-window --no-first-run \
--proxy-bypass-list="<-loopback>;${add_proxy_bypass}" \
--proxy-server="socks5://localhost:${socks_5_port}" \
${URL}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment