Commit Graph

90 Commits

Author SHA1 Message Date
Adolf Belka
859f8e3d90 general-functions.pl: Fix for bug#12937
- The check for validwildcarddomainname did not allow wildcards of the form
   *.ipfire.org* which is the example given on the proxy.cgi page for excluded url's
   for the wpad file.
- A forum user sufferred from this problem and the bug was raised for it.
   https://community.ipfire.org/t/proxy-cgi-error-message-when-use-wildcard-in-wpad-excluded-url-s/8597
   forum user has tested the patch change and confirmed it solves the problem.

Fixes: Bug#12937
Suggested-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
2023-01-18 23:31:23 +00:00
Michael Tremer
ba4f53c565 proxy.cgi: Correctly validate domain lists
Fixes: #12925 - JVN#15411362 Inquiry on vulnerability found in IPFire
Reported-by: Noriko Totsuka <vuls@jpcert.or.jp>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-09-11 08:12:00 +00:00
Adolf Belka
0b4618f9a3 general-functions.pl: Fix for bug #12865 - Static IP address pools - Add network - Name wit>
- The fix for bug #12428 removed spaces from the validhostname subroutine as hostnames are
   not supposed to have spaces
- This resulted in spaces no longer being allowed for the Static IP Address Pools names
- New subroutine created called validccdname. This allows letters, upper and lower case,
   numbers, spaces and dashes

Fixes: Bug #12865
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
2022-06-25 09:14:22 +00:00
Stefan Schantl
47b2640d37 general-functions.pl: Do not die if no red interface could be determined.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2022-03-09 15:46:19 +00:00
Leo-Andres Hofmann
fa7735b68e Fix translations and clean general-functions.pl
This patch fixes two wrong translations now used by the new
user manual links feature and removes an abandoned constant.

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Tested-by: Bernhard Bitsch <bbitsch@ipfire.org>
2021-11-19 07:18:29 +01:00
Arne Fitzenreiter
a7b4f84711 general-functions: remove comment that system_output also in speed.cgi
this functions was removed from speed.cgi by reading kernel netowrk
statistics instead of parsing ip -s show ...

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-25 16:59:08 +00:00
Arne Fitzenreiter
110d4c8106 speed.cgi: reduce system load by copying two general-functions.
include general-functions.pl load and initialize many subfunctions that are not
needed by speed.cgi which was executed very often.
So this reduce the system load significant if webif was open in browser
and ajax-speed display enabled.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-22 16:15:34 +00:00
Michael Tremer
637eb94684 index.cgi: Remove left-over DNSSEC status warning
An error message is still shown although there is no option to disable
DNSSEC at the moment. The old marker file could still be present on
older machines.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-19 11:24:07 +00:00
Stefan Schantl
ca1f4a07ab firewalllog.dat: Proper display protocol names.
In some cases iptables logs the protocol number instead of the name.
When accessing the logs via the WUI, this number has been displayed as used
protocol, which is very hard to read and understand.

This commit adds a new function to the general-functions.pl, which
generates a hash to translate the protocol number into the protocol
name.

Fixes #11282.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-02 09:21:16 +00:00
Peter Müller
db4e10a6ec general-functions.pl: do not miscalculate when enumerating IPsec N2N subnet membership
Fixes: #11235

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>
2021-08-09 07:25:59 +00:00
Michael Tremer
2a52353f3c general-functions.pl: Explicitely call new system function
Perl seems to just "guess" that someone no longer wants to use the
builtin "system" command when there is a function with the same name.

I have no idea what kind of liquid they are drinking, but because of the
side effects of that stuff, we explicitely call our system() function.

Not that that would be necessary, but why not waste a couple more CPU
cycles?

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-18 15:12:53 +00:00
Michael Tremer
03fe408112 general-functions.pl: Add "safe" system commands
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-10 14:29:42 +01: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
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
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
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
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
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
Stefan Schantl
c8dcd46537 general-functions.pl: Add get_nameservers().
This function simply return an array of all used nameservers.

It also takes care if the usage of ISP assigned nameservers
is enabled or not and if user-added nameservers are enabled or not.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-01-09 16:08:13 +01:00
Stefan Schantl
9702252470 dns.cgi: Move grab_address_from_file function to general-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-01-08 18:44:41 +01:00
Alexander Marx
cc724c142a BUG12070: Its not possible to use the underscore in email addresses
Using IPFire's Mailservice does not allow to enter a senders mail address with the underscore.
The function used to verify that is used from general-functions.pl.
Now the function 'validemail' allows the underscore in the address.

