summaryrefslogtreecommitdiff
path: root/src/Propellor
diff options
context:
space:
mode:
authorJoey Hess2015-01-04 19:43:06 -0400
committerJoey Hess2015-01-04 19:43:06 -0400
commit09e9b793dd1c76264a744ca32fde2b7c21d36748 (patch)
treec30a3f5aec81020b25690686e3bb87bd0048ea55 /src/Propellor
parent570bcde9eddf8f4c6639a8c27dbe869f3bc31f4a (diff)
propellor spin
Diffstat (limited to 'src/Propellor')
-rw-r--r--src/Propellor/Property/Dns.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Propellor/Property/Dns.hs b/src/Propellor/Property/Dns.hs
index 63752590..1c1f64ba 100644
--- a/src/Propellor/Property/Dns.hs
+++ b/src/Propellor/Property/Dns.hs
@@ -81,6 +81,7 @@ setupPrimary zonefile mknamedconffile hosts domain soa rs =
(addNamedConf conf)
satisfy = do
sshfps <- concat <$> mapM genSSHFP indomain
+ liftIO $ print sshfps
let zone = partialzone
{ zHosts = zHosts partialzone ++ rs ++ sshfps }
ifM (liftIO $ needupdate zone)
@@ -425,14 +426,17 @@ genSSHFP :: Host -> Propellor [(BindDomain, Record)]
genSSHFP h = map (\r -> (AbsDomain hostname, r)) . concat <$> (gen =<< get)
where
hostname = hostName h
- get = fromHost [h] hostname Ssh.getPubKey
- gen = liftIO . mapM go . M.elems . fromMaybe M.empty
- go pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
+ get = fromHost [h] hostname Ssh.getPubKey
+ gen = liftIO . mapM genSSHFP' . M.elems . fromMaybe M.empty
+
+genSSHFP' :: String -> IO [Record]
+genSSHFP' pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
hPutStrLn tmph pubkey
hClose tmph
s <- catchDefaultIO "" $
readProcess "ssh-keygen" ["-r", "dummy", "-f", tmp]
return $ mapMaybe (parse . words) $ lines s
+ where
parse ("dummy":"IN":"SSHFP":x:y:s:[]) = do
x' <- readish x
y' <- readish y