Commit Graph

473 Commits

Author SHA1 Message Date
Stefan Schantl
10beae64bf ids-functions.pl: Skip deleted.rules files
These rulefiles are used by various providers as a kind of reference and
to store rules which have been taken out for correctness, performance
reasons or because of other reasons.

Fixes #12794.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-15 17:52:27 +00:00
Stefan Schantl
f349c960e4 ids-functions.pl: Do not longer extract all rulefiles in archive.
Only extract rulefiles which are located in a rules directory and/or in the archive
root.

This prevents us from extracting experimental or binary rules etc. which
often are located in corresponding sub-directories.

Reference: #12794.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-14 15:45:00 +00:00
Stefan Schantl
47b2640d37 general-functions.pl: Do not die if no red interface could be determined.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-09 15:46:19 +00:00
Stefan Schantl
cad8657532 ids-functions.pl: Do not create an empty ignored settings file.
The file will be created by the WUI, when adding the first host.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-05 19:28:24 +00:00
Stefan Schantl
2b12a010d7 ids-functions.pl: Merge same named rulefiles during extract.
In case a rulestarball contains several same-named rulefiles
they have been overwritten each time and so only contained the content
from the last extracted one.

Now the content of those files will be merged by appending the content
to the first extracted one for each time.

Fixes #12792.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-05 19:28:08 +00:00
Stefan Schantl
8353e28ad2 ids-functions.pl: Do not try to chown files while extracting them.
We are almost running as an unprivileged user and therfore have not
the permissions to do this.

This will save us a lot of confusion error messages.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-03-05 14:28:36 +00:00
Leo-Andres Hofmann
b67cf71b2d manualpages: Drop p2p-block entry
The p2p-block CGI has been removed. Therefore the link to its
manual page can be removed as well.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-17 19:23:47 +00:00
Stefan Schantl
19e5c03f15 location-functions.pl: Remove ending backslash from location_dir variable.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-15 18:05:36 +00:00
Stefan Schantl
a5f22bf03c location-functions.pl: Rename and set the location for exported databases to "/var/lib/location/ipset/".
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-15 18:05:22 +00:00
Stefan Schantl
954dbdadcf ids-functions.pl: Adjust code to deal with new LWP::UserAgent.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-09 20:08:45 +00:00
Adolf Belka
2b3a9bed2d manualpages: Update to include addon help links for addons with menu entries
- Some addons have menu entries and currentlky these do not have any links to their
   help pages
- Ran check_manualpages and confirmed that all links to wiki pages are existing.

- Tested for guardian and wio

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-05 11:59:59 +00:00
Peter Müller
c1ba35e8ab graphs.pl: Display spoofed and hostile traffic in firewall hits diagram as well
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-01-14 14:17:03 +00:00
Peter Müller
86cf6898aa Merge branch 'master-IDSv3' into temp-c164-development 2022-01-14 14:05:10 +00:00
Stefan Schantl
2f62fd0007 ids-functions.pl: Create default rules file file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-01-08 16:25:17 +01:00
Stefan Schantl
e498947d3a ids-functions.pl: Log the download attempt of a ruleset.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-01-02 09:55:59 +01:00
Stefan Schantl
1b71e2b3c6 Revert "ids-functions.pl: Check if the generated stored rulesfile of a provider"
This commit causes massive troubles in the downloader and therefore
needs to be reverted.

This reverts commit 577e330495.
2022-01-02 09:52:02 +01:00
Stefan Schantl
cad087c74e ids-functions.pl: Check if given filename exists bevore call stat on it.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-01-02 09:49:37 +01:00
Stefan Schantl
dffce1e270 ids-functions.pl: Proper return flase if the downloaded rulestarball
cannot be stored.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-01-02 09:48:55 +01:00
Adolf Belka
4df6daf381 advoptions-list: Add additional dhcp options - fixes bug 12291
- Add ms-classless-static-routes and rfc3442-classless-static-routes as options for dhcp
   These are apparently required for deployiong classless IP routes
- Original static-routes option is not intended for classless IP routing but is being
   left in place for backward compatibility
- The option "rfc3442-classless-static-routes" is for normal clients
- The option "ms-classless-static-routes" is for Microsoft clients

Fixes: bug 12291
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>
2021-12-28 23:03:49 +01:00
Stefan Schantl
ec418b7a08 ids-functions.pl: Drop accidently commited debug output.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 15:46:05 +01:00
Stefan Schantl
c1ccae1ce3 ids-functions.pl: Set bypass flag for whitelisted hosts.
When adding a host to the whitelist set the bypass flag to
immediate take the load from the IDS.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 15:41:43 +01:00
Stefan Schantl
43d12991d1 ids-functions.pl: Dynamically generate file of default suricata rules.
The "/var/ipfire/suricata/suricata-default-rules.yaml" file, now
dynamicall will be generated, based on the enabled application layer
protocols.