Fixes: #12070

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-06-18 09:12:49 +01: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
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
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
9f5247f60c general-functions.pl: readhash() Add code to handle optional comments in files
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2018-07-26 11:49:56 +02:00
Michael Tremer
a0b271e474 captive: Redesign generated coupons table
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-09-22 18:56:04 +01:00
Alexander Marx
b7ab17ad83 BUG11278: It is not possible to create subnets of internal networks in firewallgroups
Fixes: #11278

When creating networks which are part of an internal network, there was an errormessage displayed and the creation was prohibited.
Now it is possible to create such subnets. This is used at own risk! Users have to take care of the firewallrule sequence.
It is possible to create situations that are not wanted.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-06-07 17:19:30 +01:00
Michael Tremer
183b23b5ca DNS: Show DNSSEC status on index page if deavtivated
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-04-02 19:48:20 +01:00
Michael Tremer
65c3b7c913 Revert "BUG11278: enable creation from subnets of internal networks"
This reverts commit ff6cc71107.

This patch causes that no new networks can be created and
an error message is shown that the created network is the GREEN
network which is incorrect.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-03-22 11:15:44 +00:00
Alexander Marx
ff6cc71107 BUG11278: enable creation from subnets of internal networks
In firewallgroups it was not possible to create new networks that are subnets of
IPFire internal networks. Now this is possible for all internal networks.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:05:53 +00:00
Alexander Marx
4f857eea41 BUG11278: Cleanup function for network check
Deleted some code which is also used in another function

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-01-11 17:05:12 +00:00
Heino Gutschmidt
ecc9c73bb5 BUG11131: fix errormessage when more ipsec subnets defined
When having more than one subnet in an ipsec connection it is not
possible to create a new openvpn static subnet.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Heino Gutschmidt <heino.gutschmidt@managedhosting.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-06-03 16:19:49 +01:00
Michael Tremer
03306ff6a2 general-functions.pl: Allow underscores in domain names
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-05-03 22:50:53 +01:00
Alexander Marx
b00797e260 BUG10963: implement a better email verification
We now check all allowed chars in the address before the @ sign.
The domainpart after the '@' sign is just checked for valid chars, so that user@ipfire is valid, too

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2015-11-19 12:53:28 +00:00
Stefan Schantl
b013822b99 Rename Locale::Country to Locale::Codes::Country in various scripts.
The new Locale-Country version needs to be loaded and used by specifing
Locale::Codes::Country since an upstream API change. Adjusting various perl
scripts to use the module in the proper way again.
2015-04-22 18:18:38 +02:00
Stefan Schantl
1dcd87157d geoip-functions.pl: A collection of functions dealing with GeoIP. 2015-02-08 18:23:01 +01:00
Stefan Schantl
cebb1b7cb1 general-functions.pl: Add function to get full country name.
This function will return the full name a country specified by
it's country shortcut. It also will provide some additional names
which are not handled by the perl locale module but are parts of
ISO 3166.
2015-01-03 20:15:28 +01:00
Michael Tremer
c14203248c general-functions.pl: Fix perl coding error 2014-09-06 18:44:50 +02:00
Michael Tremer
da05e07629 general-functions.pl: Fix syntax error 2014-09-04 11:13:41 +02:00
Michael Tremer
6a2a62cf25 general-functions.pl: Subroutine getnetworkip() accepted multiple arguments 2014-09-03 22:23:04 +02:00
Axel Gembe
8ed77b039f general-functions.pl: validdomainname misinterprets RFC1035
The function validdomainname checks that each part of a domain name is at least
2 characters in length, but RFC1035 only makes a restriction on a "label" being
at most 63 characters in length. This change allows reverse DNS zones like
2.168.192.in-addr.arpa to be added to the DNS forward configuration, which was
incorrectly prevented before.

Signed-off-by: Axel Gembe <ago@multipixs.com>
2014-08-11 10:51:18 +02:00
Michael Tremer
4e9a2b5732 general-functions.pl: Replace lots of broken network code.
The state of some code especially in general-functions.pl
is in such a bad shape and faulty.
This is a first step that replaces some of the network
functions with those who have been tested and work for
undefined inputs.

The old functions have been left in place as stubs
and must be removed at some time.
2014-07-27 22:46:20 +02:00
Stefan Schantl
4cb523d462 general-functions.pl: Add function to get the used interface on red. 2014-07-10 12:35:05 +02:00
Michael Tremer
d6c50a8591 Merge remote-tracking branch 'amarx/10538' into next 2014-07-05 22:42:32 +02:00
Alexander Marx
1be398ae38 General-functions.pl: rewrite getnetworkip without inet_aton 2014-06-19 12:11:47 +02:00
Alexander Marx
ab92dc0c84 General-functions.pl: rewrite IpInSubnet replace inet_ntoa 2014-06-19 12:11:24 +02:00
Alexander Marx
29f238b239 BUG 10538: Routes may only added once and should not be part of an internal network 2014-06-16 09:45:59 +02:00