Commit Graph

211 Commits

Author SHA1 Message Date
Stefan Schantl
1fa187335b ids.cgi: Add hardcoded error message to language files.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:42 +01:00
Stefan Schantl
4b6cf2a54a 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>
2021-12-19 13:23:42 +01:00
Stefan Schantl
106f00bdbb ids.cgi: Lock the CGI when a provder will be deleted.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:42 +01:00
Stefan Schantl
0943ad8c3f 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>
2021-12-19 13:23:42 +01:00
Stefan Schantl
2fded6d2ad ids.cgi: Finish code to handle the removal of a provider from the list.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:42 +01:00
Stefan Schantl
a2b4488ae5 ids.cgi: Finish code to handle toggeling a provider enabled/disabled.
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
b734df0e12 ids.cgi: Add action if a new provider is added.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
3daa300025 ids.cgi: Use get_used_rulesfiles function from ids-functions.pl.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:23:00 +01:00
Stefan Schantl
73eb03a333 ids.cgi: Add code to handle enable/disable a provider.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:59 +01:00
Stefan Schantl
9bf260ded2 ids.cgi: Add code to handle enable/disable autoupdate for a provider.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:59 +01:00
Stefan Schantl
7323c72d03 ids.cgi: Fix type in method.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:59 +01:00
Stefan Schantl
2acb3c8d00 ids.cgi: Remove accidently commited commented code snipped.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:59 +01:00
Stefan Schantl
bb4c30c653 ids.cgi: Correctly use "enabled" for checked checkboxes.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:59 +01:00
Stefan Schantl
aba3cbe5bc ids.cgi: Read-in providers settings file when neccessary.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:58 +01:00
Stefan Schantl
4c067847c5 ids.cgi: Add code to add/edit a ruleset provider.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:58 +01:00
Stefan Schantl
2f252efa0d ids.cgi: Rework rulesetsettings section.
* The page and section now supports multiple ruleset providers at once.
* Adding / Editing a ruleset provider has been moved to a own sub-page.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:58 +01:00
Stefan Schantl
77351a6b76 ids.cgi: Move configuration of ruleset autoupdate intervall to IDS main
section.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:58 +01:00
Stefan Schantl
87df37da7a ids.cgi: Stop showing ruleset date on customize rulest sub-page.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:22:47 +01:00
Stefan Schantl
4efc8ccd8a ids.cgi: Add "Back" button to customize ruleset sub-page.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
2bbe6ede23 ids.cgi: Move / Splitt main page and customize ruleset subpage.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
a468b62b62 ids.cgi: Only read-in ruleset if neccessary.
This process takes some time, especially on huge rulesets.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
dd2ce333f7 ids.cgi: Add button to customize the ruleset.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
019e5e9baf ids.cgi: Introduce and use get_provider_name() function.
This function is used to grab the name of a provider by the given
handle.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
fed57fe7f0 ids.cgi: Move the section to customize the IDS ruleset to a function.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
1033cf2d0a ids.cgi: Remove unused rulesetsources hashes.
They have been superseeded by the new ruleset sources file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Stefan Schantl
3e12c6e688 ids.cgi: Make CGI work with new ruleset-sources file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-12-19 13:21:51 +01:00
Michael Tremer
9268cddfd2 IPS: Do not try to show rules when stat on rules tarball fails
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-11-24 09:08:52 +00:00
Jonatan Schlag
8186b37230 Hardcode theme to ipfire
This disables the theme support and makes it impossible to use any other
themes than the ipfire default theme.

The only intention of this patch is to hardcode the theme to ipfire.
To change any cgi we have is an ugly way, but the only way to do this
fast. The colour handling needs certainly to be improved as well, but
this will and should be done in other patches.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-08 10:11:34 +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
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
1622e5c1f3 ids.cgi: Fix logic if suricata needs to be restarted.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-06 14:02:59 +00:00
Stefan Schantl
af8e5145fa ids.cgi: Restart suricata if necessary when altering the ruleset.
Suricata does support re-reading it's configuration files and therfore
we need to restart it, if one or more ruleset files should be loaded or
not loaded anymore.

If simple some rules inside the same files are activated or deactivated
we are still fine to call the reload method to send suricata the signal
to reload its ruleset.

Fixes #12340.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-01 14:41:51 +00:00
Stefan Schantl
51b63b4186 IDS: Allow to inspect traffic from or to OpenVPN
This commit allows to configure suricata to monitor traffic from or to
OpenVPN tunnels. This includes the RW server and all established N2N
connections.

Because the RW server and/or each N2N connection uses it's own tun?
device, it is only possible to enable monitoring all of them or to disable
monitoring entirely.

Fixes #12111.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-12-29 19:12:06 +00:00
Stefan Schantl
a40ee6b9bf ids.cgi: Generate and store the DNS server configuration.
This will be done by the recently added generate_dns_servers_file()
function from ids-functions.pl.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-11-13 19:13:25 +00:00
Stefan Schantl
81bae51f61 ids-functions.pl: Rework function write_modify_sids_file().
Directly implement the logic to determine the used ruleset and if
IDS or IPS mode should be used into the function instead of pass those
details as arguments.

This helps to prevent from doing this stuff at several places again and again.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-05 12:41:49 +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
0d34a479c8 ids.cgi: Display oinkcode section after page load when neccessary.
Fixes #12048.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-11 10:28:19 +01:00
Stefan Schantl
d0f9526beb ids.cgi: Add language string for ignored hosts section.
Fixes #12002.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-18 13:29:47 +01:00
Stefan Schantl
5fbd7b2982 ids.cgi: Format and show date of the current ruleset again
Fixes #11992

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 10:33:29 +01:00
Stefan Schantl
ee7fe87ea6 ids.cgi: Change name of the button to apply the ruleset changes
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 09:46:01 +01:00
Stefan Schantl
5bd8940d68 ids.cgi: Improve showed messages while the IDS is working
Reference #11993

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 08:51:31 +01:00
Stefan Schantl
9074e3d74c ids.cgi: Lock page while autoupdate script is running
Fixes #11991

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 08:24:15 +01:00
Stefan Schantl
5f2145eb59 ids.cgi: Show "Update Ruleset"-Button only if automatic updates are disabled
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 07:44:11 +01:00
Stefan Schantl
613f58fbfa ids.cgi: Check if the selected ruleset requires an oinkcode
Fixes #11983

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-06 12:49:01 +01:00
Stefan Schantl
f644a167ab ids.cgi: Only perform actions when saving ruleset settings, if there are no error messages
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-06 12:48:08 +01:00
Stefan Schantl
422dc4caf9 ids.cgi: Fix HTML formated spaces.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 14:34:44 +01:00
Stefan Schantl
9e9b477d7c ids.cgi: Rework "Enable IPS" section
Just use one language string for a maximum of flexiblity for the
transloators.

Fixes #11986

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 14:17:19 +01:00
Stefan Schantl
cc9057c014 ids.cgi: Change lang string from "Activate IPS" to "Enable IPS"
Reference #11986

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 13:51:08 +01:00
Stefan Schantl
97870bf29c ids.cgi: Stop suricata when the rulest source has been changed
If the ruleset source has been changed, it has to be configured again.
This happens because of different rule categories, filenames rule ID's etc.

In case suricata currently is running it has to be stopped and after the configuration
has been done by the user, it can be launched again.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 12:43:49 +01:00