Skip to content

Commit bd42875

Browse files
committedNov 6, 2024
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 Signed-off-by: Kim Alvefur <zash@zash.se>
1 parent 22ccef7 commit bd42875

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎prober/dns.go

+12
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
141141
Name: "probe_dns_additional_rrs",
142142
Help: "Returns number of entries in the additional resource record list",
143143
})
144+
probeDNSFlagAd := prometheus.NewGauge(prometheus.GaugeOpts{
145+
Name: "probe_dns_flag_ad",
146+
Help: "Returns whether or not the query had the DNSSEC AD flag set",
147+
})
144148
probeDNSQuerySucceeded := prometheus.NewGauge(prometheus.GaugeOpts{
145149
Name: "probe_dns_query_succeeded",
146150
Help: "Displays whether or not the query was executed successfully",
@@ -154,6 +158,7 @@ func ProbeDNS(ctx context.Context, target string, module config.Module, registry
154158
registry.MustRegister(probeDNSAnswerRRSGauge)
155159
registry.MustRegister(probeDNSAuthorityRRSGauge)
156160
registry.MustRegister(probeDNSAdditionalRRSGauge)
161+
registry.MustRegister(probeDNSFlagAd)
157162
registry.MustRegister(probeDNSQuerySucceeded)
158163

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

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

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

0 commit comments

Comments
 (0)
Failed to load comments.