summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Ssh.hs
diff options
context:
space:
mode:
authorJoey Hess2015-04-23 11:58:37 -0400
committerJoey Hess2015-04-23 11:58:37 -0400
commit7964ed7caf49c2ad0a75490e7fd2dfb9ef7c3043 (patch)
tree79a0aa78fcb1013cea8352712713b53cad3c6474 /src/Propellor/Property/Ssh.hs
parent89b6629464b6dbd27e8393181421e0089ae5f5f4 (diff)
propellor spin
Diffstat (limited to 'src/Propellor/Property/Ssh.hs')
-rw-r--r--src/Propellor/Property/Ssh.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Propellor/Property/Ssh.hs b/src/Propellor/Property/Ssh.hs
index 236016ff..37e65728 100644
--- a/src/Propellor/Property/Ssh.hs
+++ b/src/Propellor/Property/Ssh.hs
@@ -4,6 +4,7 @@ module Propellor.Property.Ssh (
setSshdConfig,
permitRootLogin,
passwordAuthentication,
+ noPasswords,
hasAuthorizedKeys,
authorizedKey,
restarted,
@@ -54,6 +55,14 @@ permitRootLogin = setSshdConfig "PermitRootLogin"
passwordAuthentication :: Bool -> Property NoInfo
passwordAuthentication = setSshdConfig "PasswordAuthentication"
+-- | Configure ssh to not allow password logins.
+--
+-- To prevent lock-out, this is done only once root's
+-- authorized_keys is in place.
+noPasswords :: Property NoInfo
+noPasswords = check (hasAuthorizedKeys (User "root")) $
+ passwordAuthentication False
+
dotDir :: User -> IO FilePath
dotDir user = do
h <- homedir user