How to add an exception for DNS Security domains before and after PAN-OS 10.x.x
Objective
Note: If you think any domain category needs to be corrected, submit a 'change request' here, and the process is defined here. The change in domain or URL will propagate to the DNS Security cloud and Anti-Spyware database.
However, you can add an exception as described in this document in case it is urgent that you can't wait for PAN updates. This exception is local to your Firewall and it will not propagate Firewall reboots.
Note: Adding a DNS Security exception differs between PAN-OS 9.x.x and PAN-OS 10.x.x or higher. PAN-OS 9.x.x doesn't have the option to add an exception using an FQDN or the UTID (Unique Threat ID) of the DNS signature, while PAN-OS >=10.x.x allows us to add an exception based on FQDN or UTID.
Background information:
PAN-OS 9.x.x:
When the DNS Security categories block the DNS traffic, we see the UTID of the DNS Security; for example, the DGA category TID is 109000001. This means that different domains can be identified by the same UTID of the DNS Security i.e, all DGA domains will show one threat ID -> 109000001.
In such a situation, if a domain is false positive, the only option is to add an exception for the whole category(DGA). However, you can add an exception for that domain by using the UTID of the DNS Security by CLI.
This article explains how to add the exception for one domain while blocking all other domains under that DNS Security Categories.
PAN-OS 10.x.x:
In PAN-OS 10.x.x, The exception can be added by FQDN or the UTID of the DNS signature. The list of the DNS Security Categories can be found here.
Environment
- PAN-OS 9.x.x
- PAN-OS 10.x.x and above
- Palo Alto Firewall
- DNS security license
Procedure
Following are two possible solutions for PAN-OS 9.x.x.
Solution:1
Step-1:
- Suppose the domain 'abc.com' is identified as DGA. in this case if a DNS query was made by any host behind the firewall it will be resolved into a sinkhole address.
- This is an example of running nslookup command on a windows machine which is connected to the network.
> nslookup abc.com
abc.com canonical name = sinkhole.paloaltonetworks.com.
- Firewall threat logs can be seen as follows.
Step-2:
- Check the status of the domain verdict by the following command on the firewall CLI.
> show dns-proxy dns-signature cache | match abc.com
*.abc.com C2 109000001 86327 0
- Change the status of the domain verdict to benign by the following command. Please note that you are adding this domain as a whitelist on your Palo Alto Networks Firewall. This entry will only be effective on your Firewall locally.
> debug dnsproxyd dns-signature response verdict <new verdict you want> fqdn <FQDN> ttl <Time to live> gtid <preferably higher number> match-subdomain <yes|no>
> debug dnsproxyd dns-signature response verdict Whitelist gtid 420000700 ttl 30758400 fqdn abc.com match-subdomain yes
- You can confirm the domain is whitelisted. The last number, zero indicates the number of hits to this domain.
> show dns-proxy dns-signature cache | match abc
*.abc.com White list 420000700 30758373 0
- You can also confirm that the verdict is changed to benign in the data plane.
> debug dataplane show dns-cache print | match abc
abc.com, wildcard: yes, ttl: 0/331353/0, temp: 0, verdict benign, utid: 420000700
Step-3:
- Send a DNS query again on the same domain, and it will be resolved to the correct IP address.
> nslookup abc.com
Name: abc.com
Address: 13.227.74.129
Note: The cache will expire based on the TTL value. The max TTL we can set is 30758400 sec which is one year. The cache also can disappear upon firewall reboot.
Note: Prior to running any debug commands listed in the article, please go through this article which explains the risks involved.
Solution:2
- Create an extended dynamic list with the domains that need to be allowed.
- Caveat: EDL status should be "alert" not "allow" otherwise, the EDL module will skip, DNS-Security action will take place. I am adding the summary, you can find full details here .
- When the EDL action is set to 'allow., the EDL setting is simply just ignored. As a result, DNS security action takes place. ==> So, the DNS traffic still can be blocked by DNS Security.
- When the EDL action is set to 'alert.' the EDL action takes place. As a result, DNS security action is bypassed.
- When DNS traffic is allowed, you will see the threat log (TID:12000000, "Suspicious Domain") due to the action is 'alert.' Please ignore the logs.
Additional Information
- Adding exceptions by the FQDN is useful when a DNS signature is available in the cloud and the UTID of the DNS signature is not visible from the ThreatVault. That means the UTID of the DNS signature is not known.
- The exception also can be added on the subdomain as shown below.
- Please go to Object -> Anti-spyware profile -> DNS Exceptions
- CLI:
> set profiles spyware based-default botnet-domains whitelist 10yxnzg0k9f64ah804u532vwzhzq66.ipgreat.com description "allowing this domain"
- If the UTID of the DNS signature is known, an exception can be added by the UTID.
- CLI:
> set profiles spyware based-default botnet-domains threat-exception 78069521
Note: The below command can run from Panorama to apply exception :
# set shared profiles spyware "Name of Anti-Spyware Profile" botnet-domains threat-exception <UTID>