Add some basic explanations for A, AAAA, NS, TXT, CNAME, MX records.
parent
2f75e29991
commit
dcc587bd19
|
@ -2,12 +2,14 @@
|
|||
-- |
|
||||
-- | This interface enables to:
|
||||
-- | - display all resource records of a zone (SOA, NS, A, AAAA, CNAME, TXT, MX, SRV)
|
||||
-- | - provide dedicated interfaces for SPF and DKIM (TODO: DMARC)
|
||||
-- | - provide dedicated interfaces for SPF, DKIM and DMARC
|
||||
-- | - add, modify, remove resource records
|
||||
-- |
|
||||
-- | **WIP**: Display relevant information for each record type in the (add/mod) modal.
|
||||
-- | This includes explaining use cases and displaying an appropriate interface for the task at hand.
|
||||
-- |
|
||||
-- | TODO: CAA records.
|
||||
-- |
|
||||
-- | TODO: display errors not only for a record but for the whole zone.
|
||||
-- | A DNS zone is bound by a set of rules, the whole zone must be consistent.
|
||||
-- | For example, a CNAME `target` has to point to the `name` of an existing record.
|
||||
|
@ -294,7 +296,7 @@ default_domain :: String
|
|||
default_domain = "netlib.re"
|
||||
|
||||
default_rr_A :: ResourceRecord
|
||||
default_rr_A = emptyRR { rrtype = "A", name = "www", target = "192.0.2.1" }
|
||||
default_rr_A = emptyRR { rrtype = "A", name = "server1", target = "192.0.2.1" }
|
||||
|
||||
default_empty_rr :: ResourceRecord
|
||||
default_empty_rr = default_rr_A
|
||||
|
@ -387,11 +389,11 @@ render state
|
|||
render_current_rr_modal :: forall w. HH.HTML w Action
|
||||
render_current_rr_modal =
|
||||
case state._currentRR.rrtype of
|
||||
"A" -> template modal_content_simple (foot_content A)
|
||||
"AAAA" -> template modal_content_simple (foot_content AAAA)
|
||||
"TXT" -> template modal_content_simple (foot_content TXT)
|
||||
"CNAME" -> template modal_content_simple (foot_content CNAME)
|
||||
"NS" -> template modal_content_simple (foot_content NS)
|
||||
"A" -> template (modal_content_simple A) (foot_content A)
|
||||
"AAAA" -> template (modal_content_simple AAAA) (foot_content AAAA)
|
||||
"TXT" -> template (modal_content_simple TXT) (foot_content TXT)
|
||||
"CNAME" -> template (modal_content_simple CNAME) (foot_content CNAME)
|
||||
"NS" -> template (modal_content_simple NS) (foot_content NS)
|
||||
"MX" -> template modal_content_mx (foot_content MX)
|
||||
"SRV" -> template modal_content_srv (foot_content SRV)
|
||||
"SPF" -> template modal_content_spf (foot_content SPF)
|
||||
|
@ -404,9 +406,10 @@ render state
|
|||
render_errors = if A.length state._currentRR_errors > 0
|
||||
then HH.div_ $ [ Bulma.h3 "Errors: " ] <> map error_to_paragraph state._currentRR_errors
|
||||
else HH.div_ [ ]
|
||||
modal_content_simple :: Array (HH.HTML w Action)
|
||||
modal_content_simple =
|
||||
modal_content_simple :: AcceptedRRTypes -> Array (HH.HTML w Action)
|
||||
modal_content_simple x =
|
||||
[ render_errors
|
||||
, render_introduction_text x
|
||||
, Bulma.input_with_side_text ("domain" <> state._currentRR.rrtype) "Name" "www"
|
||||
(updateForm Field_Domain)
|
||||
state._currentRR.name
|
||||
|
@ -428,9 +431,19 @@ render state
|
|||
]
|
||||
else []
|
||||
_ -> []
|
||||
|
||||
render_introduction_text :: AcceptedRRTypes -> HH.HTML w Action
|
||||
render_introduction_text = case _ of
|
||||
A -> Bulma.div_content [] [Bulma.explanation Explanations.a_introduction]
|
||||
AAAA -> Bulma.div_content [] [Bulma.explanation Explanations.aaaa_introduction]
|
||||
TXT -> Bulma.div_content [] [Bulma.explanation Explanations.txt_introduction]
|
||||
CNAME -> Bulma.div_content [] [Bulma.explanation Explanations.cname_introduction]
|
||||
NS -> Bulma.div_content [] [Bulma.explanation Explanations.ns_introduction]
|
||||
_ -> HH.p_ []
|
||||
modal_content_mx :: Array (HH.HTML w Action)
|
||||
modal_content_mx =
|
||||
[ render_errors
|
||||
, Bulma.div_content [] [Bulma.explanation Explanations.mx_introduction]
|
||||
, Bulma.input_with_side_text "domainMX" "Name" "www"
|
||||
(updateForm Field_Domain)
|
||||
state._currentRR.name
|
||||
|
@ -665,11 +678,11 @@ handleAction = case _ of
|
|||
CreateNewRRModal t -> do
|
||||
state <- H.get
|
||||
H.modify_ _ { rr_modal = NewRRModal t }
|
||||
let default_rr_AAAA = emptyRR { rrtype = "AAAA", name = "www", target = "2001:db8::1" }
|
||||
let default_rr_AAAA = emptyRR { rrtype = "AAAA", name = "server1", target = "2001:db8::1" }
|
||||
default_rr_TXT = emptyRR { rrtype = "TXT", name = "txt", target = "some text" }
|
||||
default_rr_CNAME = emptyRR { rrtype = "CNAME", name = "blog", target = "www" }
|
||||
default_rr_CNAME = emptyRR { rrtype = "CNAME", name = "www", target = "server1" }
|
||||
default_rr_NS = emptyRR { rrtype = "NS", name = (state._domain <> "."), target = "ns0.example.com." }
|
||||
default_rr_MX = emptyRR { rrtype = "MX", name = "mail", target = "www", priority = Just 10 }
|
||||
default_rr_MX = emptyRR { rrtype = "MX", name = "mail", target = "server1", priority = Just 10 }
|
||||
default_rr_SRV = emptyRR { rrtype = "SRV", name = "voip", target = "server1"
|
||||
, port = Just 5061, weight = Just 100, priority = Just 10, protocol = Just "tcp" }
|
||||
default_mechanisms = maybe [] (\x -> [x]) $ to_mechanism "pass" "mx" ""
|
||||
|
|
|
@ -155,6 +155,110 @@ basics = HH.div_
|
|||
, Bulma.p "Check out the \"Tokens? 🤨\" tab."
|
||||
]
|
||||
|
||||
a_introduction :: forall w i. Array (HH.HTML w i)
|
||||
a_introduction =
|
||||
[ Bulma.p """
|
||||
The A record enables to bind an IPv4 address to a domain.
|
||||
"""
|
||||
, HH.p []
|
||||
[ HH.text "🚨 "
|
||||
, HH.u_ [HH.text "Advice for beginners"]
|
||||
, HH.text ":"
|
||||
, HH.text """
|
||||
the "Name" field is for the name of the record, which should be the name of the server owning this IP address, such as "server1".
|
||||
The "Target" field is for the IP address.
|
||||
The default TTL should be fine.
|
||||
"""
|
||||
]
|
||||
]
|
||||
|
||||
aaaa_introduction :: forall w i. Array (HH.HTML w i)
|
||||
aaaa_introduction =
|
||||
[ Bulma.p """
|
||||
The AAAA record enables to bind an IPv6 address to a domain.
|
||||
"""
|
||||
, HH.p []
|
||||
[ HH.text "🚨 "
|
||||
, HH.u_ [HH.text "Advice for beginners"]
|
||||
, HH.text ":"
|
||||
, HH.text """
|
||||
the "Name" field is for the name of the record, which should be the name of the server owning this IP address, such as "server1".
|
||||
The "Target" field is for the IP address.
|
||||
The default TTL should be fine.
|
||||
"""
|
||||
]
|
||||
]
|
||||
|
||||
cname_introduction :: forall w i. Array (HH.HTML w i)
|
||||
cname_introduction =
|
||||
[ Bulma.p """
|
||||
The CNAME record enables to provide alternative names to records.
|
||||
"""
|
||||
, HH.p []
|
||||
[ HH.text "🚨 "
|
||||
, HH.u_ [HH.text "Advice for beginners"]
|
||||
, HH.text ":"
|
||||
, HH.text """
|
||||
this resource record helps keeping your zone clean.
|
||||
Let's say you have a server named "server1", you can register an A record for that server (since the server actually has an IP address).
|
||||
Then, your hosted services will be registered in your zone as CNAMEs: "www", "blog" and "voip" will point to "server1", the actual server hosting these services.
|
||||
"""
|
||||
]
|
||||
]
|
||||
|
||||
mx_introduction :: forall w i. Array (HH.HTML w i)
|
||||
mx_introduction =
|
||||
[ Bulma.p """
|
||||
The MX record enables to add a mail server to your zone.
|
||||
"""
|
||||
, HH.p []
|
||||
[ HH.text "🚨 "
|
||||
, HH.u_ [HH.text "Advice for beginners"]
|
||||
, HH.text ": handling a mail server is both complex and difficult."
|
||||
, HH.text """
|
||||
The tab "The basics 🧠" explains some parts of hosting a mail server, but keep in mind that this is time consuming to get it together.
|
||||
This page talks about the DNS aspect of it, but doesn't cover all you need to know to actually host a mail server, by a long shot.
|
||||
"""
|
||||
]
|
||||
, Bulma.p """
|
||||
Anyway, the MX record itself is simple to understand.
|
||||
Let's say you have a server named "server1" with your mail service.
|
||||
The MX record can be named "mail" and it will target "server1".
|
||||
Of course, "server1" needs a record for its IP address (A or AAAA).
|
||||
"""
|
||||
, Bulma.p """
|
||||
The priority field is important only in case you have multiple mail servers; keep the default value.
|
||||
"""
|
||||
]
|
||||
|
||||
txt_introduction :: forall w i. Array (HH.HTML w i)
|
||||
txt_introduction =
|
||||
[ Bulma.p """
|
||||
The TXT record enables to declare a small text.
|
||||
"""
|
||||
, HH.p []
|
||||
[ HH.text "🚨 "
|
||||
, HH.u_ [HH.text "Advice for beginners"]
|
||||
, HH.text ":"
|
||||
, HH.text """
|
||||
do not use this record directly.
|
||||
TXT records are used in several places, for example for mail security through SPF, DKIM and DMARC records.
|
||||
"""
|
||||
]
|
||||
, Bulma.notification_danger' """
|
||||
All of these specific records have a dedicated user interface on this website;
|
||||
use them instead of writing these records by yourself.
|
||||
"""
|
||||
]
|
||||
|
||||
ns_introduction :: forall w i. Array (HH.HTML w i)
|
||||
ns_introduction =
|
||||
[ Bulma.p """
|
||||
The NS record enables to declare a new Name Server, meaning a new server that would serve this zone.
|
||||
"""
|
||||
, Bulma.notification_danger' "🚨 Advice for beginners: do not use this resource record."
|
||||
]
|
||||
|
||||
dkim_introduction :: forall w i. Array (HH.HTML w i)
|
||||
dkim_introduction =
|
||||
[ Bulma.p """
|
||||
|
|
Loading…
Reference in New Issue