diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-29 23:45:48 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-29 23:45:48 -0400 |
| commit | 0ab0216d0b400fae78a6a6916ef9f82ed31dc0fa (patch) | |
| tree | fd006abe430c43d6783482451b6b9626994be160 /Property/Ssh.hs | |
| parent | 0e1b587442fb78bcbf4886b53b85ab64b45215b0 (diff) | |
configure hostname etc
Diffstat (limited to 'Property/Ssh.hs')
| -rw-r--r-- | Property/Ssh.hs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Property/Ssh.hs b/Property/Ssh.hs index cca021a4..ce9c171b 100644 --- a/Property/Ssh.hs +++ b/Property/Ssh.hs @@ -38,4 +38,19 @@ hasAuthorizedKeys = go <=< homedir (readFile $ home </> ".ssh" </> "authorized_keys") restartSshd :: Property -restartSshd = CmdProperty "ssh restart" "service" [Param "sshd", Param "restart"] +restartSshd = cmdProperty "service" [Param "sshd", Param "restart"] + +{- Blow away existing host keys and make new ones. Use a flag + - file to prevent doing this more than once. -} +uniqueHostKeys :: Property +uniqueHostKeys = flagFile prop "/etc/ssh/.unique_host_keys" + `onChange` restartSshd + where + prop = IOProperty "ssh unique host keys" $ do + void $ boolSystem "sh" + [ Param "-c" + , Param "rm -f /etc/ssh/ssh_host_*" + ] + ensureProperty $ + cmdProperty "/var/lib/dpkg/info/openssh-server.postinst" + [Param "configure"] |
