summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/User.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-04 17:11:15 -0400
committerJoey Hess2014-12-04 17:11:15 -0400
commitf1fd75c9ecee5f398a25488c73a541d4135887da (patch)
tree9801546d9d8960e7019c9cdc05624189bb5f2353 /src/Propellor/Property/User.hs
parentf78c2f16d1c93ee6fe2620916b7584d91d116723 (diff)
more work on OS takeover
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"