]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/log
people/stevee/ipfire-2.x.git
2 years agoids-functions.pl: Create default rules file file. master-IDSv3
Stefan Schantl [Sat, 8 Jan 2022 15:25:17 +0000 (16:25 +0100)] 
ids-functions.pl: Create default rules file file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agosuricata: Set correct ownership for default rules file.
Stefan Schantl [Sat, 8 Jan 2022 15:17:09 +0000 (16:17 +0100)] 
suricata: Set correct ownership for default rules file.

The file has to be write-able for the WUI.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Set correct ownership for default rules
Stefan Schantl [Sat, 8 Jan 2022 15:16:47 +0000 (16:16 +0100)] 
convert-ids-multiple-providers: Set correct ownership for default rules
file.

Otherwise the file would belong to root and is not write-able by the
WUI.

Fixes #12759.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Do not try to set ownership for file
Stefan Schantl [Sat, 8 Jan 2022 14:58:17 +0000 (15:58 +0100)] 
convert-ids-multiple-providers: Do not try to set ownership for file
which is not longer used.

Fixes #12758.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoruleset-sources: Update download URL for Talos rulesets.
Stefan Schantl [Sun, 2 Jan 2022 09:34:44 +0000 (10:34 +0100)] 
ruleset-sources: Update download URL for Talos rulesets.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Log the download attempt of a ruleset.
Stefan Schantl [Sun, 2 Jan 2022 08:55:59 +0000 (09:55 +0100)] 
ids-functions.pl: Log the download attempt of a ruleset.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoRevert "ids-functions.pl: Check if the generated stored rulesfile of a provider"
Stefan Schantl [Sun, 2 Jan 2022 08:52:02 +0000 (09:52 +0100)] 
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 577e3304953c708bce7f6c067bf34c3f585d3a0f.

2 years agoids-functions.pl: Check if given filename exists bevore call stat on it.
Stefan Schantl [Sun, 2 Jan 2022 08:49:37 +0000 (09:49 +0100)] 
ids-functions.pl: Check if given filename exists bevore call stat on it.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Proper return flase if the downloaded rulestarball
Stefan Schantl [Sun, 2 Jan 2022 08:48:55 +0000 (09:48 +0100)] 
ids-functions.pl: Proper return flase if the downloaded rulestarball
cannot be stored.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agosuricata.yaml: Set collection of stat to off.
Stefan Schantl [Sun, 19 Dec 2021 14:55:45 +0000 (15:55 +0100)] 
suricata.yaml: Set collection of stat to off.

Suricata will print a warning on startup if the collection of stats
is enabled but no stats logger, which will print them out is enabled.

Acctually we do not use any stats so this safely can be disabled.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agosuricata.yaml: Set default log level to Info.
Stefan Schantl [Sun, 19 Dec 2021 14:53:55 +0000 (15:53 +0100)] 
suricata.yaml: Set default log level to Info.

This will prevent suricata from displaying a warning on startup and
anyway would be the log level which suricata switches in such a case.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agosuricata.yaml: Add config options for modbus, dnp3 and enip protocols.
Stefan Schantl [Sun, 19 Dec 2021 14:51:58 +0000 (15:51 +0100)] 
suricata.yaml: Add config options for modbus, dnp3 and enip protocols.

All of them are disabled by default, but may be needed in some
environments and so easily can be enabled there.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Drop accidently commited debug output.
Stefan Schantl [Sun, 19 Dec 2021 14:46:05 +0000 (15:46 +0100)] 
ids-functions.pl: Drop accidently commited debug output.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Set bypass flag for whitelisted hosts.
Stefan Schantl [Sun, 19 Dec 2021 14:41:43 +0000 (15:41 +0100)] 
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>
2 years agoids-functions.pl: Dynamically generate file of default suricata rules.
Stefan Schantl [Sun, 19 Dec 2021 14:37:16 +0000 (15:37 +0100)] 
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>
2 years agoids-functions.pl: Add get_suricata_enable_app_layer_protos().
Stefan Schantl [Sun, 19 Dec 2021 14:32:52 +0000 (15:32 +0100)] 
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>
2 years agosuricata: Fix ownership of the classification.config file.
Stefan Schantl [Fri, 3 Dec 2021 14:57:17 +0000 (15:57 +0100)] 
suricata: Fix ownership of the classification.config file.

