change Tor DNS port to 5300, as Tor is not run as root, hence it cannot bind to port 53. Also fix DNS redirecting

This commit is contained in:
bonanza123 2016-12-25 11:41:05 +01:00
parent 84f0b5959b
commit c0a686ef8e

View file

@ -23,7 +23,7 @@ from time import sleep
class TorIptables(object):
def __init__(self):
self.local_dnsport = "53" # DNSPort
self.local_dnsport = "5300" # DNSPort
self.virtual_net = "10.0.0.0/10" # VirtualAddrNetwork
self.local_loopback = "127.0.0.1" # Local loopback
self.non_tor_net = ["192.168.0.0/16", "172.16.0.0/12"]
@ -92,7 +92,7 @@ DNSPort %s
call(["iptables", "-t", "nat", "-A", "OUTPUT", "-m", "owner", "--uid-owner",
"%s" % self.tor_uid, "-j", "RETURN"])
call(["iptables", "-t", "nat", "-A", "OUTPUT", "-p", "udp", "--dport",
self.local_dnsport, "-j", "REDIRECT", "--to-ports", self.local_dnsport])
"53", "-j", "REDIRECT", "--to-ports", self.local_dnsport])
for net in self.non_tor:
call(["iptables", "-t", "nat", "-A", "OUTPUT", "-d", "%s" % net, "-j",