From 622a3d8a931979deec838f06f7fb0311adf40df6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Apr 2014 03:49:24 -0400 Subject: propellor spin --- Propellor/Property/Ssh.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Propellor') diff --git a/Propellor/Property/Ssh.hs b/Propellor/Property/Ssh.hs index ba23253d..2fc3c560 100644 --- a/Propellor/Property/Ssh.hs +++ b/Propellor/Property/Ssh.hs @@ -84,12 +84,15 @@ hostKey keytype = propertyList desc [ Property desc (install writeFile (SshPubKey keytype "") ".pub") , Property desc (install writeFileProtected (SshPrivKey keytype "") "") ] + `onChange` restartSshd where desc = "known ssh host key (" ++ fromKeyType keytype ++ ")" install writer p ext = withPrivData p $ \key -> do let f = "/etc/ssh/ssh_host_" ++ fromKeyType keytype ++ "_key" ++ ext - void $ liftIO $ writer f key - noChange + s <- liftIO $ readFileStrict f + if s == key + then noChange + else makeChange $ writer f key -- | Sets up a user with a ssh private key and public key pair -- from the site's PrivData. -- cgit v1.2.3