The file has to be write-able for the nobody user.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Remove config files when cleaning up the rules
Stefan Schantl [Fri, 3 Dec 2021 14:53:20 +0000 (15:53 +0100)] 
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>
2 years agoids-functions.pl: Adjust classification file for new path.
Stefan Schantl [Fri, 3 Dec 2021 14:52:19 +0000 (15:52 +0100)] 
ids-functions.pl: Adjust classification file for new path.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agosuricata: Load *.config files from default location
Michael Tremer [Fri, 19 Nov 2021 17:44:56 +0000 (17:44 +0000)] 
suricata: Load *.config files from default location

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2 years agoids-functions.pl: Do not call stat if no file has been given.
Stefan Schantl [Thu, 2 Dec 2021 06:44:52 +0000 (07:44 +0100)] 
ids-functions.pl: Do not call stat if no file has been given.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Check if the generated stored rulesfile of a provider
Stefan Schantl [Thu, 2 Dec 2021 06:43:00 +0000 (07:43 +0100)] 
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>
2 years agoupdate-ids-ruleset: Early exit script if lockfile exists.
Stefan Schantl [Sun, 27 Jun 2021 17:22:24 +0000 (19:22 +0200)] 
update-ids-ruleset: Early exit script if lockfile exists.

This prevents from running the script while the WUI is performing
operations at the same time or to launch multiple instances of the
script.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Use experimental smartmatch.
Stefan Schantl [Wed, 12 May 2021 17:51:36 +0000 (19:51 +0200)] 
ids.cgi: Use experimental smartmatch.

This will prevent from spawning the http error log with warnings.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Do not expect a space after the msg tag has been closed while
Stefan Schantl [Wed, 12 May 2021 17:44:43 +0000 (19:44 +0200)] 
ids.cgi: Do not expect a space after the msg tag has been closed while
processing rules.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Proper return N/A if no ruleset date could be
Stefan Schantl [Fri, 16 Apr 2021 18:27:20 +0000 (20:27 +0200)] 
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>
2 years agoids.cgi: Always write used providers rulefiles file.
Stefan Schantl [Wed, 14 Apr 2021 19:12:36 +0000 (21:12 +0200)] 
ids.cgi: Always write used providers rulefiles file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add the provider handle if the forced update of a provider
Stefan Schantl [Wed, 14 Apr 2021 18:38:59 +0000 (20:38 +0200)] 
ids.cgi: Add the provider handle if the forced update of a provider
fails.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Return N/A if not date for a ruleset could be
Stefan Schantl [Wed, 14 Apr 2021 18:37:50 +0000 (20:37 +0200)] 
ids-functions.pl: Return N/A if not date for a ruleset could be
determined.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add some more sanity checks when adding a new provider.
Stefan Schantl [Wed, 14 Apr 2021 18:32:14 +0000 (20:32 +0200)] 
ids.cgi: Add some more sanity checks when adding a new provider.

* Check if the system is online.
* Check if enough free disk space is available.
* Abort whith an error message if the ruleset could not be
  downloaded.

In error case the provider now will be removed again from the file which
keeps the configured providers. Sadly it needs to be added first because
otherwise the downloader could not read the required values from it.....

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Use newly intruduced functions when removing a provider.
Stefan Schantl [Wed, 14 Apr 2021 18:19:27 +0000 (20:19 +0200)] 
ids.cgi: Use newly intruduced functions when removing a provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Introduce remove_provider().
Stefan Schantl [Wed, 14 Apr 2021 18:18:47 +0000 (20:18 +0200)] 
ids.cgi: Introduce remove_provider().

This function is used to remove a configured provider by it's ID.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Introduce get_provider_handle().
Stefan Schantl [Wed, 14 Apr 2021 18:18:01 +0000 (20:18 +0200)] 
ids.cgi: Introduce get_provider_handle().

