diff options
| author | Joey Hess <joeyh@joeyh.name> | 2017-03-19 16:17:47 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2017-03-19 16:17:47 -0400 |
| commit | 1228fc958a948af83061190c60d44107ecb48cba (patch) | |
| tree | 7c1c201caa1051fc6e62689c6ef6e5320dceda05 /src | |
| parent | fed18bc60db2f262363cb4b802bb11ea6d881621 (diff) | |
| parent | 7d3537e2b5462880242bf3f7c4f7aa75f2727d15 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Property/List.hs | 7 | ||||
| -rw-r--r-- | src/Propellor/Property/Tor.hs | 13 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/Propellor/Property/List.hs b/src/Propellor/Property/List.hs index 568de00b..758e51ce 100644 --- a/src/Propellor/Property/List.hs +++ b/src/Propellor/Property/List.hs @@ -43,6 +43,13 @@ propertyList desc (Props ps) = -- | Combines a list of properties, resulting in one property that -- ensures each in turn. Stops if a property fails. +-- +-- > combineProperties "foo" $ props +-- > & bar +-- > & baz +-- +-- This is similar to using `mconcat` with a list of properties, +-- except it can combine together different types of properties. combineProperties :: SingI metatypes => Desc -> Props (MetaTypes metatypes) -> Property (MetaTypes metatypes) combineProperties desc (Props ps) = property desc (combineSatisfy cs NoChange) diff --git a/src/Propellor/Property/Tor.hs b/src/Propellor/Property/Tor.hs index 849c60d0..8794bc7f 100644 --- a/src/Propellor/Property/Tor.hs +++ b/src/Propellor/Property/Tor.hs @@ -53,13 +53,20 @@ named n = configured [("Nickname", n')] where n' = saneNickname n +-- | Configures tor with secret_id_key, ed25519_master_id_public_key, +-- and ed25519_master_id_secret_key from privdata. torPrivKey :: Context -> Property (HasInfo + DebianLike) -torPrivKey context = f `File.hasPrivContent` context - `onChange` File.ownerGroup f user (userGroup user) +torPrivKey context = mconcat (map go keyfiles) `onChange` restarted `requires` torPrivKeyDirExists where - f = torPrivKeyDir </> "secret_id_key" + keyfiles = map (torPrivKeyDir </>) + [ "secret_id_key" + , "ed25519_master_id_public_key" + , "ed25519_master_id_secret_key" + ] + go f = f `File.hasPrivContent` context + `onChange` File.ownerGroup f user (userGroup user) torPrivKeyDirExists :: Property DebianLike torPrivKeyDirExists = File.dirExists torPrivKeyDir |
