Move dns settings to separate tor config file

This commit is contained in:
Bob Mottram 2018-04-20 11:41:20 +01:00
parent 62b5592b58
commit 5e80ab9df4
2 changed files with 11 additions and 20 deletions

View File

@ -320,26 +320,9 @@ function configure_email_onion {
echo " hosts_avoid_tls = *"; echo " hosts_avoid_tls = *";
echo " socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/050_exim4-config_onion_relay echo " socks_proxy = 127.0.0.1 port=9050"; } > /etc/exim4/conf.d/transport/050_exim4-config_onion_relay
if ! grep -q "AutomapHostsOnResolve" /etc/tor/torrc; then { echo 'DNSPort 5300';
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc echo 'DNSListenAddress 127.0.0.1';
else echo 'AutomapHostsOnResolve 1'; } > /etc/torrc.d/dns
sed -i 's|#AutomapHostsOnResolve.*|AutomapHostsOnResolve 1|g' /etc/tor/torrc
sed -i 's|AutomapHostsOnResolve.*|AutomapHostsOnResolve 1|g' /etc/tor/torrc
fi
if ! grep -q "DNSPort " /etc/tor/torrc; then
echo 'DNSPort 5300' >> /etc/tor/torrc
else
sed -i 's|#DNSPort .*|DNSPort 5300|g' /etc/tor/torrc
sed -i 's|DNSPort .*|DNSPort 5300|g' /etc/tor/torrc
fi
if ! grep -q "DNSListenAddress" /etc/tor/torrc; then
echo 'DNSListenAddress 127.0.0.1' >> /etc/tor/torrc
else
sed -i 's|#DNSListenAddress.*|DNSListenAddress 127.0.0.1|g' /etc/tor/torrc
sed -i 's|DNSListenAddress.*|DNSListenAddress 127.0.0.1|g' /etc/tor/torrc
fi
update-exim4.conf.template -r update-exim4.conf.template -r
update-exim4.conf update-exim4.conf

View File

@ -53,6 +53,14 @@ function torrc_migrate {
echo "%include /etc/torrc.d" >> /etc/tor/torrc echo "%include /etc/torrc.d" >> /etc/tor/torrc
fi fi
{ echo 'DNSPort 5300';
echo 'DNSListenAddress 127.0.0.1';
echo 'AutomapHostsOnResolve 1'; } > /etc/torrc.d/dns
sed -i '/DNSPort 5300/d' /etc/tor/torrc
sed -i '/DNSListenAddress 127.0.0./d' /etc/tor/torrc
sed -i '/AutomapHostsOnResolve 1/d' /etc/tor/torrc
systemctl restart tor systemctl restart tor
} }