This function is used to get the configured provider handle by a a given ID.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Regenerate ruleset if a provider get re-enabled.
Stefan Schantl [Tue, 13 Apr 2021 18:18:46 +0000 (20:18 +0200)] 
ids.cgi: Regenerate ruleset if a provider get re-enabled.

Otherwise it could happen, that there are no rules files for this
specific provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Fix check when changing the IDS to monitor mode or drop mode.
Stefan Schantl [Tue, 13 Apr 2021 16:56:49 +0000 (18:56 +0200)] 
ids.cgi: Fix check when changing the IDS to monitor mode or drop mode.

The test condition was wrong here and therefore oinkmaster never has
been executed when this setting has been changed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Allow whitespaces when parsing the rules files.
Stefan Schantl [Tue, 13 Apr 2021 16:08:12 +0000 (18:08 +0200)] 
ids.cgi: Allow whitespaces when parsing the rules files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Fix setting ownership for the main
Stefan Schantl [Sun, 11 Apr 2021 07:02:33 +0000 (09:02 +0200)] 
convert-ids-multiple-providers: Fix setting ownership for the main
oinkmaster provider includes file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Fix writing for used provider rulefiles.
Stefan Schantl [Sat, 10 Apr 2021 16:59:19 +0000 (18:59 +0200)] 
ids-functions.pl: Fix writing for used provider rulefiles.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Proper open the oinkmaster providers
Stefan Schantl [Sat, 10 Apr 2021 16:54:35 +0000 (18:54 +0200)] 
convert-ids-multiple-providers: Proper open the oinkmaster providers
sids file for writing.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Fix typo which tried to load the wrong
Stefan Schantl [Sat, 10 Apr 2021 16:53:27 +0000 (18:53 +0200)] 
convert-ids-multiple-providers: Fix typo which tried to load the wrong
lib.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Remove old used rulefiles file.
Stefan Schantl [Wed, 7 Apr 2021 18:47:07 +0000 (20:47 +0200)] 
convert-ids-multiple-providers: Remove old used rulefiles file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Always remove old enabled / disabled
Stefan Schantl [Wed, 7 Apr 2021 18:45:32 +0000 (20:45 +0200)] 
convert-ids-multiple-providers: Always remove old enabled / disabled
sids files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-ids-multiple-providers: Restart suricata afterwards.
Stefan Schantl [Mon, 5 Apr 2021 06:44:00 +0000 (08:44 +0200)] 
convert-ids-multiple-providers: Restart suricata afterwards.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agobackup.pl: Launch convert-ids-multiple-providers if neccessary.
Stefan Schantl [Mon, 5 Apr 2021 06:03:38 +0000 (08:03 +0200)] 
backup.pl: Launch convert-ids-multiple-providers if neccessary.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoIDS: Add convert-ids-multiple-provider script.
Stefan Schantl [Mon, 5 Apr 2021 05:59:09 +0000 (07:59 +0200)] 
IDS: Add convert-ids-multiple-provider script.

This converter does all the magic to convert any suricata
based IPFire version to work with the new multiple providers
IDS.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Do not expect a space before the sid when parsing rulefiles.
Stefan Schantl [Mon, 5 Apr 2021 05:52:30 +0000 (07:52 +0200)] 
ids.cgi: Do not expect a space before the sid when parsing rulefiles.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoconvert-snort: Adjust converter to work with new IDS.
Stefan Schantl [Mon, 5 Apr 2021 05:39:29 +0000 (07:39 +0200)] 
convert-snort: Adjust converter to work with new IDS.

Only in case if somebody tries to import such an old backup.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Remove as deprecated marked variables.
Stefan Schantl [Mon, 5 Apr 2021 05:19:34 +0000 (07:19 +0200)] 
ids-functions.pl: Remove as deprecated marked variables.

