This commit is contained in:
Bob Mottram 2016-10-18 10:13:20 +01:00
parent c92d203a94
commit d441d19470
1 changed files with 10 additions and 5 deletions

View File

@ -28,6 +28,11 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
function onion_update {
# update so that new onion services appear
systemctl reload tor
}
function onion_service_exists {
onion_service_name="$1"
@ -57,8 +62,8 @@ function wait_for_onion_service {
wait_for_onion_service_base ${onion_service_name}
if [ $(onion_service_exists ${onion_service_name}) == "0" ]; then
# reload and try a second time
systemctl reload tor
# try a second time
onion_update
wait_for_onion_service_base ${onion_service_name}
fi
}
@ -81,7 +86,7 @@ function remove_onion_service {
shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
rm -rf /var/lib/tor/hidden_service_${onion_service_name}
fi
systemctl reload tor
onion_update
}
function add_onion_service {
@ -103,7 +108,7 @@ function add_onion_service {
echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
fi
systemctl reload tor
onion_update
function_check wait_for_onion_service
wait_for_onion_service ${onion_service_name}
@ -252,7 +257,7 @@ function resolve_dns_via_tor {
echo 'DNSPort 53' >> /etc/tor/torrc
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
systemctl reload tor
onion_update
fi
# don't change resolv.conf