summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2016-09-29 09:51:46 +0200
committeranonym <anonym@riseup.net>2016-09-29 09:51:46 +0200
commitbe326a3495b147883ed9fb65d3e035ed3ffa586e (patch)
tree5d7b5523aa4133433c491aafc8808fbaf872b0f8
parentd8cc34b226c68fe74c1227a733e3c7d5aa016967 (diff)
Stop tor if down:ing the last network interface.bugfix/11290-tor-status-vs-onioncircuits
When Tails has booted without network, tor is not started. This change creates more consistency by making us return to that state when down:ing the last network interface, instead of entering a third state of "network is down, tor is running but obviously not working". Refs: #11290
-rwxr-xr-xconfig/chroot_local-includes/etc/NetworkManager/dispatcher.d/10-tor.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/config/chroot_local-includes/etc/NetworkManager/dispatcher.d/10-tor.sh b/config/chroot_local-includes/etc/NetworkManager/dispatcher.d/10-tor.sh
index e7bbfdf..7bfef53 100755
--- a/config/chroot_local-includes/etc/NetworkManager/dispatcher.d/10-tor.sh
+++ b/config/chroot_local-includes/etc/NetworkManager/dispatcher.d/10-tor.sh
@@ -3,6 +3,9 @@
# We don't start Tor automatically so *this* is the time
# when it is supposed to start.
+# Import get_all_ethernet_nics(), nic_is_up().
+. /usr/local/lib/tails-shell-library/hardware.sh
+
# Run only when the interface is not "lo":
if [ $1 = "lo" ]; then
exit 0
@@ -11,7 +14,13 @@ fi
if [ $2 = "up" ]; then
: # go on, that's what this script is for
elif [ "${2}" = "down" ]; then
+ for nic in $(get_all_ethernet_nics); do
+ if [ "${nic}" != "${current_nic}" ] && nic_is_up "${nic}"; then
+ exit 0
+ fi
+ done
systemctl --no-block stop tails-tor-has-bootstrapped.target
+ systemctl --no-block stop tor@default.service
exit 0
else
exit 0