Resolve dns via tor

This commit is contained in:
Bob Mottram 2016-02-27 18:28:23 +00:00
parent 625faf1eae
commit f7c0fc974a
1 changed files with 30 additions and 0 deletions

View File

@ -3850,6 +3850,35 @@ function install_tor {
echo 'install_tor' >> $COMPLETION_FILE 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 { function enable_ssh_via_onion {
if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
return return
@ -10380,6 +10409,7 @@ create_repo_sources
configure_dns configure_dns
initial_setup initial_setup
install_tor install_tor
resolve_dns_via_tor
enable_ssh_via_onion enable_ssh_via_onion
check_date check_date
install_dynamicdns install_dynamicdns