Comment:
Since the dataset
rules are not working, I was wondering if Suricata is really reading/processing the dataset
or it’s failing like is currently happening with iprep
.
A couple of days ago, while I was trying to create the dataset
from the config file, Suricata was restarting without issues (fast, no errors). But now that I tried to reference a file ( /etc/suricata/rules/tss-badip64.lst
) encoded in base64
from the config file, Suricata got stuck while loading in the following lines:
user1@server1:~$ sudo tail -f /var/log/suricata/suricata.log
[19990] 5/2/2021 -- 11:58:35 - (source-af-packet.c:2822) <Perf> (ReceiveAFPThreadExitStats) -- (W#01-enxa..2d70) Kernel: Packets 18141, dropped 0
[19991] 5/2/2021 -- 11:58:35 - (source-af-packet.c:2822) <Perf> (ReceiveAFPThreadExitStats) -- (W#01-enxa..2e2e) Kernel: Packets 55516, dropped 0
[19989] 5/2/2021 -- 11:58:35 - (counters.c:854) <Info> (StatsLogSummary) -- Alerts: 0
[19989] 5/2/2021 -- 11:58:35 - (ippair.c:294) <Perf> (IPPairPrintStats) -- ippair memory usage: 414144 bytes, maximum: 16777216
[19989] 5/2/2021 -- 11:58:35 - (host.c:299) <Perf> (HostPrintStats) -- host memory usage: 10442152 bytes, maximum: 33554432
[19989] 5/2/2021 -- 11:58:35 - (detect-engine-build.c:1722) <Info> (SigAddressCleanupStage1) -- cleaning up signature grouping structure... complete
[19989] 5/2/2021 -- 11:58:35 - (util-device.c:359) <Notice> (LiveDeviceListClean) -- Stats for 'enxa0cec8d92d70': pkts: 18141, drop: 0 (0.00%), invalid chksum: 0
[19989] 5/2/2021 -- 11:58:35 - (util-device.c:359) <Notice> (LiveDeviceListClean) -- Stats for 'enxa0cec8d92e2e': pkts: 55516, drop: 0 (0.00%), invalid chksum: 0
[19989] 5/2/2021 -- 11:58:35 - (util-mpm-hs.c:1078) <Perf> (MpmHSGlobalCleanup) -- Cleaning up Hyperscan global scratch
[19989] 5/2/2021 -- 11:58:35 - (util-mpm-hs.c:1086) <Perf> (MpmHSGlobalCleanup) -- Clearing Hyperscan database cache
Does it means that it is really trying to load the encoded file (around 1MB)?
Another question:
This time I keep testing the config that seems to work. No dataset
setup in the config file, but within the rules. Scirus shows no errors and the dataset
seems to be accepted, but after applied Suricata Ruleset Actions from Scirius, which push all new settings to Suricata, I noticed the following lines in the logs (which I turned more verbose to get more details):
[27694] 5/2/2021 -- 13:47:35 - (detect-engine-loader.c:251) <Config> (ProcessSigFiles) -- Loading rule file: /etc/suricata/rules/scirius.rules
[27694] 5/2/2021 -- 13:47:35 - (datasets.c:298) <Config> (DatasetLoadString) -- dataset: tss-badip64 loading from '/etc/suricata/rules/test-badip64.lst'
[27694] 5/2/2021 -- 13:47:35 - (datasets.c:365) <Config> (DatasetLoadString) -- dataset: test-badip64 loaded 0 records
[27694] 5/2/2021 -- 13:47:35 - (detect-engine-loader.c:355) <Info> (SigLoadSignatures) -- 1 rule files processed. 2 rules successfully loaded, 0 rules failed
Especially this line
[27694] 5/2/2021 -- 13:47:35 - (datasets.c:365) <Config> (DatasetLoadString) -- dataset: test-badip64 loaded 0 records
Does it means Suricata is not loading the dataset
file, or it can’t read it, and that is why the rule isn’t dropping any traffic?
Could you please provide a valid sticky buffer that I can use to check match against an IP dataset
? The closest I’ve been is using a combination that can include ipv4.hdr
, content
and offset
, but it doesn’t seem to be filtering the IP address, which is the field I need to compare against the dataset
.
After reading the sticky buffers documentation for days and tried many different combinations without any luck, I’m starting to think that I won’t be able to use a dataset
rule to drop packets to/from an IP given a blacklists, with any of the sticky buffers
currently available. If I’m wrong, please show me the right combination. Or perhaps we might need a new sticky buffer
like ip.addr