Only existing rulefiles for enabled app layer protocols will be loaded.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 15:37:16 +01:00
Stefan Schantl
bb39fac437 ids-functions.pl: Add get_suricata_enable_app_layer_protos().
This function call suricata to obtain a list of enabled application
layer protocols (application/protocol parsers).

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 15:32:52 +01:00
Stefan Schantl
7ccea46172 ids-functions.pl: Remove config files when cleaning up the rules
directory.

If there are one, they safly can be removed because the *.config files
now live in a different folder.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:32:21 +01:00
Stefan Schantl
6983a96eff ids-functions.pl: Adjust classification file for new path.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:31:53 +01:00
Stefan Schantl
c68bcbb298 ids-functions.pl: Do not call stat if no file has been given.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:25:46 +01:00
Stefan Schantl
577e330495 ids-functions.pl: Check if the generated stored rulesfile of a provider
exists before returning the filename.

This will prevent from using and processing non existing files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:25:26 +01:00
Stefan Schantl
057e895351 ids-functions.pl: Proper return N/A if no ruleset date could be
determined.

If no timestamp could be grabbed for rulestarball of a given provider,
return N/A.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:45 +01:00
Stefan Schantl
fc685a36c5 ids-functions.pl: Return N/A if not date for a ruleset could be
determined.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:45 +01:00
Stefan Schantl
a081f20390 ids-functions.pl: Fix writing for used provider rulefiles.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:44 +01:00
Stefan Schantl
5b43f9db15 ids-functions.pl: Remove as deprecated marked variables.
They are not needed anymore.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:44 +01:00
Stefan Schantl
1b0e555fd3 ids-functions.pl: Only write existing provider specific used rulesfiles
files into main include yaml file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:44 +01:00
Stefan Schantl
69b3156f74 IDS: Move read_enabled_disabled_sids_file() function to ids-functions.pl.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:44 +01:00
Stefan Schantl
52071c0e9e Revert "ids-functions.pl: Remove config files on rulesdir cleanup."
Not all config files are shipped by the rulesets. For example the
"threshold.conf" and the "referneces.conf" are not include in each
ruleset.

Therefore it is not a common way to delete all config files. It is
much safer to simple keep them and overwrite existing ones by the
generated ones.

This reverts commit a71c3c9dcc60541aa4504d0f1fb0a78c0d58ed5e.
2021-12-19 13:23:43 +01:00
Stefan Schantl
1b5aec1b7d ids-functions.pl: Move code to handle plain rules files to
extractruleset() function.

Now everithing which is extracting or moving stored ruleset files is
easily accessing via one function which takes care about.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
01fc880cf3 ids-functions.pl: Only read providers used rulefiles file if it exists.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
35bc92a307 ids-functions.pl: Fix accidently commited debug file path.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
1d860d89cb ids-functions.pl: Check if the file exists bevore adding it to the
oinkmaster provider includes file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
d878d9c014 ids-functions.pl: Introduce alter_oinkmaster_provider_includes_file().
This function can be used to directly modify the desired file.

It takes two arguments:
 * An action which could be "add" or "remove"
 * A provider handle, which should be added or removed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
5b9d877d46 ids-functions.pl: Introduce get_oinkmaster_provider_modified_sids_file()
function.

This function simply returns the gernerated path and filename for the
provider specific modified sids file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
15832b10c2 IDS: Redesign backend for enabled/disabled sids in rulefiles.
The enabled or disabled sids now will be written to an own
provider exclusive configuration file which dynamically will
be included by oinkmaster if needed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:43 +01:00
Stefan Schantl
88eb5626b3 ids-functions.pl: Bring back usage of whitelist.rules and local.rules
files.

They now automatically will be included as static includes if the files
are present.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:42 +01:00
Stefan Schantl
f580aa8caa ids-functions.pl: Introduce get_ruleset_date() function.
This function is used to get the creation date of the stored rules files
of a given provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:42 +01:00
Stefan Schantl
ddaf8ae1a8 IDS: Redesign backend for used provider rulesfiles.
The selected rulesfiles of a provider now will be written to an own
provider exclusive yaml file, which will be included dynamically when
the provider is enabled or not.

This allows very easy handling to enable or disable a provider, in this
case the file which keeps the enabled providers rulesets only needs to
be included in the main file or even not.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:32 +01:00
Stefan Schantl
50f348f681 ids-functions.pl: Introduce move_tmp_ruleset() function.
This function is used to move an extracted temporary ruleset to
the rules location.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
e31458de4e ids-functions.pl: Fix another typo.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
6acaa5fa6f ids-functions.pl: Remove accidently commited debug code.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
0130e0d1e1 ids-functions.pl: Rework oinkmaster() to use get_enabled_providers
function.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
5e20d6cb28 ids-functions.pl: Introduce get_enabled_providers() function.
This function simply returns an array with all enabled ruleset
providers.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
dae33250b2 ids-functions.pl: Fix typo.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00