Tidying
This commit is contained in:
parent
c92d203a94
commit
d441d19470
|
@ -28,6 +28,11 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# 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 {
|
function onion_service_exists {
|
||||||
onion_service_name="$1"
|
onion_service_name="$1"
|
||||||
|
|
||||||
|
@ -57,8 +62,8 @@ function wait_for_onion_service {
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
wait_for_onion_service_base ${onion_service_name}
|
||||||
|
|
||||||
if [ $(onion_service_exists ${onion_service_name}) == "0" ]; then
|
if [ $(onion_service_exists ${onion_service_name}) == "0" ]; then
|
||||||
# reload and try a second time
|
# try a second time
|
||||||
systemctl reload tor
|
onion_update
|
||||||
wait_for_onion_service_base ${onion_service_name}
|
wait_for_onion_service_base ${onion_service_name}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -81,7 +86,7 @@ function remove_onion_service {
|
||||||
shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
|
shred -zu /var/lib/tor/hidden_service_${onion_service_name}/*
|
||||||
rm -rf /var/lib/tor/hidden_service_${onion_service_name}
|
rm -rf /var/lib/tor/hidden_service_${onion_service_name}
|
||||||
fi
|
fi
|
||||||
systemctl reload tor
|
onion_update
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_onion_service {
|
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
|
echo "HiddenServicePort ${onion_service_port_from} 127.0.0.1:${onion_service_port_to}" >> /etc/tor/torrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl reload tor
|
onion_update
|
||||||
|
|
||||||
function_check wait_for_onion_service
|
function_check wait_for_onion_service
|
||||||
wait_for_onion_service ${onion_service_name}
|
wait_for_onion_service ${onion_service_name}
|
||||||
|
@ -252,7 +257,7 @@ function resolve_dns_via_tor {
|
||||||
echo 'DNSPort 53' >> /etc/tor/torrc
|
echo 'DNSPort 53' >> /etc/tor/torrc
|
||||||
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
|
echo 'AutomapHostsOnResolve 1' >> /etc/tor/torrc
|
||||||
echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
|
echo 'AutomapHostsSuffixes .exit,.onion' >> /etc/tor/torrc
|
||||||
systemctl reload tor
|
onion_update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# don't change resolv.conf
|
# don't change resolv.conf
|
||||||
|
|
Loading…
Reference in New Issue