They are not needed anymore.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoruleset-sources: Update download URL for Talos rulesets.
Stefan Schantl [Mon, 5 Apr 2021 05:13:45 +0000 (07:13 +0200)] 
ruleset-sources: Update download URL for Talos rulesets.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoruleset-sources: Add additional providers.
Stefan Schantl [Mon, 5 Apr 2021 05:12:00 +0000 (07:12 +0200)] 
ruleset-sources: Add additional providers.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Sort elements in providers dropdown menu.
Stefan Schantl [Mon, 5 Apr 2021 05:11:04 +0000 (07:11 +0200)] 
ids.cgi: Sort elements in providers dropdown menu.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Only write existing provider specific used rulesfiles
Stefan Schantl [Sun, 4 Apr 2021 10:22:13 +0000 (12:22 +0200)] 
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>
2 years agoIDS: Move read_enabled_disabled_sids_file() function to ids-functions.pl.
Stefan Schantl [Sun, 4 Apr 2021 08:15:27 +0000 (10:15 +0200)] 
IDS: Move read_enabled_disabled_sids_file() function to ids-functions.pl.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agobackup: Adjust includes file to include new IDS files into backups.
Stefan Schantl [Sun, 4 Apr 2021 06:25:36 +0000 (08:25 +0200)] 
backup: Adjust includes file to include new IDS files into backups.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoRevert "ids-functions.pl: Remove config files on rulesdir cleanup."
Stefan Schantl [Sun, 4 Apr 2021 06:15:48 +0000 (08:15 +0200)] 
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.

2 years agoids-functions.pl: Move code to handle plain rules files to
Stefan Schantl [Fri, 2 Apr 2021 18:22:15 +0000 (20:22 +0200)] 
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>
2 years agoids-functions.pl: Only read providers used rulefiles file if it exists.
Stefan Schantl [Fri, 2 Apr 2021 11:47:36 +0000 (13:47 +0200)] 
ids-functions.pl: Only read providers used rulefiles file if it exists.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Fix accidently commited debug file path.
Stefan Schantl [Fri, 2 Apr 2021 11:46:47 +0000 (13:46 +0200)] 
ids-functions.pl: Fix accidently commited debug file path.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoupdate-ids-ruleset: Port script to work with multiple providers.
Stefan Schantl [Fri, 2 Apr 2021 09:45:00 +0000 (11:45 +0200)] 
update-ids-ruleset: Port script to work with multiple providers.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agolangs-de.pl: Fix grammar.
Stefan Schantl [Fri, 2 Apr 2021 09:24:03 +0000 (11:24 +0200)] 
langs-de.pl: Fix grammar.

Even as a native speaker, it seems german sometimes is a very difficult language......

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add code to handle the reset of a provider to it's defaults.
Stefan Schantl [Fri, 2 Apr 2021 09:21:00 +0000 (11:21 +0200)] 
ids.cgi: Add code to handle the reset of a provider to it's defaults.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Make backend code for forced ruleset update working again.
Stefan Schantl [Fri, 2 Apr 2021 09:00:17 +0000 (11:00 +0200)] 
ids.cgi: Make backend code for forced ruleset update working again.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add section for additional provider actions.
Stefan Schantl [Fri, 2 Apr 2021 08:47:55 +0000 (10:47 +0200)] 
ids.cgi: Add section for additional provider actions.

This section only will be displayed when an existing provider will be
edited and allows to reset a provider back to it's defaults or to force
a ruleset update.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Fix display issue with colum backgound colour in provider list.
Stefan Schantl [Fri, 2 Apr 2021 08:12:02 +0000 (10:12 +0200)] 
ids.cgi: Fix display issue with colum backgound colour in provider list.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Handle oinkmaster provider includes when deleting a provider.
Stefan Schantl [Fri, 2 Apr 2021 08:05:12 +0000 (10:05 +0200)] 
ids.cgi: Handle oinkmaster provider includes when deleting a provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Fix function call of get_used_provider_rulesfile_file().
Stefan Schantl [Fri, 2 Apr 2021 08:04:21 +0000 (10:04 +0200)] 
ids.cgi: Fix function call of get_used_provider_rulesfile_file().

