summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2018-05-06 11:05:31 -0400
committerJoey Hess2018-05-06 11:05:31 -0400
commit65c50524b3ef6f461baad7d83a8b29581d06e93f (patch)
tree1bba25875d2d64a5726d2ebeddbf8bd19d80854f
parent44eac317e72df5c2b433527800a00315659a9d4f (diff)
parent7e67310cf3c9f5cb1ac1fd51582960883e9b1c34 (diff)
Merge remote-tracking branch 'felix/unbound' into joeyconfig
l---------config.hs2
-rw-r--r--doc/todo/factor_out_Grub.configured_for_any___47__etc__47__default_config/comment_1_5039acea906faba7a0b33094028a475f._comment12
-rw-r--r--privdata/relocate1
-rw-r--r--src/Propellor/Property/Unbound.hs66
4 files changed, 65 insertions, 16 deletions
diff --git a/config.hs b/config.hs
index 97d90636..ec313725 120000
--- a/config.hs
+++ b/config.hs
@@ -1 +1 @@
-joeyconfig.hs \ No newline at end of file
+config-simple.hs \ No newline at end of file
diff --git a/doc/todo/factor_out_Grub.configured_for_any___47__etc__47__default_config/comment_1_5039acea906faba7a0b33094028a475f._comment b/doc/todo/factor_out_Grub.configured_for_any___47__etc__47__default_config/comment_1_5039acea906faba7a0b33094028a475f._comment
new file mode 100644
index 00000000..b4b924ac
--- /dev/null
+++ b/doc/todo/factor_out_Grub.configured_for_any___47__etc__47__default_config/comment_1_5039acea906faba7a0b33094028a475f._comment
@@ -0,0 +1,12 @@
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 1"""
+ date="2018-05-03T16:46:45Z"
+ content="""
+Agreed on all points, also there are some
+`File.containsLine` properties for /etc/default files elsewhere that
+don't necessarily work correctly if a later line changes the value,
+that could be converted to use this new property.
+
+Your name ideas sound fine to me.
+"""]]
diff --git a/privdata/relocate b/privdata/relocate
deleted file mode 100644
index 271692d8..00000000
--- a/privdata/relocate
+++ /dev/null
@@ -1 +0,0 @@
-.joeyconfig
diff --git a/src/Propellor/Property/Unbound.hs b/src/Propellor/Property/Unbound.hs
index 470aad7e..ec8b6d83 100644
--- a/src/Propellor/Property/Unbound.hs
+++ b/src/Propellor/Property/Unbound.hs
@@ -64,6 +64,10 @@ config = "/etc/unbound/unbound.conf.d/propellor.conf"
-- | Provided a [UnboundSection], a [UnboundZone] and a [UnboundHost],
-- cachingDnsServer ensure unbound is configured accordingly.
--
+-- Be carefull with CNAMEs, unbound is not a primary DNS server, so it will
+-- resolve these by itself. For a locally served zone, you probably want A/AAAA
+-- records instead.
+--
-- Example property:
--
-- > cachingDnsServer
@@ -115,13 +119,47 @@ genRecord' dom r = " local-data: \"" ++ fromMaybe "" (genRecord dom r) ++ "\"
genRecord :: BindDomain -> Record -> Maybe String
genRecord dom (Address addr) = Just $ genAddressNoTtl dom addr
-genRecord dom (MX priority dest) = Just $ genMX dom priority dest
-genRecord dom (PTR revip) = Just $ genPTR dom revip
-genRecord _ (CNAME _) = Nothing
-genRecord _ (NS _) = Nothing
-genRecord _ (TXT _) = Nothing
-genRecord _ (SRV _ _ _ _) = Nothing
-genRecord _ (SSHFP _ _ _) = Nothing
+genRecord dom (MX priority dest) = Just $ unwords
+ [ dValue dom
+ , "MX"
+ , val priority
+ , dValue dest
+ ]
+genRecord dom (PTR revip) = Just $ unwords
+ [ revip ++ "."
+ , "PTR"
+ , dValue dom
+ ]
+genRecord dom (CNAME dest) = Just $ unwords
+ [ dValue dom
+ , "CNAME"
+ , dValue dest
+ ]
+genRecord dom (NS serv) = Just $ unwords
+ [ dValue dom
+ , "NS"
+ , dValue serv
+ ]
+genRecord dom (TXT txt) = Just $ unwords
+ [ dValue dom
+ , "TXT"
+ , txt
+ ]
+genRecord dom (SRV priority weight port target) = Just $ unwords
+ [ dValue dom
+ , "SRV"
+ , val priority
+ , val weight
+ , val port
+ , dValue target
+ ]
+genRecord dom (SSHFP algo hash fingerprint) = Just $ unwords
+ [ dValue dom
+ , "SSHFP"
+ , val algo
+ , val hash
+ , fingerprint
+ ]
genRecord _ (INCLUDE _) = Nothing
genAddressNoTtl :: BindDomain -> IPAddr -> String
@@ -133,10 +171,10 @@ genAddress dom ttl addr = case addr of
IPv6 _ -> genAddress' "AAAA" dom ttl addr
genAddress' :: String -> BindDomain -> Maybe Int -> IPAddr -> String
-genAddress' recordtype dom ttl addr = dValue dom ++ " " ++ maybe "" (\ttl' -> val ttl' ++ " ") ttl ++ "IN " ++ recordtype ++ " " ++ val addr
-
-genMX :: BindDomain -> Int -> BindDomain -> String
-genMX dom priority dest = dValue dom ++ " " ++ "MX" ++ " " ++ val priority ++ " " ++ dValue dest
-
-genPTR :: BindDomain -> ReverseIP -> String
-genPTR dom revip = revip ++ ". " ++ "PTR" ++ " " ++ dValue dom
+genAddress' recordtype dom ttl addr = unwords $
+ [ dValue dom ]
+ ++ maybe [] (\ttl' -> [val ttl']) ttl ++
+ [ "IN"
+ , recordtype
+ , val addr
+ ]