Tor Tunnel Convenience on OSX
Occasionally I use the Tor proxy for surfing. Since I don’t want to bog down my local internet connection which often is shared with others, I run a Tor middle node on a virtual server at some ISP. This way I can contribute to the Tor network all the time, even when I am not currently using Tor myself.
For connecting to my Tor node, I set up some small scripts to do all the plumbing for me. Simply fire up my tortunnel, and I’m ready to go. Switching Proxies on OSX is buried deep in a second level menu item in the network settings. I am using two little scripts to have the proxy switched on and off automatically.
#!/bin/bash
HOST=`host my.virtualserver.tld|awk '{print $4}'`
pon
sudo ssh -p24 username@$HOST -L localhost:8123:$HOST:8123 \
-L localhost:53:$HOST:53 -t 'tmux -c "/usr/local/bin/arm/arm"'
pof
Since I also redirect my DNS lookups I have to fetch the hostname of my own server before I switch on the proxy. I have dnsmasq running on my server. This allows me to filter some bogus name resolutions. Sure, the DNS lookups can be traced back to my server. Maybe I will funnel them tru Tor later.
The arm Script on my server shows nifty graphs and info about the health of my Tor node.
pon and pof are simple shellscripts which use the OSX networksetup tool to operate the proxy settings:
#!/bin/bash networksetup -setsecurewebproxystate Ethernet on networksetup -setwebproxystate Ethernet on networksetup -setsecurewebproxystate Airport on networksetup -setwebproxystate Airport on networksetup -setdnsservers Ethernet 127.0.0.1 echo "proxy is on"
#!/bin/bash networksetup -setsecurewebproxystate Ethernet off networksetup -setwebproxystate Ethernet off networksetup -setsecurewebproxystate Airport off networksetup -setwebproxystate Airport off etworksetup -setdnsservers Ethernet empty echo "proxy is off"
I use Safari for my Tor surfing since Safari uses the system wide proxy settings. Firefox uses its own settings. This way I can torsurf in parallel to normal surfing. Of course there are some proxy switching plugins for Firefox I could use, but since I usually keep a lot of tabs open and do my main surfing on FF I decided to use Safari as my anonymous Browser.
Private browsing can not be automatically be turned on per default in Safari, thus I am using a little Script to activate Safari and set it to private mode:
tell application "Safari" activate end tell tell application "System Events" tell process "Safari" tell menu bar 1 tell menu bar item "Safari" tell menu "Safari" click menu item "Private Browsing" end tell end tell end tell end tell end tell
If you are using a different system language, you will have to adjust the “Private Browsing” term into the approriate locale. Simply check the Safari menu.
The start page of Safari is set to the Tor Check website to see whether I am really using the Tor network.