The function is locatated in the IDS module and therefore needs to be
called from there.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add/Remove provider file include in oinkmaster providers
Stefan Schantl [Fri, 2 Apr 2021 07:35:42 +0000 (09:35 +0200)] 
ids.cgi: Add/Remove provider file include in oinkmaster providers
include file when toggeling a provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Check if the file exists bevore adding it to the
Stefan Schantl [Fri, 2 Apr 2021 07:34:28 +0000 (09:34 +0200)] 
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>
2 years agoids-functions.pl: Introduce alter_oinkmaster_provider_includes_file().
Stefan Schantl [Fri, 2 Apr 2021 07:13:17 +0000 (09:13 +0200)] 
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>
2 years agoids.cgi: Use get_oinkmaster_provider_modified_sids_file() function.
Stefan Schantl [Fri, 2 Apr 2021 06:06:53 +0000 (08:06 +0200)] 
ids.cgi: Use get_oinkmaster_provider_modified_sids_file() function.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce get_oinkmaster_provider_modified_sids_file()
Stefan Schantl [Fri, 2 Apr 2021 06:04:46 +0000 (08:04 +0200)] 
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>
2 years agoIDS: Redesign backend for enabled/disabled sids in rulefiles.
Stefan Schantl [Thu, 1 Apr 2021 18:02:48 +0000 (20:02 +0200)] 
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>
2 years agoids-functions.pl: Bring back usage of whitelist.rules and local.rules
Stefan Schantl [Thu, 1 Apr 2021 14:36:13 +0000 (16:36 +0200)] 
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>
2 years agoids.cgi: Use get_ruleset_date() from ids-functions.pl.
Stefan Schantl [Thu, 1 Apr 2021 14:02:50 +0000 (16:02 +0200)] 
ids.cgi: Use get_ruleset_date() from ids-functions.pl.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce get_ruleset_date() function.
Stefan Schantl [Thu, 1 Apr 2021 14:02:04 +0000 (16:02 +0200)] 
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>
2 years agoids.cgi: Prevent from chainging the provider when editing an existing
Stefan Schantl [Thu, 1 Apr 2021 13:48:44 +0000 (15:48 +0200)] 
ids.cgi: Prevent from chainging the provider when editing an existing
one.

This commit locks the dropdown menu for selecting a provider, in case
an existing one should be edited.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Add hardcoded error message to language files.
Stefan Schantl [Thu, 1 Apr 2021 13:13:30 +0000 (15:13 +0200)] 
ids.cgi: Add hardcoded error message to language files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Fix check and message when trying to enable suricata without
Stefan Schantl [Thu, 1 Apr 2021 13:09:59 +0000 (15:09 +0200)] 
ids.cgi: Fix check and message when trying to enable suricata without
any enabled or no provider.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Lock the CGI when a provder will be deleted.
Stefan Schantl [Thu, 1 Apr 2021 10:02:45 +0000 (12:02 +0200)] 
ids.cgi: Lock the CGI when a provder will be deleted.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Drop old code to handle the settings of the ruleset section.
Stefan Schantl [Thu, 1 Apr 2021 09:55:40 +0000 (11:55 +0200)] 
ids.cgi: Drop old code to handle the settings of the ruleset section.

This entirely has been replaced by the providers section and the code to
handle the actions of this section.

