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