summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/User.hs
diff options
context:
space:
mode:
authorJoey Hess2014-12-05 16:33:23 -0400
committerJoey Hess2014-12-05 16:33:23 -0400
commit527975dffec07458e25f100257ec70a3c826c20d (patch)
tree05bfb206b068f281ab0dfbd93efd3695f906475f /src/Propellor/Property/User.hs
parent2559b2348207ed9e914999e92fe9d26da0e1f5ad (diff)
hasSomePassword and hasPassword now check to make sure shadow passwords are enabled.
Diffstat (limited to 'src/Propellor/Property/User.hs')
-rw-r--r--src/Propellor/Property/User.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs
index ccb69b24..5c8e768c 100644
--- a/src/Propellor/Property/User.hs
+++ b/src/Propellor/Property/User.hs
@@ -44,13 +44,15 @@ hasPassword user = property (user ++ "has password") $ do
ensureProperty $ hasPassword' user (Context hostname)
hasPassword' :: UserName -> Context -> Property
-hasPassword' user context = withPrivData (Password user) context $ \getpassword ->
- property (user ++ " has password") $
- getpassword $ \password -> makeChange $
- withHandle StdinHandle createProcessSuccess
- (proc "chpasswd" []) $ \h -> do
- hPutStrLn h $ user ++ ":" ++ password
- hClose h
+hasPassword' user context = go `requires` shadowConfig True
+ where
+ go = withPrivData (Password user) context $ \getpassword ->
+ property (user ++ " has password") $
+ getpassword $ \password -> makeChange $
+ withHandle StdinHandle createProcessSuccess
+ (proc "chpasswd" []) $ \h -> do
+ hPutStrLn h $ user ++ ":" ++ password
+ hClose h
lockedPassword :: UserName -> Property
lockedPassword user = check (not <$> isLockedPassword user) $ cmdProperty "passwd"