Therefore this code is not longer needed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Finish code to handle the removal of a provider from the list.
Stefan Schantl [Thu, 1 Apr 2021 09:50:44 +0000 (11:50 +0200)] 
ids.cgi: Finish code to handle the removal of a provider from the list.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Finish code to handle toggeling a provider enabled/disabled.
Stefan Schantl [Thu, 1 Apr 2021 09:46:11 +0000 (11:46 +0200)] 
ids.cgi: Finish code to handle toggeling a provider enabled/disabled.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoIDS: Redesign backend for used provider rulesfiles.
Stefan Schantl [Thu, 1 Apr 2021 09:39:57 +0000 (11:39 +0200)] 
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>
2 years agoids.cgi: Add action if a new provider is added.
Stefan Schantl [Wed, 31 Mar 2021 11:41:28 +0000 (13:41 +0200)] 
ids.cgi: Add action if a new provider is added.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce move_tmp_ruleset() function.
Stefan Schantl [Wed, 31 Mar 2021 11:39:43 +0000 (13:39 +0200)] 
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>
2 years agoids-functions.pl: Fix another typo.
Stefan Schantl [Wed, 31 Mar 2021 10:31:18 +0000 (12:31 +0200)] 
ids-functions.pl: Fix another typo.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Remove accidently commited debug code.
Stefan Schantl [Wed, 31 Mar 2021 10:22:17 +0000 (12:22 +0200)] 
ids-functions.pl: Remove accidently commited debug code.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Rework oinkmaster() to use get_enabled_providers
Stefan Schantl [Wed, 31 Mar 2021 10:21:41 +0000 (12:21 +0200)] 
ids-functions.pl: Rework oinkmaster() to use get_enabled_providers
function.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce get_enabled_providers() function.
Stefan Schantl [Wed, 31 Mar 2021 10:16:24 +0000 (12:16 +0200)] 
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>
2 years agoids-functions.pl: Fix typo.
Stefan Schantl [Wed, 31 Mar 2021 10:16:01 +0000 (12:16 +0200)] 
ids-functions.pl: Fix typo.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids.cgi: Use get_used_rulesfiles function from ids-functions.pl.
Stefan Schantl [Wed, 31 Mar 2021 10:02:27 +0000 (12:02 +0200)] 
ids.cgi: Use get_used_rulesfiles function from ids-functions.pl.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce get_used_rulesfiles() function.
Stefan Schantl [Wed, 31 Mar 2021 10:01:22 +0000 (12:01 +0200)] 
ids-functions.pl: Introduce get_used_rulesfiles() function.

This function simply returns an array which contains the used rulesfiles
files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce drop_dl_rulesfile().
Stefan Schantl [Wed, 31 Mar 2021 09:26:24 +0000 (11:26 +0200)] 
ids-functions.pl: Introduce drop_dl_rulesfile().

This tiny function is used, to delete the stored rulesfile in case a
provider will be deleted.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Rework function for modify-sid file to be more
Stefan Schantl [Wed, 31 Mar 2021 08:49:19 +0000 (10:49 +0200)] 
ids-functions.pl: Rework function for modify-sid file to be more
generic.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Add cleanup_tmp_directory() function.
Stefan Schantl [Wed, 31 Mar 2021 08:45:14 +0000 (10:45 +0200)] 
ids-functions.pl: Add cleanup_tmp_directory() function.

As the name of the function already says, it is responsible to
delete all temporary files after ruleset generation.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Remove config files on rulesdir cleanup.
Stefan Schantl [Mon, 29 Mar 2021 14:53:52 +0000 (16:53 +0200)] 
ids-functions.pl: Remove config files on rulesdir cleanup.

They every time oinkmaster is called will be generated.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Rework oinkmaster() function.
Stefan Schantl [Mon, 29 Mar 2021 14:51:18 +0000 (16:51 +0200)] 
ids-functions.pl: Rework oinkmaster() function.

Rework the function to work with the latest changes and multiple
providers.

The function now does the following:

* Extract the stored rules tarballs for all enabled providers.
* Copy rules files for enabled providers which provide plain files.
* Still calls oinkmaster to set up the rules and modify them.
* Calls the merge functions for classification and sid to msg files.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Assign temporary rules and conf path to variables.
Stefan Schantl [Mon, 29 Mar 2021 13:50:04 +0000 (15:50 +0200)] 
ids-functions.pl: Assign temporary rules and conf path to variables.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Introduce merge_sid_msg() function.
Stefan Schantl [Mon, 29 Mar 2021 13:27:42 +0000 (15:27 +0200)] 
ids-functions.pl: Introduce merge_sid_msg() function.

This function is used to merge the sid to message mapping files
from various providers.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2 years agoids-functions.pl: Fix typo.
Stefan Schantl [Sun, 28 Mar 2021 10:49:56 +0000 (12:49 +0200)] 
ids-functions.pl: Fix typo.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>