#!/bin/sh # Prayishtar # http://freaknet.org/alpt/src/utils/prayishtar # # prayishtar: forwards all your Internet traffic over two secure SSH tunnels # or in other words: How to reach the Internet anonymously from a # hostile network # # ** Requirements ** # You need two trusted SSH servers, one with a BIG BIG upload # bandwidth and another normal one. We call the former `bigbwhost' and the # latter `myhome'. # You also need OpenSSH >= 4.3 on bost this localhost and on `myhome' # Be sure also to have the support for /dev/tun, iptables and LARTC. # # ** This is what we do ** # We forward all of our Internet traffic trough a SSH vpn created with # `myhome' and we use `bigbwhost' as a SSH proxy for applications which require # a big bandwidth (like browsers): # # All outgoing Internet traffic -> SSH VPN -> myhome -> INTERNET # # All outgoing http traffic -> SSH SOCKS proxy -> bigbwhost -> INTERNET # # ** TODO ** # Use Tor to create the SSH connections # # ** Usage ** # The first command: # # prayishtar myhomehost bigbwhost bighostuser # f.e.: # # prayishtar home.dyndns.org mybigserver.org foo # # You can also configure directly this script and launch it with no arguments: # # prayishtar # # 2) # In the browser we set a localhost:8080 SOCKS proxy, then leave the rest # untouched. # # 3) You are done! Cryptolized trough SSH juicy tunnels. Even you dns query # will be in this way " /tmp/prayishtar_default_gw ip route del default ip route replace default via $tuniphome dev tun2 echo "Setting iptables" # Do not send ssh traffic over the ssh tunnel ;) iptables -A POSTROUTING -t nat -j MASQUERADE -o ! lo iptables -A OUTPUT -t mangle -p tcp --dport 22 -j MARK --set-mark 0x71 ip rule add from all fwmark 0x71 lookup 213 ip route replace default via $myinsecuregw table 213 || die "Could not set default route" echo "Remember to set the localhost:8080 SOCKS proxy in your browser" echo "" echo "Creating SOCKS to $bighostuser@$bigbwhost" ssh -fnN $bigbwhostip -D 8080 -l $bighostuser || die "Could not set up the SOCKS proxy" echo "" echo "All done!"