Commit Graph

85 Commits

Author SHA1 Message Date
Michael Tremer
30f411694c suricata: Include all default rules
These rules do not drop anything, but only alert when internal parts of
the engine trigger an event. This will allow us more insight on what is
happening.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-11-24 09:06:14 +00:00
Michael Tremer
9deccd1cba suricata: Enable bypassing unhandled streams
If a stream cannot be identified or if suricata has decided that it
cannot do anything useful any more (e.g. TLS sessions after the
handshake), we will allow suricata to bypass any following packets in
that flow

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:19 +00:00
Michael Tremer
11f7218f9c suricata: Define bypass mark
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:34:10 +00:00
Michael Tremer
761fadbdde suricata: Set most significant bit as repeat marker
I have no idea why some odd value was chosen here, but one bit should be
enough.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
Tested-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:33:47 +00:00
Leo-Andres Hofmann
abffcc99ad Refactor "get_available_network_zones", move to network-functions.pl
This function nicely translates the ethernet/settings "CONFIG_TYPE"
into a list of available zones. Therefore it should be more accessible!

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-01-25 19:32:38 +00:00
Stefan Schantl
aa90ed9c20 ruleset-sources: Update snort dl urls.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-27 11:51:05 +00:00
Stefan Schantl
0937bd9c01 suricata: Automatically enable JA3 fingerprinting.
Enable JA3 fingerprinting if any rules are enabled which are using this
kind of feature.

Fixes #12507.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-27 11:51:00 +00:00
Stefan Schantl
0cdb151831 suricata: Update to 6.0.0.
* Enable RDP and SIP parsers.
* Enable new introduced parsers for RFB and DCERPC.

Because HTTP2 support and parser currently is experimental the suricata
developers decided to disable it at default - we keep this default
setting for now.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-27 11:50:56 +00:00
Arne Fitzenreiter
551bc48940 suricata: disable dns flood protection
this causes errors in unbound and also other linux clients if
a dns rule triggers.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-08 15:48:20 +00:00
Arne Fitzenreiter
b8fcb49567 suricata: update ET rulesets sources for suricata 5
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-08 15:43:35 +00:00
Arne Fitzenreiter
e4013c9dab core143: add suricata http port changes
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-07 08:54:27 +00:00
Stefan Schantl
e698090e7f IDS: Dynamically generate and import the HTTP ports.
With this commit suricata reads the HTTP port declarations from a newly
introduced external file
(/var/ipfire/suricata/suricata-http-ports.yaml).

This file dynamically will be generated. HTTP ports always are the
default port "80" and "81" for update Accelerator and HTTP access to the
WUI. In case the Web-proxy is used, the configured proxy port and/or Transparent
Proxy port also will be declared as a HTTP port and written to that file.

In case one of the proxy ports will be changed, the HTTP port file will
be re-generated and suricate restarted if launched. Also if an old
backup with snort will be restored the convert script handles the
generation of the HTTP ports file.

Finally the suricata-generate-http-ports-file as a tiny script which
simply generates the http ports file and needs to be launched during the
installation of a core update. (The script will no be required
anymore, so it could be deleted afterwards.)

Fixes #12308.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-06 14:04:00 +00:00
Stefan Schantl
6084e66e70 suricata.yaml: Re-add EVE log section.
Hopefully the EVE log will display some more content when trying to
debug suricata events and rules.

Fixes #12315.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-06 14:03:26 +00:00
Arne Fitzenreiter
2f8a33e182 suricata: increase dns flood trigger
on slow lines unbound trigger the floodprotection at init.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-02 16:31:18 +00:00
Stefan Schantl
d383248063 Suricata: Add port 81 (UpdateAccelerator) to group of HTTP ports.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-01 14:46:27 +00:00
Stefan Schantl
2acc41c04c suricata: Enable RDP protocol parser.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-02-12 13:28:35 +00:00
Stefan Schantl
d5957c5cd2 ruleset-sources: Update snort dl urls.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-02-12 13:28:06 +00:00
Stefan Schantl
d6cc871067 suricata: Enable new and rust-depended protocol parsers.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-02-12 13:28:04 +00:00
Stefan Schantl
cde7cab264 convert-snort: Check and convert snort user and group.
Fixes #12102.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-03 21:15:11 +00:00
Stefan Schantl
961a27b5e2 suricata: Use DNS_SERVERS declaration from external file.
These settings now will be read from
/var/ipfire/suricata/suricata-dns-servers.yaml, which will be
generated by the generate_dns_servers_file() function, located in
ids-functions.pl and called by various scripts.

