summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Ssh.hs
diff options
context:
space:
mode:
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