Commit Graph

49 Commits

Author SHA1 Message Date
Michael Tremer
c1d77628c3 guardian: Use new system methods
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-10 14:30:53 +01:00
Robin Roevens
8b68ed1226 misc-progs: getipstat: Refactor + extend
* Return output of iptables directly instead of writing it to files.
 * Make iptables wait for 5s if xtables is locked by another iptables
 process. (--wait 5 argument)
 * Add optional parameter "-x" to have iptables report exact numbers.
 * Add optional parameter "-f" to display  the filter table  (default).
 * Add optional parameter "-n" to display the nat table.
 * Add optional parameter "-m" to display the mangle table.
  * Adapt iptables.cgi and guardian.cgi to catch getipstat output
  instead of reading temp-files.

Signed-off-by: Robin Roevens <robin.roevens@disroot.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-05-04 14:27:27 +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
Stefan Schantl
dd7aef35a9 guardian.cgi: Drop unused use of Locale::Codes::Country.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-09-24 17:36:38 +00:00
Stefan Schantl
9f9b2b8ebc guardian: Remove code for DNS servers.
In the past this code was used to add the DNS servers
to the ignore list and prevent them from being blocked by
guardian.

Because of the switch to suricata as IPS, guardian now prevents
from password brute-forcing on SSH and/or the webserver, so this
code is not longer needed and safly can be removed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-01-09 09:15:05 +01:00
Stefan Schantl
d2b54a312f guardian: Remove snort related options.
IPFire has moved to suricata as IDS/IPS system, therefore all snort related
options has become obsolete.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-05-08 19:20:08 +02:00
Stefan Schantl
a4a1f16c17 guardian.cgi: Remove support for owncloud
Owncloud as an addon has been dropped for IPFire. As a result of this,
we do not need this code anymore.

Fixes #11572.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-07-03 10:33:43 +01:00
Matthias Fischer
d68ead3dec Fix for guardian-CGI: As a result of fixing BUG11318
This is necessary because commit bf1985fae5baca327fcded31264f45638442f02e changes the
place where temporary files from 'iptables' are stored.

Some typos where fixed, too.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-04-18 11:22:13 +01:00
Matthias Fischer
c5f633c917 guardian 2.0: suggested cosmetic changes
I did the following:

- Rearranged the fields on 'guardian.cgi' a bit - in a (hopefully) logical manner,
  so that they don't need so much room.
- Added some translation-strings and explanations to (revised) 'guardian.cgi'.
- Added missing language string(s), deleted obsolete.
- Deleted all guardian entries from standard language files in
  '/var/ipfire/langs'-directory.
- Added (upgraded) addon-specific language files to '/var/ipfire/addon-lang'-directory.

I hope, I didn't forget something...

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-10-03 12:12:13 +01:00
Stefan Schantl
dadee76d7b guardian.cgi: Fix path to snort alert file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:19:14 +02:00
Stefan Schantl
f617f21cc0 guardian.cgi: Prevent from using "syslog" and "debug".
When using syslog as log facility and debug as log mode,
syslog does not log anything.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:19:14 +02:00
Stefan Schantl
efd9c5ffb4 guardian.cgi: Also generate ignore file when building the configuration.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:19:14 +02:00
Stefan Schantl
2daa1f5bb2 guardian.cgi: Show/Hide options using Java Script.
The options for configuring the log file location and
snort alert priority level now dynamically will be
displayed or hidden if the desired options or feature
is not used.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
2d17c6e6b8 guardian.cgi: Add support for selecting the used firewall action.
This will allow to choose between DROP and REJECT if guardian blocks an
attackers address.

Fixes #10xxx.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
1cc653239f guardian.cgi: Use new feature of ignore file inclusion.
Add support and usage of the recently introduced feature of
including other files in the ignore file to add
the red related IP-addresses to the ignore list on IPFire
systems.

Also use reload-ignore-list feature instead of reloading the
whole configuration on ignore list modifications.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
c880c2cb8a guardian.cgi: Create config and ignore file if they does not exist.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
62fd0e6fc7 guardian.cgi: Prevent from blocking the used DNS servers.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
c232e3489a guardian.cgi: Use private subfunction for gateway and DNS server detection.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
97849142bd guardian.cgi: Add function to generate the guardian.ignore file.
This function is responsible for collecting all required data,
like the green, blue, orange (if the interfaces are available),
red, gateway and used DNS server IP-addresses.

