Integrating Suricata with your Manjaro firewall enhances your system's security by adding powerful intrusion detection and prevention capabilities. Suricata can analyze network traffic in real-time, detect malicious activities, and block threats before they affect your system. This guide will walk you through the process of installing Suricata on Manjaro Linux and configuring it to work with your firewall.
Prerequisites
- Administrative Privileges: Ensure you have
sudo access on your Manjaro system.
- Updated System: It's recommended to update your system packages before proceeding.
Step 1: Install Suricata
Suricata is available in the official Manjaro repositories.
-
Update Package Database and System:
sudo pacman -Syu
-
Install Suricata:
sudo pacman -S suricata
Step 2: Configure Suricata
Suricata's main configuration file is located at /etc/suricata/suricata.yaml.
-
Edit the Suricata Configuration File:
sudo nano /etc/suricata/suricata.yaml
-
Configure Network Interfaces:
Locate the af-packet section to specify the interfaces Suricata should listen on. For example:
af-packet:
- interface: enp0s3
threads: auto
cluster-id: 99
cluster-type: cluster_flow
defrag: yes
Replace enp0s3 with your actual network interface. Use ip link to list interfaces.
-
Set Run Mode:
Decide whether you want Suricata to run in IDS (Intrusion Detection System) or IPS (Intrusion Prevention System) mode.
- IDS Mode: Suricata will monitor and generate alerts but won't block traffic.
- IPS Mode: Suricata can actively block malicious traffic.
For IPS mode, you'll need to configure the nfqueue or af-packet with inline settings.
Step 3: Update Suricata Rules
Suricata uses rule sets to detect threats. Updating these rules ensures you're protected against the latest vulnerabilities.
-
Install suricata-update Tool:
sudo pacman -S suricata-update
-
Update Rules:
sudo suricata-update
-
Verify Rule Installation:
Check that the rules are properly installed in /var/lib/suricata/rules/.
Step 4: Configure Manjaro Firewall to Work with Suricata
Manjaro may use different firewall configurations, such as iptables or nftables. Suricata intercepts traffic by interfacing with these firewalls.
Option A: Using iptables with NFQUEUE
-
Redirect Traffic to Suricata:
For IPS mode using NFQUEUE, add the following iptables rules:
sudo iptables -I INPUT -j NFQUEUE --queue-num 0
sudo iptables -I OUTPUT -j NFQUEUE --queue-num 0
- This redirects all incoming and outgoing traffic to Suricata via
NFQUEUE.
-
Persist iptables Rules:
To make iptables rules persistent across reboots, install iptables-persistent or manually save rules.
Option B: Using nftables
If you're using nftables, you'll need to set up equivalent rules.
-
Add nftables Rules:
sudo nft add table inet filter
sudo nft add chain inet filter input { type filter hook input priority 0 \; }
sudo nft add rule inet filter input queue num 0 bypass
-
Persist nftables Rules:
Save your nftables configuration:
sudo nft list ruleset > /etc/nftables.conf
Enable and start nftables service:
sudo systemctl enable nftables
sudo systemctl start nftables
Option C: Using firewalld
If you're using firewalld:
-
Install firewalld (if not installed):
sudo pacman -S firewalld
-
Configure firewalld to Work with Suricata:
Firewalld uses nftables under the hood. You'll need to add rules that direct traffic to NFQUEUE.
Step 5: Start and Enable Suricata Service
-
Start Suricata:
sudo systemctl start suricata
-
Enable Suricata at Boot:
sudo systemctl enable suricata
-
Check Suricata Status:
sudo systemctl status suricata
Ensure that Suricata is active and running without errors.
Step 6: Verify the Integration
-
Monitor Suricata Logs:
sudo tail -f /var/log/suricata/suricata.log
Look for any errors or warnings that might indicate misconfiguration.
-
Test Alert Generation:
Perform a network action that should trigger a Suricata rule.
-
For example, use nmap to scan your own system:
sudo pacman -S nmap
nmap -sS localhost
-
Check if Suricata logs an alert for this activity.
-
Check Firewall Logs:
Ensure that your firewall is logging traffic as expected and that Suricata's behavior aligns with firewall policies.
Additional Configuration
Troubleshooting
Security Considerations
Conclusion
By connecting Suricata to your Manjaro firewall, you've added an advanced layer of security to your system. Suricata's powerful detection capabilities, combined with your firewall's filtering rules, provide robust protection against network threats. Remember to keep your rules updated and monitor Suricata's logs regularly to maintain optimal security.
References