Commit Graph

181 Commits

Author SHA1 Message Date
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
Stefan Schantl
5709768b0b ids.cgi: Fix downloading rules if source changed
Fix the if statement to detect wheater the ruleset has been
changed and automatically download the new one.

Fixes #11984.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 12:36:30 +01:00
Stefan Schantl
b7a9b4edc2 ids.cgi: Update automatic download texts
Update the showed texts in the dropdown box as mentioned in the
bug report.

Fixes #11985

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 12:13:28 +01:00
Stefan Schantl
912d7472a8 ids.cgi: Automatically download ruleset if the ruleset source has been changed.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-31 08:55:05 +01:00
Stefan Schantl
e0cec9fe99 ids.cgi: Dynamically generate SHOW/HIDE for expanding or collapsing a ruleset category
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 10:53:17 +01:00
Stefan Schantl
cf02bf2f7d ids.cgi: Show IDS setting area only if a ruleset is present.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 10:12:11 +01:00
Stefan Schantl
013274d7d8 ids.cgi: Diplay reason, why a ruleset could not be downloaded, if the system is offline.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 10:05:14 +01:00
Stefan Schantl
5fd2e9d64a ids.cgi: Also download the ruleset when saving the ruleset settings
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:57:49 +01:00
Stefan Schantl
34a3843865 ids.cgi: Add dropdown option for Emergingthreats.net Pro rules.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:42:28 +01:00
Stefan Schantl
d618d67e01 ids.cgi: Only show "update ruleset" button if a ruleset is present
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:39:17 +01:00
Stefan Schantl
674912fc3a ids.cgi: Draw daemon status and setting in the same box.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:33:47 +01:00
Stefan Schantl
029b8ed2b1 ids.cgi: Show/Hide subscription code area dynamically.
Dynamically (Java Script) show/hide the area for entering the
subscription code / oinkcode based on the choosen ruleset.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:27:37 +01:00
Stefan Schantl
bc4a2223cc ids.cgi: Remove help text for obtaining an oinkcode
This information is only valid for sourcefire (snort) rulesets, may
confuse users and therefore should be handled in the wiki.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 09:25:34 +01:00
Stefan Schantl
9283e9b9cf ids.cgi: Move and rename GenerateIgnoreList() function to ids-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-22 13:25:13 +01:00
Stefan Schantl
c1a3401235 Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next-suricata 2019-01-21 13:04:13 +01:00
Matthias Fischer
d01b31914a snort: Update to 2.9.12
For details see:

Release notes:
https://snort.org/downloads/snort/release_notes_2.9.12.txt

Changelog:
https://snort.org/downloads/snort/changelog_2.9.12.txt

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-05 15:42:34 +00:00
Stefan Schantl
74cc8f5a3d ids-functions.pl: Introduce function write_modify_sids_file()
This function is used to write the corresponding file which
tells oinkmaster to alter the whole ruleset and finally
switches suricata into an IPS or IDS.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-25 18:49:57 +01:00
Stefan Schantl
b02e30fd81 ids.cgi: Move variable declaration to ids-functions.pl
Also move some functions from the cgi file to the library file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-25 18:26:21 +01:00
Stefan Schantl
53817b89c0 ids.cgi: Hack to use the correct language string for red network zone.
This hack is needed because "red" is used as "internet" in the language files
and "red1" contains the correct "red" translations.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-24 13:19:06 +01:00
Stefan Schantl
99b372b51d ids.cgi: Colourize network zones
Colourize the network with the proper colour.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-24 13:18:14 +01:00
Stefan Schantl
01d02eb63b ids.cgi: Change RUN_MODE to MONITOR_TRAFFIC_ONLY
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-24 10:04:55 +01:00
Stefan Schantl
ea5c8eeb83 ids.cgi: Seperate IPS and ruleset settings
Now each of both have their own corresponding configuration areas.
The taken settings will be saved in "/var/ipfire/suricata/settings" for
all IDS/IPS related settings and in "/var/ipfire/suricata/rules-settings" for
ruleset related settings.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-24 08:26:39 +01:00
Stefan Schantl
ebdd0f9a90 ids.cgi: Prevent from starting suricata without ruleset or selected network zone
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-20 13:18:48 +01:00
Stefan Schantl
0a1bba1a1d ids.cgi: Access ruleset by its own name
This improves accessing the single rules of a rule category.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-20 11:55:13 +01:00
Stefan Schantl
8353c3fd36 ids.cgi: Allways use the whitelist
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-18 15:19:30 +01:00
Peter Müller
0c451a4a32 fix downloading Snort rules if behind upstream proxy
Currently, the wget call only uses proxy information for HTTP.
Since rulesets are downloaded via HTTPS now, the same information
also needs to be applied for HTTPS.

Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-11-01 10:30:08 +00:00
Stefan Schantl
eadad5fda6 ids.cgi: Add support for autoupdate of the IDS ruleset
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-26 14:43:09 +02:00
Stefan Schantl
dae534f2ca ids.cgi: Only write oinkmaster-modify-sids.conf if neccessary.
Only write to the file if the runmode of the IDS has been changed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-26 13:02:28 +02:00
Stefan Schantl
43ab7d9c30 ids.cgi: Set state of used rulefile to on if it contains rules
Only set the state of a used rulefile to "on" if it is present in
the %idsrules hash. This happens if it contains at least one rule.

This prevents from showing a rulefile in the ruleset section if, it
does not exist anymore or does not contains any rules at all.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-11 12:00:31 +02:00
Stefan Schantl
b7e2974394 ids.cgi: Introduce whitelisting of IP-addresses
If an IP-address has been added to the whitelist, any traffic from
this host will not longer inspected by suricata.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-11 11:58:11 +02:00
Stefan Schantl
80bcd4dd1a ids.cgi: Hide rules config section if no rules a present
Do not show the rules config section anymore if there is not
ruleset available.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-30 18:18:26 +02:00