propellor spin
This commit is contained in:
parent
8ac335a085
commit
570bcde9ed
|
@ -39,6 +39,9 @@ import Data.List
|
||||||
-- Will cause that hostmame and its alias to appear in the zone file,
|
-- Will cause that hostmame and its alias to appear in the zone file,
|
||||||
-- with the configured IP address.
|
-- with the configured IP address.
|
||||||
--
|
--
|
||||||
|
-- Also, if a host has a ssh public key configured, a SSHFP record will
|
||||||
|
-- be automatically generated for it.
|
||||||
|
--
|
||||||
-- The [(BindDomain, Record)] list can be used for additional records
|
-- The [(BindDomain, Record)] list can be used for additional records
|
||||||
-- that cannot be configured elsewhere. This often includes NS records,
|
-- that cannot be configured elsewhere. This often includes NS records,
|
||||||
-- TXT records and perhaps CNAMEs pointing at hosts that propellor does
|
-- TXT records and perhaps CNAMEs pointing at hosts that propellor does
|
||||||
|
@ -77,8 +80,7 @@ setupPrimary zonefile mknamedconffile hosts domain soa rs =
|
||||||
baseprop = Property ("dns primary for " ++ domain) satisfy
|
baseprop = Property ("dns primary for " ++ domain) satisfy
|
||||||
(addNamedConf conf)
|
(addNamedConf conf)
|
||||||
satisfy = do
|
satisfy = do
|
||||||
sshfps <- zip (repeat (AbsDomain domain)) . concat
|
sshfps <- concat <$> mapM genSSHFP indomain
|
||||||
<$> mapM genSSHFP indomain
|
|
||||||
let zone = partialzone
|
let zone = partialzone
|
||||||
{ zHosts = zHosts partialzone ++ rs ++ sshfps }
|
{ zHosts = zHosts partialzone ++ rs ++ sshfps }
|
||||||
ifM (liftIO $ needupdate zone)
|
ifM (liftIO $ needupdate zone)
|
||||||
|
@ -419,10 +421,11 @@ type WarningMessage = String
|
||||||
-- ssh public keys.
|
-- ssh public keys.
|
||||||
--
|
--
|
||||||
-- This is done using ssh-keygen, so sadly needs IO.
|
-- This is done using ssh-keygen, so sadly needs IO.
|
||||||
genSSHFP :: Host -> Propellor [Record]
|
genSSHFP :: Host -> Propellor [(BindDomain, Record)]
|
||||||
genSSHFP h = concat <$> (gen =<< get)
|
genSSHFP h = map (\r -> (AbsDomain hostname, r)) . concat <$> (gen =<< get)
|
||||||
where
|
where
|
||||||
get = fromHost [h] (hostName h) Ssh.getPubKey
|
hostname = hostName h
|
||||||
|
get = fromHost [h] hostname Ssh.getPubKey
|
||||||
gen = liftIO . mapM go . M.elems . fromMaybe M.empty
|
gen = liftIO . mapM go . M.elems . fromMaybe M.empty
|
||||||
go pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
|
go pubkey = withTmpFile "sshfp" $ \tmp tmph -> do
|
||||||
hPutStrLn tmph pubkey
|
hPutStrLn tmph pubkey
|
||||||
|
|
Loading…
Reference in New Issue