#!/bin/bash ## Start Rstudio server in Firefox through an encrypted SSH tunnel ## Written Dec 15, 2014 ## Taha Ahmed # ssh port number PORT=9996 # matches the port set in firefox profile about:config # the firefox profile "rstudioserver" has been configured # using about:config to route all traffic (including DNS requests) # over the socks proxy # network.proxy.socks : 127.0.0.1 # network.proxy.socks_port : 9996 # network.proxy.socks.remote_dns : true # network.proxy.socks_version : 5 # network.proxy.type : 1 # network.proxy.no_proxies_on : localhost, 127.0.0.1 # -f forks the process into the background # when firefox stops using the tunnel, then # the ssh client exits (having completed the sleep command) # -N tells ssh that no commands will be sent (-f complains otherwise) #ssh -D $PORT -f luxor sleep 10; firefox -P "rstudioserver" "http://luxor.chepec.se/rstudio" # (the tunnel is setup using autossh in a startup application) # Notes: # proxy flag does not work in Chrome: # google-chrome --proxy-server="socks5://127.0.0.1:9995" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE 127.0.0.1" # but does work in Chromium, which unfortunately is not supported by Rstudio server # chromium-browser --proxy-server="socks5://127.0.0.1:9995" --host-resolver-rules="MAP * 0.0.0.0 , EXCLUDE 127.0.0.1" # See also: # http://askubuntu.com/questions/469582/how-do-i-set-up-a-local-socks-proxy-that-tunnels-traffic-through-ssh # http://kb.mozillazine.org/Command_line_arguments # http://www.chromium.org/developers/design-documents/network-stack/socks-proxy # http://www.g-loaded.eu/2006/11/24/auto-closing-ssh-tunnels/