summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Tor.hs
diff options
context:
space:
mode:
authorJoey Hess2016-03-18 23:05:09 -0400
committerJoey Hess2016-03-18 23:05:09 -0400
commitae5208110ea48e747112e47478d430ea93cd4e15 (patch)
tree544b6c315911c0fc99fc3e5fd49e6629c1cac058 /src/Propellor/Property/Tor.hs
parent372e61c832664c109e22dc163ee37230195539f0 (diff)
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.
Diffstat (limited to 'src/Propellor/Property/Tor.hs')
-rw-r--r--src/Propellor/Property/Tor.hs16
1 files changed, 13 insertions, 3 deletions
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.