Commit Graph

312 Commits

Author SHA1 Message Date
Peter Müller
40407aee99 ids.cgi: Fix upstream proxy validation
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-20 18:50:06 +01:00
Florian Bührle
1dcf513a41 webif: Add a GUI for configuring VLAN interfaces
This patch adds a new CGI file which allows users to edit the
VLAN configuration as well as configuring zones as bridges.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-08 12:15:27 +01:00
Michael Tremer
2dd5e64592 suricata: Do not always convert rules to be bi-directional
This creates some overhead that we do not need and rules need to
be adjusted to match any direction they are supposed to match.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-23 20:18:07 +01:00
Michael Tremer
26dc79a6fe suricata: Do not let oinkmaster be too verbose
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-17 21:24:25 +01:00
Michael Tremer
e96adc7797 suricata: Redirect oinkmaster output to perl function
The output was written to stderr before and landed in apache's
error log where we do not want it.

Fixes: #12004
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-17 20:59:55 +01:00
Michael Tremer
abe2149852 GeoIP: Do not crash when locations database does not exist
Fixes: #12021
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-22 02:58:57 +00:00
Michael Tremer
06f57f7230 general-functions.pl: Only skip lines with a # at the beginning
This accidientially dropped all lines that include #. That resulted
in colour codes not being loaded from file any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-18 11:36:37 +01:00
Stefan Schantl
7c3b7cdcca ids-functions.pl: Tune rules to always monitor in both directions.
This will allow to scan the traffic from an EXTERNAL_NET to the HOME_NET and from
the HOME_NET to the EXTERNAL_NET.

Reference: 10273

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-18 10:55:27 +01:00
Stefan Schantl
8076deba79 ids-functions.pl: Add code to lock/unlock ids page while autoupdating the ruleset
Reference #11991

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-07 07:59:20 +01:00
Stefan Schantl
155b3b56a8 ids-functions.pl: Do not send HEAD requests to sourcefire (snort.org) servers
Using this feature to fetch the size of the requested tarball is not allowed by these
servers, so skip this feature for their rulesets.

Fixes #11987

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-06 10:58:59 +01:00
Stefan Schantl
c17a9778d6 Revert "ids-functions.pl: Use GET method to fetch Header data of a file"
Using the GET method will download the file twice and does not provide the
desired mechanism here.

This reverts commit 81592314eb.
2019-02-06 10:00:17 +01:00
Stefan Schantl
81592314eb ids-functions.pl: Use GET method to fetch Header data of a file
The sourcfire web servers does not support the HEAD request so we have to do
this with a GET here.

Fixes #11987

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 12:01:43 +01:00
Stefan Schantl
4924cfdc73 ids-functions.pl: Fix show HTTP error code and message
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-02-05 11:55:37 +01:00
Stefan Schantl
bcbc9897e3 ids-functions.pl: Grab address for RED by using get_red_address() function.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-31 09:50:47 +01:00
Stefan Schantl
de8e1e5b6c ids-functions.pl: Add function to the the current assigned IP-address of RED.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-31 09:41:35 +01:00
Stefan Schantl
23c0347ac5 ids-functions.pl: Add RED address and aliases to the HOME_NET
Reference: #11981

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 12:51:51 +01:00
Stefan Schantl
77c3130174 ids-functions.pl: Add get_aliases()
This subfunction is used to get all configured and enabled aliases
for the RED network zone. They will be returned as an array.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-30 11:57:49 +01:00
Stefan Schantl
3c59b1fab8 ids-functions.pl: Set correct ownership for the stored error file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-29 08:58:08 +01:00
Stefan Schantl
1fedede6a0 ids-functions.pl: Add set_ownership() function.
This function is used to change the ownership of a given file
or directory to the user "nobody" and the group "nobody", which is
used by the WUI.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-29 08:50:16 +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
Michael Tremer
d499e86b16 GeoIP: Add accidentially removed paths to database
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-13 12:28:10 +01:00
Stefan Schantl
0ca3baedfc Revert "geoip-functions.pl: Re-write code to lookup the iso country code of a given IP-address."
Enhanching the code to fix the lookup will rapidely slow down the lookup speed. Because using
the GeoIP2 module is no option ( the reasons have been described in the commit message which will
now reverted), we have decided to temporary switch back to the old module until a nice solution has
been found.

This reverts commit ff21ff90d2.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-11 00:09:04 +00:00
Stefan Schantl
30c59cbb0b geoip-locations.pl: Add get_geoip_locations().
This function is used to get all available GeoIP locations.

The functions returns them as array, sorted in alphabetical order.

Reference #11959

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-10 22:42:52 +00:00
Stefan Schantl
ff21ff90d2 geoip-functions.pl: Re-write code to lookup the iso country code of a given IP-address.
Drop the usage of the old legacy GeoIP perl module which was not able to handle the
new GeoLite2 databases.

Write some code to directly access the databases and extract the required data.

Usage of the GeoIP2 perl module would provide a lot of more functionality which is not
used/needed. Unfortunately ir requires at lot of additional perl modules which are
not available on IPFire and would only be build and shipped for this module. Buildig all
of them will slow down the entire build process, mess up the system and requires a lot
more space on disk.

