Skip to content

Commit 0212407

Browse files
committed
Add probe_dns_flag_ad metric
This adds reporting of the Authenticated Data flag, indicating whether the resolver thinks the resource is properly signed with DNSSEC. Ref #551
1 parent 220d785 commit 0212407

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

prober/dns.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
142142
Name: "probe_dns_additional_rrs",
143143
Help: "Returns number of entries in the additional resource record list",
144144
})
145+
probeDNSFlagAd := prometheus.NewGauge(prometheus.GaugeOpts{
146+
Name: "probe_dns_flag_ad",
147+
Help: "Returns whether or not the query had the DNSSEC AD flag set",
148+
})
145149
probeDNSQuerySucceeded := prometheus.NewGauge(prometheus.GaugeOpts{
146150
Name: "probe_dns_query_succeeded",
147151
Help: "Displays whether or not the query was executed successfully",
@@ -155,6 +159,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
155159
registry.MustRegister(probeDNSAnswerRRSGauge)
156160
registry.MustRegister(probeDNSAuthorityRRSGauge)
157161
registry.MustRegister(probeDNSAdditionalRRSGauge)
162+
registry.MustRegister(probeDNSFlagAd)
158163
registry.MustRegister(probeDNSQuerySucceeded)
159164

160165
qc := uint16(dns.ClassINET)
@@ -256,6 +261,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
256261
msg := new(dns.Msg)
257262
msg.Id = dns.Id()
258263
msg.RecursionDesired = module.DNS.Recursion
264+
msg.AuthenticatedData = true
259265
msg.Question = make([]dns.Question, 1)
260266
msg.Question[0] = dns.Question{dns.Fqdn(module.DNS.QueryName), qt, qc}
261267

@@ -281,6 +287,12 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
281287
probeDNSAdditionalRRSGauge.Set(float64(len(response.Extra)))
282288
probeDNSQuerySucceeded.Set(1)
283289

290+
if response.AuthenticatedData {
291+
probeDNSFlagAd.Set(1)
292+
} else {
293+
probeDNSFlagAd.Set(0)
294+
}
295+
284296
if qt == dns.TypeSOA {
285297
probeDNSSOAGauge = prometheus.NewGauge(prometheus.GaugeOpts{
286298
Name: "probe_dns_serial",

0 commit comments

Comments
 (0)