summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/User.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-05 16:23:07 -0400
committerJoey Hess2014-12-05 16:23:07 -0400
commitdbc76b1e5225a28b84efa14659ff1c0c1d5fc463 (patch)
tree1a3f95f33ded5798987ab02cd851d8ec7ea24cfa /src/Propellor/Property/User.hs
parenta380ea8390984afa28c2956fc9a6e011a1b93763 (diff)
parent2559b2348207ed9e914999e92fe9d26da0e1f5ad (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property/User.hs')
-rw-r--r--src/Propellor/Property/User.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs
index 434a92a3..ccb69b24 100644
--- a/src/Propellor/Property/User.hs
+++ b/src/Propellor/Property/User.hs
@@ -84,3 +84,15 @@ hasGroup user group' = check test $ cmdProperty "adduser"
`describe` unwords ["user", user, "in group", group']
where
test = not . elem group' . words <$> readProcess "groups" [user]
+
+-- | Controls whether shadow passwords are enabled or not.
+shadowConfig :: Bool -> Property
+shadowConfig True = check (not <$> shadowExists) $
+ cmdProperty "shadowconfig" ["on"]
+ `describe` "shadow passwords enabled"
+shadowConfig False = check shadowExists $
+ cmdProperty "shadowconfig" ["off"]
+ `describe` "shadow passwords disabled"
+
+shadowExists :: IO Bool
+shadowExists = doesFileExist "/etc/shadow"