# sshpppd - script to automate the pppd-over-ssh vpn # in the UCLA VPN class LAN # # Runs from vpnb (100.1.1.1) against vpnd (200.2.2.2) # result: sets a bilateral route between them, # confers addresses 10.1.1.1 on vpnb's end, 10.2.2.2 on vpnd's # traffic through this route is dynamically encrypted # # Comparable to script of the Arpad Magosanyi's 1997 vpn HowTo clear # ESTABLISH CONNECTION echo "Making counterpart run his pppd and noting our local pseudo-terminal" /usr/sbin/pty-redir /usr/bin/ssh -t -l slave 200.2.2.2 /usr/sbin/pppd > /tmp/device echo "(It\'s `cat /tmp/device`)";echo sleep 5 echo "Running our local pppd against his, through that pseudo-terminal";echo pppd `cat /tmp/device` 10.1.1.1:10.2.2.2 sleep 2 # ESTABLISH ROUTING echo "Setting up a route from here through him to the net behind him";echo route add -net 192.168.2.0 netmask 255.255.255.0 gw 10.2.2.2 sleep 2 echo "Making him set up a route from there though us to the net behind us";echo /usr/bin/ssh -t -l root 200.2.2.2 route add -net 192.168.1.0 netmask 255.255.255.0 gw 10.1.1.1 # OUTCOME INFORMATION echo "Our routing table:" route -n echo -e "\nHis routing table:" /usr/bin/ssh -t -l root 200.2.2.2 route -n