summaryrefslogtreecommitdiff
path: root/Propellor/Property/Ssh.hs
diff options
context:
space:
mode:
authorJoey Hess2014-04-13 03:49:24 -0400
committerJoey Hess2014-04-13 03:49:24 -0400
commit622a3d8a931979deec838f06f7fb0311adf40df6 (patch)
tree2e0a325fe7ad5781deac663a600f2a9c24e35873 /Propellor/Property/Ssh.hs
parentfe939677adf9fa7bd8311fa437c757d91b3abae6 (diff)
propellor spin
Diffstat (limited to 'Propellor/Property/Ssh.hs')
-rw-r--r--Propellor/Property/Ssh.hs7
1 files changed, 5 insertions, 2 deletions
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.