Commit Graph

378 Commits

Author SHA1 Message Date
Arne Fitzenreiter
69d90c36cc network-functions.pl: declare use of smartmatch
perl complains about the use of experimental smartmatch feature
if it is not declared.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-02-01 10:45:38 +00:00
Leo-Andres Hofmann
eea288bc1a network-functions.pl: Improve zone configuration functions
Cache ethernet configuration in public variable "ethernet_settings",
add functions to simplify working with the network configuration.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-01-25 19:32:40 +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
Leo-Andres Hofmann
56d37c8dbf header.pl: Remove duplicate "IpInSubnet" function
This function is deprecated. The commonly used and maintained "IpInSubnet" function can be found in general-functions.pl.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-01-13 10:52:49 +00:00
Adolf Belka
5b4e33bc3b general-functions.pl: Update to fix bug #12428
- Patch of general-functions.pl for implementation of fix provided
	by Bernhard Bitsch in bug #12428.
	Had to be modified as that fix gave a failure for single character hostnames.
	Updated version prevents spaces being put into hostnames and works for single
	character hostnames
- Updated subroutine validfqdn to apply consistent rules for hostname & domain name
	portions of fqdn
- Minor updates for consistency across validhostname, validdomainname & validfqdn
- Patch implemented into testbed system and confirmed working for hostnames, domain names
	and FQDN's.

Signed-off-by: Adolf Belka <ahb.ipfire@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-01-04 10:44:20 +00:00
Stefan Schantl
aa9dd5386c location-functions.pl: Remove accidently keept 2nd DB init call.
The get_full_country_name() function had an accidenlty and not longer
required call of the DB init function.

This is a waste of memory and a known problem, especially on systems
with less than 1GB of RAM, where the application which uses libloc in
such a redundant way crashes.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-12-02 14:16:54 +00:00
Peter Müller
7b82ca1fc8 location-functions.pl: add functions for fetching AS information
The second version of this patch only unifies the licence banner, but
leaves GPLv2 untouched. In addition, functions have been changed to use
a script-wide location database handle, as introduced in commit
b62d7e0cc7.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-11 16:01:47 +00:00
Stefan Schantl
427190d578 locations-functions.pl: Allow get_locations() function to skip special locations.
When adding "no_special_locations" to the function call as argument
the special locations liks "A1, A2, A3 etc" will not be added to the
returned array as available locations.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-09 14:07:14 +00:00
Stefan Schantl
5bf91fe1b1 location-functions.pl: Add get_continent_code() function.
This tiny function is used to get the continent code for a given
country code.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-09 14:07:09 +00:00
Stefan Schantl
f46fd07814 location-functions.pl: Add END block to release the database handle.
Reference #12515.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-09 14:07:00 +00:00
Stefan Schantl
b62d7e0cc7 location-functions.pl: Use a single script-wide db_handle.
Create and use a single script-wide database handle for libloc to
prevent from creating multiple ones.

This helps saving memory, especially on small systems.

Reference #12515.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-11-09 14:06:53 +00:00
Leo-Andres Hofmann
c27b8825be Improve DHCP dynamic leases list usability. Active and expired leases are now grouped and the list is divided by a horizontal line. Sorting and creating static leases remains unchanged.
Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-23 10:07:08 +00:00
Leo-Andres Hofmann
934a376918 Improve indentation and HTML output of PrintActualLeases & leasesort
Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-23 10:07:03 +00:00
Michael Tremer
79131c6e47 firewall hits graph: Fix order of values
The fields were mixed up and therefore graph showed incorrect
values.

Fixes: #12496
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-12 10:27:15 +00:00
Stefan Schantl
33975f578d ipinfo.cgi: Allow to display multiple flags.
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
278b8710bc general-functions.pl: 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
d443f504aa location-functions.pl: Add address_has_flag() function.
This function can be used to check if a given address has
one of the known flags like "Anonymous Proxy".

If this is true, the mapped special country code will be returned.

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
b868abd251 location-functions.pl: Refactor get_full_country_name() function to use the Location module.
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
79b564c8ce location-functions.pl: Refactor get_locations() function to use the Location module.
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
Matthias Fischer
2bba650947 graphs.pl: Standardize localization strings for entropy graphs
Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:21:53 +00:00
Matthias Fischer
03dd66d616 graphs.pl: Standardize localization strings for disk access graphs
Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:21:27 +00:00
Matthias Fischer
cc573a98d1 graphs.pl: Standardize temperature displays
Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:15:15 +00:00
Michael Tremer
8ffdc78c49 web UI: Add graph for connection tracking
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:13:10 +00:00
Matthias Fischer
fa088214bc graphs.pl: Added translation for 'ACPI Thermal Zone'
This patchset is based on https://git.ipfire.org/?p=people/ms/ipfire-2.x.git;a=commitdiff;h=4bf0d000ffe961cdc5d9dbd27b3a11f900b3daed

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:10:29 +00:00
Michael Tremer
6fc3625512 graphs: Fix rendering CPU graphs after number of cores decreased
Fixes: #12193 - cpu graphs cannot created if smt is disabled
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-09-19 19:05:46 +00:00
Michael Tremer
087e302381 general-functions.pl: Do not check IPsec subnets for VTI/GRE connections
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-08-20 17:56:03 +00:00
Peter Müller
cc9eb2d306 network-functions.pl: add missing unit tests for changed, network membership procedure
Cc: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Cc: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-07-28 18:37:32 +00:00
Peter Müller
6386584baa network-functions.pl: fix network membership test
This is based on an orphaned patch provided by Tim FitzGeorge and
_finally_ fixes incorrect network membership calculations. Those were
are usability pain in the ass deluxe, as they rendered some combinations
of configuring OpenVPN and IPsec services unusable.