It will add als these addresses and the configured and enabled
user-defined ignored addresses/networks to the ignore file of
guardian to prevent from blocking any of them.

Note:

The IPFire and RED inteface related addresses also will be added
to the ignore file, even if there is no user-defined entry in the
list.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
7edbe06374 guardian.cgi: Use ignored config file.
The CGI now uses an own ignored configuration file for
storing host addresses and/or subnets which should be
ignored by guardian.

This allows to add remarks for them and to enable or disable
each entry individally at any time.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
891ba055f2 guardian.cgi: Use "getipstat" binary.
Rework the GetBlockedHosts() to use the "getipstat" binary
instead of the not longer available "guardianctrl" binary.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
af6856afc4 guardian.cgi: Send commands through socket connection.
The guardianctrl binary does not longer exists, use
the Guardian::Socket module to send various commands
by using the provided socket client.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
5295899104 guardian.cgi: Adjust code for generating the config file.
The config file format and values have been changed, so the
code to do the generation has to be adjusted.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
d530537998 guardian.cgi: Drop option for configure the path to the snort alertfile.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
723648ac92 guardian.cgi: Rename hash keys for enabled modules.
Rename the hash key names of enabled parser modules,
(services which should be monitored by guardian) to
keep the same name sheme than in the guardian config
file.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
b5f7d90327 guardian.cgi: Adjust CGI to use Locale::Codes::Country.
The module has been renamed some time ago.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:56 +02:00
Stefan Schantl
eff1feb8c7 guardian.cgi: Disable debugging.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Matthias Fischer
b1597f879c guardian.cgi: Suppress warnings for ${Header::colourgreen} variable.
Reference #10748.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Matthias Fischer
6a153ecdac guardian.cgi: Fix unititalized value "GUARDIAN_ENABLE_OWNCLOUD".
When the owncloud addon is not installed, this value was not
initialized correctly.

Reference #10748.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Matthias Fischer
922ddf0ef6 guardian.cgi: Use variable $pid instead of array element.
This will prevent from a lot of perl suggestions in the
apache error log.

Reference #10748.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
bfb860ceb7 guardian.cgi: Fix path to meta-owncloud.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
28981fac68 guardian.cgi: Add configure options for owncloud.
The related options only will be displayed when the owncloud addon
has been installed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
36dbcf2e43 guardian.cgi: Allways read-in settings.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
c973d6da10 guardian.cgi: Some more input validation.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
473c725721 guardian.cgi: Correct indentation when writing out the config file.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
4a7fc9f634 guardian.cgi: Add dropdown for PriorityLevel selection.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
96655fa6b7 guardian.cgi: Fix and improve input validation.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
f8c3bfe050 guardian.cgi: Reload guardian if config or the ignorelist changes.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
a35a066845 guardian.cgi: Add option to configure the BlockCount.
Some small code fixes.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
06ff7e28d7 guardian.cgi: Accidently hardcoded some descriptions.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
7899718f04 guardian.cgi: Add dropdown to select the used loglevel.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
a67b3e2dc5 guardian.cgi: Remove code for options which have been dropped from guardian.
Guardian does not longer require the information for the red interface from
the configfile.

Guardian does not longer support a targetfile.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
26fcd31e1f guardian.cgi: Add options to enable/disable some built-in functions from guardian.
This commit allows to enable or disable the monitoring of the snort alertfile
and to switch off the blocking of SSH and HTTPD Brute-force attempts.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
d2fea55e09 guardian.cgi: Remove code for Blockinterfaces.
We don't need this code anymore because we dropped interface support
from guardian.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
1d5702a7c3 guardian.cgi: Connect subboxes with input elements to the main boxes.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
5f462919d9 guardian.cgi: Sort blocked IP addresses.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
8b8413e566 guardian.cgi: Add hyperlink to ipinfo page for blocked hosts.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
7f7285911c guardian.cgi: Autodetect the used interface for red.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00
Stefan Schantl
01dbccb11e guardian.cgi: New page to configure and interact with guardian.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2016-07-29 13:17:55 +02:00