Overview
SafeNetworking’s DNS enrichment module automatically processes DNS threat events from your firewall, enriching them with threat intelligence from Palo Alto Networks AutoFocus. The system classifies threats by campaign, actor, or malware family, and assigns confidence scores based on sample age and tag relevance.How DNS Processing Works
The DNS enrichment pipeline consists of three main stages:1. Event Classification
When DNS threat events arrive in Elasticsearch, theunprocessedEventSearch() function queries for unprocessed events tagged as “DNS” and classifies them into two categories:
Primary Events
Domain already exists in local cache (
sfn-domain-details index). These are processed immediately with cached threat intelligence.Secondary Events
Domain not in cache. Requires AutoFocus API lookup to retrieve threat intelligence before processing.
2. AutoFocus Domain Lookup
ThegetDomainDoc() function manages the domain cache and AutoFocus queries:
Domain cache entries expire after
DNS_DOMAIN_INFO_MAX_AGE days (default: 30). This ensures threat intelligence stays current while minimizing API calls.3. Tag Assessment and Confidence Scoring
TheassessTags() function analyzes AutoFocus tags to determine the most relevant threat classification:
Confidence Level Calculation
For malware family tags, confidence decreases as sample age increases:| Sample Age | Confidence Level |
|---|---|
| < 15 days | 90% |
| < 25 days | 80% |
| < 40 days | 70% |
| < 50 days | 60% |
| < 60 days | 50% |
| ≥ 60 days | 5% |
Multiprocessing Architecture
TheprocessDNS() function uses Python’s multiprocessing to handle events efficiently:
Event Enrichment
ThesearchDomain() function updates each threat event with enriched data:
Processed Status Values
| Value | Meaning |
|---|---|
0 | Unprocessed event |
1 | Successfully enriched with tags |
55 | No AutoFocus tags found for domain |
Configuration Options
Configure DNS processing behavior in your.panrc file:
AutoFocus API Point Management
SafeNetworking includes built-in protection against exhausting your AutoFocus API quota:Low Points Warning
When daily points drop below
AF_POINTS_LOW (5000), switches to single-threaded processing to conserve API pointssfn-details index:
Performance Tuning
High-Volume Environments
High-Volume Environments
For environments generating 10,000+ DNS threat events daily:
- Increase
DNS_EVENT_QUERY_SIZEto 2000-5000 - Set
DNS_POOL_COUNTto 16 (maximum) - Reduce
DNS_POOL_TIMEto 3-5 seconds - Increase
DNS_DOMAIN_INFO_MAX_AGEto 45-60 days to maximize cache hits
Limited AutoFocus Quota
Limited AutoFocus Quota
If you have a restricted AutoFocus API quota:
- Reduce
DNS_POOL_COUNTto 4-8 - Increase
DNS_POOL_TIMEto 10-15 seconds - Raise
AF_POINTS_LOWto 7500 to trigger throttling earlier - Set
DNS_DOMAIN_INFO_MAX_AGEto 60-90 days to reduce API calls
Debug Mode
Debug Mode
Enable debug mode for troubleshooting:This processes events sequentially (one at a time) with verbose logging to
log/sfn.log.Index Structure
DNS enrichment uses three Elasticsearch indices:threat-* (Enriched Events)
Stores enriched DNS threat events with patternthreat-YYYY.MM:
sfn-domain-details (Domain Cache)
Caches AutoFocus domain intelligence:sfn-tag-details (Tag Cache)
Caches AutoFocus tag metadata:Troubleshooting
Events not being processed
Events not being processed
Check
log/sfn.log for:- AutoFocus API connectivity issues
- Point exhaustion warnings
- Elasticsearch connection errors
Slow processing speed
Slow processing speed
Common causes:
AF_POINTS_MODEtriggered (check daily points remaining)DNS_POOL_COUNTset too low- High percentage of secondary events (cache misses)
- Network latency to AutoFocus API
No tags found for domains
No tags found for domains
See Also
IoT Threat Processing
Learn about IoT honeypot threat enrichment
AutoFocus Configuration
Complete AutoFocus API configuration reference