Fixes: #11235
Fixes: #12263

Cc: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Cc: Michael Tremer <michael.tremer@ipfire.org>
Cc: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-07-28 18:37:25 +00:00
Stefan Schantl
af7f9fc43d :xMerge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next-switch-to-libloc
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-07-03 18:48:30 +02:00
Michael Tremer
46b0f9ab44 web: Hide certain menu items when running in cloud environments
This used to be only hidden on AWS.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-06-19 17:14:58 +00:00
Michael Tremer
e7978f5671 gcloud: Add function to detect whether we are running on GCP
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-06-19 17:14:58 +00:00
Michael Tremer
4e58ab4bbf aws-functions.pl: Drop file and move functions to general-functions.pl
There is not enough stuff that it is justified to have an own file.

This patch therefore merges everything into general-functions.pl.

There are no functional changes.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-06-19 17:14:58 +00:00
Stefan Schantl
48152fae62 Transform geoip-functions.pl into location-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-12 17:42:41 +02:00
Stefan Schantl
e7b1b002c9 Revert "geoip-functions.pl: Add functions to export locations and to flush them."
This reverts commit e758c76384.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-10 21:27:06 +02:00
Stefan Schantl
51b6f07ce5 geoip-functions.pl: Provide the available locations in upper case.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-03 19:29:55 +02:00
Stefan Schantl
decef80c7e geoip-functions.pl: Remove non existing country codes.
o1 (Other country) and yu (Yugoslavia) have been used in the past
and are not part of libloc and therefore cannot be used anymore.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-03 19:15:43 +02:00
Stefan Schantl
8b58dbf32a Merge branch 'switch-to-libloc' into next-switch-to-libloc 2020-05-25 19:58:54 +02:00
Michael Tremer
7479c99349 ids-functions.pl: Quote array of subnets
Reported-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-20 12:39:17 +00:00
Stefan Schantl
adb320bc4a ids-functions.pl: Fix generating of HOME_NET declaration
Fixes #12407.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-18 20:09:07 +00:00
Peter Müller
33954320f9 graph.pl: fix intendation of user CPU load
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-09 12:17:35 +00:00
Peter Müller
a0774e3cc8 system.cgi: properly translate load average graph
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-09 12:17:23 +00:00
Peter Müller
e01c49b466 graphs.pl: use brackets instead of hypens
This simply makes more sense in most languages, as INPUT, OUTPUT and
FORWARD are special cases of firewall hits in general.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-09 12:14:01 +00:00
Peter Müller
992f944b3b graphs.pl: fix spelling of "SYN"
This merely is a cosmetic change, but since we are dealing with network
packets here, the SYN flag must be capitalised.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-09 12:12:35 +00:00
Stefan Schantl
25932be3e3 general-functions.pl: formatBytes() Fix computing the correct unit.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-01 19:14:36 +00:00
Stefan Schantl
c5f85b1152 general-functions.pl: Add formatBytes() function.
This function can be used to convert an amount of bytes to a
humand-readable format.

For example "3221225472" will become "3MB".

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-05-01 19:12:40 +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
7b97359b99 IDS: Add GREEN and BLUE addresses to the list of DNS servers.
Fixes #12349.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-05 07:35:08 +00:00
Arne Fitzenreiter
e8adbea97b general-functions.pl: Return unique list of nameservers
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-30 13:13:46 +01:00
Arne Fitzenreiter
99cadb743a ids-functions.pl: Fall back to $EXTERNAL_NET for DNS servers
When no DNS servers are configured (aka recursor mode), the
DNS servers that unbound will try to contact can be anywhere.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-30 13:07:01 +01:00
Arne Fitzenreiter
b76118c32c ids-functions.pl: Fix generating DNS_SERVERS
The configuration file has an invalid syntax which causes
suricata to fail to start.

There was no comma inserted between DNS servers when there
was more than two of them. This is now fixed in this patch..

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-01-30 12:51:31 +01:00