propellor spin
This commit is contained in:
parent
570bcde9ed
commit
09e9b793dd
|
@ -81,6 +81,7 @@ setupPrimary zonefile mknamedconffile hosts domain soa rs =
|
||||||
(addNamedConf conf)
|
(addNamedConf conf)
|
||||||
satisfy = do
|
satisfy = do
|
||||||
sshfps <- concat <$> mapM genSSHFP indomain
|
sshfps <- concat <$> mapM genSSHFP indomain
|
||||||
|
liftIO $ print sshfps
|
||||||
let zone = partialzone
|
let zone = partialzone
|
||||||
{ zHosts = zHosts partialzone ++ rs ++ sshfps }
|
{ zHosts = zHosts partialzone ++ rs ++ sshfps }
|
||||||
ifM (liftIO $ needupdate zone)
|
ifM (liftIO $ needupdate zone)
|
||||||
|
@ -426,13 +427,16 @@ genSSHFP h = map (\r -> (AbsDomain hostname, r)) . concat <$> (gen =<< get)
|
||||||
where
|
where
|
||||||
hostname = hostName h
|
hostname = hostName h
|
||||||
get = fromHost [h] hostname Ssh.getPubKey
|
get = fromHost [h] hostname Ssh.getPubKey
|
||||||
gen = liftIO . mapM go . M.elems . fromMaybe M.empty
|
gen = liftIO . mapM genSSHFP' . M.elems . fromMaybe M.empty
|
||||||
go pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
|
|
||||||
|
genSSHFP' :: String -> IO [Record]
|
||||||
|
genSSHFP' pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
|
||||||
hPutStrLn tmph pubkey
|
hPutStrLn tmph pubkey
|
||||||
hClose tmph
|
hClose tmph
|
||||||
s <- catchDefaultIO "" $
|
s <- catchDefaultIO "" $
|
||||||
readProcess "ssh-keygen" ["-r", "dummy", "-f", tmp]
|
readProcess "ssh-keygen" ["-r", "dummy", "-f", tmp]
|
||||||
return $ mapMaybe (parse . words) $ lines s
|
return $ mapMaybe (parse . words) $ lines s
|
||||||
|
where
|
||||||
parse ("dummy":"IN":"SSHFP":x:y:s:[]) = do
|
parse ("dummy":"IN":"SSHFP":x:y:s:[]) = do
|
||||||
x' <- readish x
|
x' <- readish x
|
||||||
y' <- readish y
|
y' <- readish y
|
||||||
|
|
Loading…
Reference in New Issue