Starting SafeNetworking
SafeNetworking is started using thesfn command-line interface. The application initializes background processes and starts a Flask web server for event processing.
Basic Start Command
- Initializes the application with configured log levels
- Connects to Elasticsearch at the configured host and port
- Starts background processing threads
- Launches the Flask application server
SafeNetworking will log initialization messages showing the log level and Elasticsearch connection details from your configuration.
Background Processes
SafeNetworking automatically starts three background processing threads when initialized:DNS Processing
Processes DNS threat events from Elasticsearch, enriches them with AutoFocus data, and updates event documents with malware intelligence.
IoT Processing
Retrieves IoT honeypot data from external sources and stores malicious IP/domain information for threat correlation.
AutoFocus Points
Monitors AutoFocus API point consumption to prevent exceeding rate limits and manages throttling automatically.
DNS Processing Thread
Location:project/dns/runner.py:109
The DNS processor:
- Runs continuously at intervals set by
DNS_POOL_TIME(default: 5 seconds) - Searches for unprocessed DNS events in Elasticsearch
- Queries AutoFocus for domain threat intelligence
- Updates events with malware tags, confidence levels, and campaign information
- Can be disabled by setting
DNS_PROCESSING = Falsein.panrc
IoT Processing Thread
Location:project/iot/runner.py:120
The IoT processor:
- Runs continuously at intervals set by
IOT_POOL_TIME(default: 600 seconds) - Retrieves updates from external IoT honeypot database
- Normalizes and stores malicious IoT device information
- Disabled by default; enable with
IOT_PROCESSING = Truein.panrc
AutoFocus Points Monitor
Location:project/dns/dnsutils.py:140
The AF points monitor:
- Checks AutoFocus API point totals at intervals set by
AF_POOL_TIME(default: 600 seconds) - Updates the
af-detailsdocument in Elasticsearch - Tracks both minute and daily point consumption
- Automatically throttles or pauses processing when limits are approached
Configuration Options
SafeNetworking is configured through the.panrc file located in the application base directory. This file overrides default settings defined in project/__init__.py.
Required Configuration
Application Settings
| Setting | Default | Description |
|---|---|---|
DEBUG_MODE | False | Process one event at a time for debugging |
DNS_POOL_TIME | 5 | Seconds between DNS processing cycles |
URL_POOL_TIME | 10 | Seconds between URL processing cycles |
AF_POOL_TIME | 600 | Seconds between AutoFocus point checks |
IOT_POOL_TIME | 600 | Seconds between IoT database updates |
DNS_PROCESSING | True | Enable/disable DNS event processing |
IOT_PROCESSING | False | Enable/disable IoT processing |
AutoFocus Rate Limiting
SafeNetworking includes intelligent rate limiting to prevent exhausting AutoFocus API points.
AF_POINTS_LOW, processing switches to single-threaded mode. When points drop below AF_POINT_NOEXEC, all processing pauses until points refresh.
Multi-Processing Configuration
Caching Settings
Elasticsearch Configuration
Flask Server Settings
Stopping SafeNetworking
To stop SafeNetworking, use standard process termination:Restarting SafeNetworking
To restart the application:Restarting is useful after modifying configuration in
.panrc or updating code.Running as a Service
For production deployments, run SafeNetworking as a systemd service to ensure automatic startup and restart on failure.Create Service File
Create/etc/systemd/system/safenetworking.service:
Enable and Start Service
Manage the Service
Other CLI Commands
Check Version
Admin Commands
IoT Commands
Load Data
Next Steps
Monitoring
Learn how to monitor SafeNetworking and view logs
Troubleshooting
Resolve common issues and errors