Fixes #12166.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-11-13 19:14:27 +00:00
Stefan Schantl
bb2696da35 convert-snort: Generate DNS servers file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-11-13 19:14:03 +00:00
Stefan Schantl
6a56ee2a3e ruleset-sources: Update snort dl urls.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-10-14 17:34:03 +00:00
Stefan Schantl
33afb0681f convert-ids-modifysids-file: Fix check if the ids is running.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-10 09:46:00 +01:00
Stefan Schantl
3c91ee8092 convert-ids-modifysids-file: Adjust code to use changed write_modify_sids_file function
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 12:43:09 +01:00
Stefan Schantl
f1add9a8dd convert-snort: Adjust code to use changed modify_sids_file function.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 12:42:00 +01:00
Tim FitzGeorge
a5ba473c15 suricata: correct rule actions in IPS mode
In IPS mode rule actions need to be have the action 'drop' for the
protection to work, however this is not appropriate for all rules.
Modify the generator for oinkmaster-modify-sids.conf to leave
rules with the action 'alert' here this is appropriate.  Also add
a script to be run on update to correct existing downloaded rules.

Fixes #12086

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Tested-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 12:39:57 +01:00
Stefan Schantl
79af9f6938 ruleset-sources: Update snort dl urls.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-27 15:48:15 +01:00
Stefan Schantl
25d424387e convert-snort: Fix ownership of the generated homenet file.
Fixes #12059.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-23 20:54:54 +01:00
Michael Tremer
5061292091 suricata: EXTERNAL_NET should equal any
This enables that we scan servers in ORANGE for clients in
GREEN which absolutely makes sense.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-23 20:45:42 +01:00
Stefan Schantl
6e7c8a3303 suricata: Disable stats.log
This log is mainly needed for debugging the IPS. It writes some stats
every couple of seconds and will create some load on SD cards and other
cheap storage that we do not need.

Fixes #12056.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-20 14:09:21 +01:00
Michael Tremer
64aed99df6 suricata: Change runmode to workers
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-17 19:15:29 +01:00
Michael Tremer
dccbdf5b97 suricata: Take as much off of the CPU as possible
https://suricata.readthedocs.io/en/suricata-4.1.3/performance/high-performance-config.html

This will compile the ruleset as efficient as possible and
allows the IPS to run faster on smaller systems.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-12 17:59:21 +01:00
Stefan Schantl
ee82349a0e convert-snort: Re-order steps at end of script
This will ensure that the whole IDS is configured property, if
no or an empty snort config file is present.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-08 21:15:35 +01:00
Stefan Schantl
e4bc9b8b6f convert-snort: Fix logic for detecting enough free disk space.
The subfunction only will return something if the check fails - so the logic
of the if statement was wrong set and the downloader only was called if
this check failed and to less diskspace would be available.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-08 21:15:35 +01:00
Michael Tremer
f903d3a6f0 suricata: Disable CPU affinity
Benchmarks have shown, that this is making the IPS slower
across various hardware

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-04 22:02:53 +01:00
Michael Tremer
35cdc506b0 suricata: Enable CPU affinity
This will tie the detection threads to a certain CPU and
slightly increases throughput on my system.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-26 21:58:01 +00:00
Michael Tremer
38081b8be1 suricata: Run as non-root user
This patch does not have any effect (yet) and is untested
because suricata needs to be built against libcap-ng which
is currently not being packaged for IPFire.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-10 18:02:39 +01:00
Stefan Schantl
2bec60c347 suricata: Update to 4.1.3
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-10 17:34:03 +01:00
Michael Tremer
26c758cf48 suricata: Drop parsers I have never heard of
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-03 10:55:31 +01:00
Michael Tremer
8efbd71caa suricata: Configure HTTP decoder
This will now scan all request and response bodies where possible
and use up to 256MB of RAM

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-03 10:55:31 +01:00
Michael Tremer
96495c9aa2 Revert "Suricata: detect DNS events on port 853, too"
This reverts commit ad99f959e2.

It does not make any sense to try to decode the TLS connection
with the DNS decoder.

Therefore should 853 (TCP only) be added to the TLS decoder.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-03 10:55:30 +01:00
Michael Tremer
5d04cfe7d5 suricata: Use highest bit to mark packets
We are using the netfilter MARK in IPsec & QoS and this
is causing conflicts.

Therefore, we use the highest bit in the IPS chain now
and clear it afterwards because we do not really care about
this after the packets have been passed through suricata.

Then, no other application has to worry about suricata.

Fixes: #12010
Signed-off-by: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:48 +01:00
Michael Tremer
c9ee3592f0 suricata: Fix syntax error
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
99d75ac72e suricata: Start capture first and then load rules
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
890f1bf295 suricata: Disable decoding for Teredo
This decoder is not very accurate and Teredo has been
disabled in Windows by default. Nobody will use this.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
0b340f0938 suricata: Increase memory size for the stream engine
This change also ensures that suricata has a decent number
of streams preallocated to be able to handle any bursts in traffic.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
ab1444b4f4 suricata: Log to syslog like a normal process
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
47cb057145 suricata: Use up to 256MB of RAM for the flow cache
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:47 +01:00
Michael Tremer
7eed864c93 suricata: Use 64MB of RAM for defragmentation
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:46 +01:00
Michael Tremer
83b576c892 suricata: Use the correct path for the magic database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-03-01 17:56:46 +01:00