From ae5208110ea48e747112e47478d430ea93cd4e15 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 18 Mar 2016 23:05:09 -0400 Subject: Tor.named: Fix bug that sometimes caused the property to fail the first time, though retrying succeeded. May have only been a problem on debian stable, the /var/lib/tor/keys/ was not created by installing the package. --- debian/changelog | 2 ++ src/Propellor/Property/Tor.hs | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index a8fb5ecc..b3f19cbb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -26,6 +26,8 @@ propellor (2.17.0) UNRELEASED; urgency=medium need to make changes every time. * Speed up propellor's build of itself, by asking cabal to only build the propellor-config binary and not all the libraries. + * Tor.named: Fix bug that sometimes caused the property to fail the first + time, though retrying succeeded. -- Joey Hess Mon, 29 Feb 2016 17:58:08 -0400 diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index e5fcdaa4..f7cb6c89 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -54,10 +54,20 @@ named n = configured [("Nickname", n')] torPrivKey :: Context -> Property HasInfo torPrivKey context = f `File.hasPrivContent` context `onChange` File.ownerGroup f user (userGroup user) - -- install tor first, so the directory exists with right perms - `requires` Apt.installed ["tor"] + `requires` torPrivKeyDirExists where - f = "/var/lib/tor/keys/secret_id_key" + f = torPrivKeyDir "secret_id_key" + +torPrivKeyDirExists :: Property NoInfo +torPrivKeyDirExists = File.dirExists torPrivKeyDir + `onChange` setperms + `requires` installed + where + setperms = File.ownerGroup torPrivKeyDir user (userGroup user) + `before` File.mode torPrivKeyDir 0O2700 + +torPrivKeyDir :: FilePath +torPrivKeyDir = "/var/lib/tor/keys" -- | A tor server (bridge, relay, or exit) -- Don't use if you just want to run tor for personal use. -- cgit v1.3-2-g0d8e