summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-18 16:49:36 -0400
committerJoey Hess2014-04-18 16:49:36 -0400
commit2b9ee5b29b03a4a18fb43dafab38d6d185c653e0 (patch)
treefc0eecdddabe3a02d39c72cde52290169622e9d7 /Propellor/Property
parent8d8f68f5abdfc6980697c160307751aa3b18f9b8 (diff)
add mkSOA
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/Dns.hs39
1 files changed, 27 insertions, 12 deletions
diff --git a/Propellor/Property/Dns.hs b/Propellor/Property/Dns.hs
index 4c59aacd..1d4a8e49 100644
--- a/Propellor/Property/Dns.hs
+++ b/Propellor/Property/Dns.hs
@@ -77,18 +77,33 @@ data Zone = Zone
-- | Every domain has a SOA record, which is big and complicated.
data SOA = SOA
- { sRoot :: BindDomain
+ { sDomain :: BindDomain
+ -- ^ Typically ns1.your.domain
, sSerial :: SerialNumber
- -- ^ The most important parameter is the serial number,
- -- which must increase after each change.
- , sRefresh :: Integer
- , sRetry :: Integer
- , sExpire :: Integer
- , sTTL :: Integer
- , sRecord :: [Record]
- -- ^ Records for the root of the domain. Typically NS, A, TXT
- }
- deriving (Read, Show, Eq)
+ -- ^ The most important parameter is the serial number,
+ -- which must increase after each change.
+ , sRefresh :: Integer
+ , sRetry :: Integer
+ , sExpire :: Integer
+ , sTTL :: Integer
+ , sRecord :: [Record]
+ -- ^ Records for the root of the domain. Typically NS, A, TXT
+ }
+ deriving (Read, Show, Eq)
+
+-- | Generates a SOA with some fairly sane numbers in it.
+mkSOA :: Domain -> [Record] -> SOA
+mkSOA d rs = SOA
+ { sDomain = AbsDomain d
+ , sSerial = 1
+ , sRefresh = hours 4
+ , sRetry = hours 1
+ , sExpire = 2419200 -- 4 weeks
+ , sTTL = hours 8
+ , sRecord = rs
+ }
+ where
+ hours n = n * 60 * 60
-- | Types of DNS records.
--
@@ -232,7 +247,7 @@ genSOA soa = unlines $
[ dValue SOADomain
, "IN"
, "SOA"
- , dValue (sRoot soa)
+ , dValue (sDomain soa)
, "root"
, "("
]