From f7c0fc974a9d3268840187ea913d33b0f0ac3d16 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 27 Feb 2016 18:28:23 +0000 Subject: [PATCH] Resolve dns via tor --- src/freedombone | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/freedombone b/src/freedombone index 1fe359c2..42be28c7 100755 --- a/src/freedombone +++ b/src/freedombone @@ -3850,6 +3850,35 @@ function install_tor { echo 'install_tor' >> $COMPLETION_FILE } +function resolve_dns_via_tor { + if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then + return + fi + if grep -Fxq "resolve_dns_via_tor" $COMPLETION_FILE; then + return + fi + if [ ! -f /etc/tor/torrc ]; then + echo $'tor was not installed' + exit 52952 + fi + + # resolve DNS via tor + if ! grep 'DNSPort 53' /etc/tor/torrc; then + echo 'DNSPort 53' >> /etc/tor/torrc + echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc + echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc + systemctl restart tor + fi + + # don't change resolv.conf + sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf + + # point resolv.conf to tor + echo 'nameserver 127.0.0.1:53' > /etc/resolv.conf + + echo 'resolve_dns_via_tor' >> $COMPLETION_FILE +} + function enable_ssh_via_onion { if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then return @@ -10380,6 +10409,7 @@ create_repo_sources configure_dns initial_setup install_tor +resolve_dns_via_tor enable_ssh_via_onion check_date install_dynamicdns