summaryrefslogtreecommitdiff
path: root/doc/forum
diff options
context:
space:
mode:
authordavid2020-06-11 01:23:28 +0000
committeradmin2020-06-11 01:23:28 +0000
commit8b643a66f7e6926eb12ee7e5b846c824955229a2 (patch)
treeb06205cf95899c1f21d7d97ab6cf275662bc6a5f /doc/forum
parenta44ad1eaf80add363c13bef079cf48bfd8488d64 (diff)
Added a comment: prototype
Diffstat (limited to 'doc/forum')
-rw-r--r--doc/forum/ssh__95__known__95__hosts/comment_1_9447b1382bf54e6f4620bae200a62238._comment27
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/forum/ssh__95__known__95__hosts/comment_1_9447b1382bf54e6f4620bae200a62238._comment b/doc/forum/ssh__95__known__95__hosts/comment_1_9447b1382bf54e6f4620bae200a62238._comment
new file mode 100644
index 00000000..eb52f671
--- /dev/null
+++ b/doc/forum/ssh__95__known__95__hosts/comment_1_9447b1382bf54e6f4620bae200a62238._comment
@@ -0,0 +1,27 @@
+[[!comment format=mdwn
+ username="david"
+ avatar="http://cdn.libravatar.org/avatar/22c2d800db6a7699139df604a67cb221"
+ subject="prototype"
+ date="2020-06-11T01:23:28Z"
+ content="""
+This seems to work for me. Obviously less hardcoding and code duplication would be nicer.
+
+[[!format haskell \"\"\"
+-- | Puts some host's ssh public key(s), as set using `hostPubKey`
+-- or `hostKey` into /etc/ssh/ssh_known_hosts
+sshKnownHost :: [Host] -> HostName -> Property UnixLike
+sshKnownHost hosts hn = property' desc $ \w ->
+ go w =<< knownHostLines hosts hn
+ where
+ desc = \" globally known ssh key for \" ++ hn
+
+ go _ [] = do
+ warningMessage $ \"no configured ssh host keys for \" ++ hn
+ return FailedChange
+ go w ls = do
+ f <- return \"/etc/ssh/ssh_known_hosts\"
+ ensureProperty w $
+ f `File.containsLines` ls
+ `requires` File.dirExists (takeDirectory f)
+\"\"\"]]
+"""]]