Loading controls...
Control: Primary name server should be listed at parent
Description
The primary name server is the name server declared in your SOA file and generally reads your records from zone files. It is responsible for distributing the data to secondary name servers. Unmatched NS records can cause delays when resolving domain records, as it tries to contact a name server that is either non-existent or non-authoritative.
Usage
Run the control in your terminal:
steampipe check net_insights.control.dns_soa_primary_ns_listed_at_parent
Snapshot and share results via Steampipe Cloud:
steampipe loginsteampipe check --share net_insights.control.dns_soa_primary_ns_listed_at_parent
Plugins & Tables
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | domain_names |
| DNS domain names. |
SQL
with primary_ns_from_soa_record as ( select domain as domain_add, target as primary_ns from net_dns_record where domain in ( select jsonb_array_elements_text(to_jsonb($1 :: text [ ])) ) and type = 'SOA'),all_ns as ( select domain, target from net_dns_record where domain in ( select jsonb_array_elements_text(to_jsonb($1 :: text [ ])) ) and type = 'NS')select ans.domain as resource, case when count(*) = 0 then 'alarm' else 'ok' end as status, case when count(*) = 0 then ans.domain || ' primary name server not listed at parent.' else ans.domain || ' primary name server listed at parent.' end as reasonfrom all_ns as ans left join primary_ns_from_soa_record as pns on pns.domain_add = ans.domain and ans.target = pns.primary_nsgroup by ans.domain;