Fixes #11962.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-07 01:21:48 +00:00
Stefan Schantl
b749416ad7 ids-functions.pl: Downloader should reads settings from correct file
In commit ea5c8eeb83 the taken settings
for the ruleset have been stored into an own file.

The Downloader now uses this file to read-in which ruleset should be used
and downloaded.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2019-01-06 14:11:30 +01:00
Michael Tremer
d68e150e86 proxy: Drop web browser check
This is neither reliable nor up to date and is therefore removed

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:54:56 +01:00
Daniel Weismüller
1a3323f2e6 BUG 11786 - squid: Remove setting for filter processes the number of Squid processes
I added a function to determine the number of cores.
Now the number of squid processes will be equal to the number of logical cores.
Further I removed the possibility of changing the number
of squid processes in the proxy.cgi

Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: root <root@ipfire.test>
2019-01-08 02:02:05 +01:00
Stefan Schantl
6994f00174 ids-functions.pl: Downloader now also uses upstream proxy for HTTPS
Fixes #11953

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-26 16:33:54 +01:00
Stefan Schantl
04a0d07c97 ids-functions.pl: Add function to get the version of suricata
The get_suricata_version() function is used to get the version
of the on the system installed version of suricata. You can
specify the how detailed the returned result should be "major" will
return only the major version, were "minor" will provide the major
and minor version (1.2 for example). All other calls will be answered
with the full version string (1.2.3).

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-26 16:05:46 +01:00
Stefan Schantl
2ee510888c ids-functions.pl: Fix typo
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-25 20:19:12 +01: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
25b6545a6e ids-functions.pl: Use temporary file in downloader.
Download the requested rules tarball into a temporay file
and if every thing is fine, replace the old by the
downloaded one.

In addition with the previously implemented file size check,
we are saved now from a corrupt rules tarball on disk.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-18 15:14:08 +01:00
Stefan Schantl
96da5803a7 ids-functions.pl: Introduce filesize check for downloader
The downloader now requests the html header for the rulestarball
and obtain the size of the file bevore downloading it.

After success the size of the downloaded file will be compared with
the requested one before. If they do not match, an error will be gained.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-18 14:16:13 +01:00
Stefan Schantl
1201c1e746 ids-functions.pl: Fix sub _cleanup_rulesdir() function
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-12-18 14:12:52 +01:00
Stefan Schantl
8cf04a1656 ids-functions.pl: Rework &_cleanup_rulesdir() function
* Use a directory listing and delete the files.
* Keep files with "config" as file extension.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-10-12 15:43:16 +02:00
Stefan Schantl
4ce4248849 ids-functions.pl: Fix typo
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-10-12 15:18:38 +02:00
Stefan Schantl
883820bdcb ids-functions.pl: Call &_cleanup_rulesdir() function before calling oinkmaster.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-10-12 15:16:32 +02:00
Stefan Schantl
b59cdbeea5 ids-functions.pl: Add private function to cleanup the rules directory.
This private function is used to remove any files which are stored in the
IDS rules directory and prevent from any old (unneeded or conflicting) files
after an update or complete change of the ruleset source.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-10-12 15:12:10 +02:00
Stefan Schantl
ed06bc811f ids-functions.pl: Add backend code to handle the "cron" function of suricatactrl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-09-26 14:09:53 +02:00
Stefan Schantl
21cab141ec suricata: Rule files are now located in /var/lib/suricata
Place the rulefiles from now in "/var/lib/suricata".

Fixes #11834

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-29 12:37:44 +02:00
Stefan Schantl
be52c68a2d ids-functions.pl: Early abort downloadruleset() if no ruleset is configured
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-27 15:11:28 +02:00
Stefan Schantl
e568796bb0 ids-functions.pl: Also check and fix the permissions of rulespath
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-25 15:48:58 +02:00
Stefan Schantl
330759d88a ids-functions.pl: Add priviate function _check_rulesdir_permissions()
This function checks if all files located in /etc/suricata/rules are
writable by the effective user and group (nobody:nobody) and if not
calls suricatactl to fix it.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-24 14:55:40 +02:00
Stefan Schantl
308ba5e74c ids-functions.pl: Add function to create empty files
This generic function can be used to create any kind of emtpy files -
it just requires the full path and filename to work.

If the specified file exists at calltime, the function will abort
to prevent from overwriting existing files and content.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-24 07:37:10 +02:00
Stefan Schantl
d9711d91ef ids-functions.pl: Display error if oinkmaster cannot be executed
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-18 10:01:14 +02:00
Stefan Schantl
88daf7eb3a ids-functions.pl: Log correct error message if download fails
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-17 08:49:06 +02:00
Stefan Schantl
5240a80987 ids-functions.pl: Add function to call suricatactrl binary
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-11 22:10:29 +02:00
Stefan Schantl
796eea2154 ids-functions.pl: Add function to check if the IDS is running
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-08-05 14:23:45 +02:00