summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/lib
diff options
context:
space:
mode:
authorsegfault <segfault@riseup.net>2019-07-20 21:44:15 +0200
committersegfault <segfault@riseup.net>2019-07-20 21:44:15 +0200
commitd9ae8bf8ad2109b7032383dc25e31cfcad92e08c (patch)
treebc122b40a584f76f308e56b77b11ba4db8208b76 /config/chroot_local-includes/lib
parent23863ff20b36b0c37e5c6e589502ff62a84e6c73 (diff)
Use BindsTo= and After= in tor-has-bootstrapped systemd units (refs: #16664)
Currently, if tor@default.service stops for some reason (either stopped manually or unexpectedly), tails-tor-has-boostrapped.target is still active. Using BindsTo= in conjunction with After= ensures that the unit is always stopped if the other unit (tor@default.service) is stopped. See https://www.freedesktop.org/software/systemd/man/systemd.unit.html#BindsTo= This allows us to simplify config/chroot_local-includes/usr/local/sbin/tor-has-bootstrapped, which would only have to check if tails-tor-has-bootstrapped.target is active. Or, we could get rid of this script altogether, because instead of calling the script, applications can just run /bin/systemctl --quiet is-active tails-tor-has-bootstrapped.target themselves.
Diffstat (limited to 'config/chroot_local-includes/lib')
-rw-r--r--config/chroot_local-includes/lib/systemd/system/tails-tor-has-bootstrapped.target10
-rw-r--r--config/chroot_local-includes/lib/systemd/system/tails-wait-until-tor-has-bootstrapped.service7
2 files changed, 8 insertions, 9 deletions
diff --git a/config/chroot_local-includes/lib/systemd/system/tails-tor-has-bootstrapped.target b/config/chroot_local-includes/lib/systemd/system/tails-tor-has-bootstrapped.target
index 0aca04f..e514116 100644
--- a/config/chroot_local-includes/lib/systemd/system/tails-tor-has-bootstrapped.target
+++ b/config/chroot_local-includes/lib/systemd/system/tails-tor-has-bootstrapped.target
@@ -1,10 +1,8 @@
[Unit]
-Description=Tor has bootstrapped
+Description=Tor has Bootstrapped
Documentation=https://tails.boum.org/contribute/design/
-Requires=graphical.target
-Conflicts=rescue.service rescue.target
-After=graphical.target rescue.service rescue.target
-AllowIsolate=yes
+After=tails-wait-until-tor-has-bootstrapped.service
+BindsTo=tails-wait-until-tor-has-bootstrapped.service
[Install]
-WantedBy=graphical.target
+WantedBy=tails-wait-until-tor-has-bootstrapped.service \ No newline at end of file
diff --git a/config/chroot_local-includes/lib/systemd/system/tails-wait-until-tor-has-bootstrapped.service b/config/chroot_local-includes/lib/systemd/system/tails-wait-until-tor-has-bootstrapped.service
index 64f2afd..0f4046d 100644
--- a/config/chroot_local-includes/lib/systemd/system/tails-wait-until-tor-has-bootstrapped.service
+++ b/config/chroot_local-includes/lib/systemd/system/tails-wait-until-tor-has-bootstrapped.service
@@ -1,11 +1,12 @@
[Unit]
-Description=Wait for Tor to Have Bootstrapped
+Description=Tor has Bootstrapped
Documentation=https://tails.boum.org/contribute/design/
After=tor@default.service
-Before=tails-tor-has-bootstrapped.target
+BindsTo=tor@default.service
[Service]
Type=oneshot
+RemainAfterExit=yes
User=debian-tor
ExecStart=/bin/sh -c '. /usr/local/lib/tails-shell-library/tor.sh ; \
while ! tor_is_working ; do \
@@ -19,4 +20,4 @@ ProtectHome=yes
ProtectSystem=full
[Install]
-WantedBy=tails-tor-has-bootstrapped.target
+WantedBy=tor@default.service \ No newline at end of file