Hi @taylorcb
I did the following:
- In /etc/systemd/system/suricata.service.d/10-override.conf file I made the following change:
# ExecStart=/usr/bin/suricata -D --af-packet -c /run/suricata/suricata.yaml --pidfile /run/suricata/suricata.pid
ExecStart=/usr/bin/suricata -D -q 0 -c /run/suricata/suricata.yaml --pidfile /run/suricata/suricata.pid
So that means, it will listen on queue 0 if I’m not mistaken.
- Then I updated the file /run/suricata/suricata.yaml. Search for “nfq:” and uncomment the mode: accept.
nfq:
mode: accept
# repeat-mark: 1
# repeat-mask: 1
# bypass-mark: 1
# bypass-mask: 1
# route-queue: 2
# batchcount: 20
# fail-open: yes
As I use log eve syslog not json, I had to add a few more lines here:
outputs:
# Extensible Event Format (nicknamed EVE) event log in JSON format
- eve-log:
enabled: yes
level: info
facility: local5
filetype: syslog #regular|syslog|unix_dgram|unix_stream|redis
filename: eve.json
types:
- alert:
tagged-packets: yes
- anomaly:
enabled: yes
I think facility 7 is logged into terminal by default, so I simly set up “facility: local5” and "level: info ". I also modified syslog config, so it’s not stored locally, but sent to splunk only.
The next modification of this file is to uncomment and set up a treshold file at the bottom of the configuration:
# classification-file: /etc/suricata/classification.config
classification-file: /var/lib/suricata/rules/classification.config
reference-config-file: /etc/suricata/reference.config
threshold-file: /etc/suricata/threshold.config
That’s needed for me to reduce the amount of false positives.
IMPORTANT NOTE: The file /run/suricata/suricata.yaml gets updated every time you commit something in the “service suricata” part of the config. So for now I use a separated file what I copy over when it’s needed. I’m planning to perpare a PR as previously recommended, but I didn’t have the time yet to do it + my testing is not finished.
When the files were updated, and suricata was running I did the following with the FW. Every traffic I want to monitor I put into the queue 0. Let’s say for example I have a rule to allow SSH traffic from DMZ to a specific host. Instead of " action accept" I use “action queue” and “queue 0”:
[edit firewall ipv4 name DMZ]
rule 10 {
action queue
description "--- Allow SSH from specific DMZ hosts ---"
destination {
address 192.168.1.100
port 22
}
protocol tcp
queue 0
source {
group {
network-group SSH-from-DMZ-to-TRUST
}
}
}
Then suricata will start working on the queued traffic.
What I’m working on now: I want to modify some rules, to do a drop instead of alert, and also create new rules on my own, and put them into a file, what will override the action of a current rule. For example I noticed someone scans my server, I got many alerts, but no drops for that rule:
alert tcp any ![22,25,53,80,88,143,443,445,465,587,853,993,1194,8080,51820] -> any ![22,25,53,80,88,143,443,445,465,587,853,993,1194,8080,51820] (msg:"POSSBL PORT SCAN (NMAP -sA)"; flags:A; flow:stateless; window:1024; threshold:type threshold, track by_dst, count 20, seconds 70; classtype:attempted-recon; sid:3400004; priority:2; rev:5;)
I’m thinking to reduce the threshold of that rule over the previously allowed /etc/suricata/threshold.config file.
Or better I’d like to set up a static rule what drops that kind of traffic immediately.
I’m thinking about 2 possible ways:
- Add a local.rules file to the default rules folder (/etc/suricata/rules/local.rules).
I tried that one first, and did an “update suricata” VYOS command. That reads in all default suricata rules from /etc/suricata/rules folder, but for some reason it didn’t read my file, only the following:
17/3/2025 -- 12:25:36 - <Info> -- Remote checksum has not changed. Not fetching.
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/app-layer-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/decoder-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/dhcp-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/dnp3-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/dns-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/files.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/http-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/ipsec-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/kerberos-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/modbus-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/nfs-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/ntp-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/smb-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/smtp-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/stream-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Loading distribution rule file /etc/suricata/rules/tls-events.rules
17/3/2025 -- 12:25:36 - <Info> -- Ignoring file rules/emerging-deleted.rules
- Add a new rules file (eg. /var/lib/suricata/rules/local.rules ) to the suricata.yaml file, and put it on the top so the traffic is being blocked. With that I’m not finished yet, I need a bit more time to test it. But what I see for now that the rule is there in both files, one is dropping the other is alerting, not sure which one will be used first.