proxy_role/templates/Debian/Gateway/etc/rc.local

23 lines
627 B
Bash

#!/bin/sh
setfont /usr/share/consolefonts/Lat15-TerminusBold22x11.psf.gz
echo nameserver 127.0.0.1> /etc/resolv.conf
IP=`ifconfig eth0 | grep inet | sed -e 's/.*inet //' -e 's/ .*//'`
[ $? -eq 0 ] || return 1$?
[ -n "$IP" ] || return 2$?
if ! iptables-save | grep -q 'iptables -A INPUT -i eth0 -p udp -m udp --dport 9053 -j ACCEPT' ; then
iptables -D INPUT -j DROP
iptables -A INPUT -i eth0 -p udp -m udp --dport 9053 -j ACCEPT
iptables -A INPUT -j DROP
fi
ps ax | grep -q 'su -c tor -s /bin/sh debian-tor' || \
sh /usr/local/bin/proxy_whonix_tor_start.bash
dig @$IP -p 9053 -b $IP google.com
exit 0