128 Commits

Author SHA1 Message Date
Vincent Li
3a815d1814 fwhosts.cgi: Fix for bug 13876 & bug 13877
sync IPFire fwhosts.cgi

commit 2398cc431a3fb2cd4141b6a846f0cd0742f6a97c
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Thu Sep 25 17:05:32 2025 +0200

    fwhosts.cgi: Escape PROT in the right place

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit ad995081302f6b28ea11c74e56306d94a7bee076
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Thu Sep 25 17:02:18 2025 +0200

    fwhosts.cgi: Check country code before proceeding

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit a2c624b99dbcecb469e6001505731049ef5cbbd3
Author: Adolf Belka <adolf.belka@ipfire.org>
Date:   Thu Sep 25 13:12:37 2025 +0200

    fwhosts.cgi Fix for bug 13876 & bug 13877

    Fixes: Bug 13876 savelocationgrp COUNTRY_CODE Stored Cross-Site Scripting
    Fixes: Bug 13877 saveservice PROT Stored Cross-Site Scripting
    Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
    Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit 798556ec29207d5131a7600d5489f1ee92a7b87a
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Mon Jun 23 17:16:57 2025 +0000

    fwhosts.cgi: Move the tooltip into the usage counter

    This will clutter the page less as we don't have any good icon sets.

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
    Tested-by: Adolf Belka <adolf.belka@ipfire.org>
    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit 61b277aa9c578a9a69e552f593a8bde421b811bc
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Mon Jun 23 17:16:56 2025 +0000

    fwhosts.cgi: Don't show anything if a host/group is unused

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit ca811a746a79f0e02cfb780cbd4543a057131e3a
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Mon Jun 23 17:16:55 2025 +0000

    fwhosts.cgi: Remove whitespace issues

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit 5511d94ed0d8ea6fd372d52cba515b4d6726abed
Author: Peer Dietzmann <dietzmann@brecht-schule.hamburg>
Date:   Mon Jun 23 17:16:54 2025 +0000

    fwhosts.cgi: Show in which firewall rule objects are being used

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
    Tested-by: Adolf Belka <adolf.belka@ipfire.org>
    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

commit 341eb00a821c4254ddd04968beed2e98e5a33aff
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Sat May 3 15:10:16 2025 +0200

    fwhosts.cgi: Correctly show IP addresses for WireGuard RW peers

    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-10-09 17:23:25 +00:00
Vincent Li
7b0cc24bbf fwhosts.cgi: Add button spacing on 'Firewall/Firewall Groups' page
commit 50b4c402226cda390832d3124a2a46187cc635c3
    Author: Stephen Cuka <stephen@firemypi.org>
    Date:   Thu Feb 27 16:34:16 2025 -0700

        fwhosts.cgi: Add button spacing on 'Firewall/Firewall Groups' page.

        Add spacing between showmenu() buttons on Firewall/Firewall Groups page to improve the look of the page.

        No changes to the functions of the page.

        Signed-off-by: Stephen Cuka <stephen@firemypi.org>
        Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-04 03:31:02 +00:00
Vincent Li
d270ada82c firewall: Add support for WireGuard peers to groups
commit 1de96a83d6d6cec5d4d3eda1792aa80bfbd8fafe
    Author: Michael Tremer <michael.tremer@ipfire.org>
    Date:   Wed Apr 23 12:35:52 2025 +0200

        firewall: Add support for WireGuard peers to groups

        Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-04 03:25:56 +00:00
Vincent Li
aff726b928 firewall: Add WireGuard RW to the UI
commit 5a1c02df8973b3acc5c3101a94e86fe6df4b43b6
    Author: Michael Tremer <michael.tremer@ipfire.org>
    Date:   Thu Sep 12 19:39:26 2024 +0200

        firewall: Add WireGuard RW to the UI

        Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-03 17:56:36 +00:00
Adolf Belka
d4c30a95e7 fwhosts.cgi: Fixes bug#13206 - no validation of location group name
- Added validation code for the location group name. This is only validated when edited
   and not when created.
- The code was copied from the section for creating the Services Group Name or the
   Network/Host Group Name.

Fixes: Bug#13206
Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Reviewed-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2023-08-07 09:24:36 +00:00
Peter Müller
66c3619872 Early spring clean: Remove trailing whitespaces, and correct licence headers
Bumping across one of our scripts with very long trailing whitespaces, I
thought it might be a good idea to clean these up. Doing so, some
missing or inconsistent licence headers were fixed.

There is no need in shipping all these files en bloc, as their
functionality won't change.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-02-18 23:54:57 +00:00
Stefan Schantl
0341e11fe1 fwhosts.cgi: Fix check to limit amount of ports in custom service groups.
iptables multiport only supports up to 15 elements for each protocol (TCP or UDP).
That can be single ports or portranges (they count doubble).

This commit extends the check to calculate the amount of used TCP and/or
UDP ports of all existing entries in a group, by increasing the amount
for the service which should be added.

If the amount of ports for TCP or UDP ports become greater than the
limit of 15 the error message will be displayed.

Fixes #11323.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
2021-11-19 07:13:42 +01:00
Peter Müller
6f36132e68 fwhosts.cgi: properly fetch configured IPsec N2N subnets
Previously, the getcolor() function did not correctly process IPsec
N2N connections with more than one remote network configured, resulting
in networks mistakenly marked as being part of a VPN connection, or vice
versa.

Fixes: #11235

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-08-09 07:50:57 +00:00
Michael Tremer
0b0e6d586b fwhosts.cgi: Use new system methods
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-10 14:30:53 +01: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
d3f7af8144 fwhosts.cgi: Fix function call.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-13 19:10:38 +02:00
Stefan Schantl
9aadc465a3 fwhosts.cgi: Rework code to use location-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-12 19:46:24 +02:00
Alexander Marx
2754623fa9 BUG11825: firewall: Renaming a network/host group doesn't update rules
Code only changed field 6 of hash (target group) and not field 4 (source group).
Also if using geoip it was only field 4 of hash (source group) and not field 6 of hash (target group)
Added new code that changes both fields to reflect the change in the firewallrules immediately.

fixes: #11825

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-08-24 11:44:45 +01:00
Alexander Marx
6d92ee11de BUG11559: fwhosts
When creating firewallrules or using firewall groups,
it should be possible to select a single IpSec subnet if there is more than one.

This patch adds the changes to the firewall groups.
Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Tested-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-05-09 14:48:46 +01:00
Peter Müller
40a930bda5 BUG:11312 Fix renaming GeoIP groups
When renaming a GeoIP Group, the corresponding names in
firewallrules (if any) are not changed accordingly. Now
when changing a GeoIP Group the firewallrules are renamed
correctly.

Slightly improved first version of this patch (contained
a blank line with trailing whitespace). No functionality
changed, patch has been confirmed as working correctly.

Fixes: #11312
Signed-off-by: Peter Müller <peter.mueller@link38.eu>
Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-04-27 11:04:05 +01:00
Alexander Marx
e924369706 Delete unused function from fwhosts.cgi
This function is not used by any other script.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-06-14 15:52:33 +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
Alexander Marx
bc4a68812b BUG11242: Fix for adding 2 VPN Hosts/network with same name
If one has an IPSec network named "aaa" and an OpenVPn Host with the same name
it was not possible to group them together because of the same name.
Now the Network type is also checked wich allows Entries with same name, but different networks.

Fixes: #11242

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-11-17 14:11:50 +00:00
Alexander Marx
f770b72899 BUG10940: remove leading zeros in ip address
in firewallgroups (hosts) an error was created when using ip adresses
like 192.168.000.008. Now all leading zeros are deleted in
firewallgroups and in the firewall itself when using single ip addresses
as source or target.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2015-11-09 17:32:59 +00:00
Stefan Schantl
1ed8aedfdb fwhosts.cgi: Fix fw-reload detection when adding new entries to a geoip group.
Read-in firewall config files for detection if the current group is used
by at least one firewall rule and mark the firewall to need a reload if
neccessary.

Fixes #10771.
2015-03-15 11:41:50 +01:00
Stefan Schantl
93bfe63d55 Merge branch 'seventeen-geoip' into next-geoip 2015-03-15 11:38:45 +01:00
Alexander Marx
85abeb1376 BUG10753: Fix servicegroups to have only max. 15 services per protocol 2015-02-25 08:09:05 +01:00
Stefan Schantl
4313aa18e9 fwhosts.cgi: Add support for GeoIP groups. 2015-02-08 13:37:06 +01:00
Michael Tremer
b14e0f7d0e Merge remote-tracking branch 'amarx/fw-checksubnet' into next 2014-09-26 12:59:26 +02:00
Michael Tremer
df6649b0fe Merge remote-tracking branch 'amarx/firewall-dnat' into next
Conflicts:
	config/firewall/rules.pl
2014-09-26 12:55:55 +02:00
Alexander Marx
d8cc443938 fw-groups: fix language strings 2014-09-19 13:44:20 +02:00
Alexander Marx
3928f52b39 fw-groups: cleanup checksubnets
Now the checksubnets function from general-functions.pl is used.
2014-09-05 08:09:54 +02:00
Alexander Marx
48f07c1957 Firewall: make DNAT only accessible from selected source network
We added RED to the standard networks and now portforwardings are only
useable from the selected source. If selected "all" the portforwarding
can be used from any internal network. Else the access is only grnated
from the selected source network.
2014-07-18 08:44:45 +02:00
Dominik Hassler
6ace85e360 - bugfix: allow subnets of green/blue/orange/red as network group 2014-07-09 23:51:01 +02:00
Alexander Marx
7fa1b16e5d Firewall: Fix slow generation of host table in firewall groups 2014-05-07 12:13:13 +02:00
Alexander Marx
bc595f0985 Firewall: Bug10513 2014-04-17 12:38:59 +02:00
Alexander Marx
eae92b2baf Firewall: Bug 10514 fixed 2014-04-14 23:16:59 +02:00
Alexander Marx
1ccfb89eab Firewall: fix coloring of internet hosts 2014-04-07 16:53:01 +02:00
Alexander Marx
a72ae687c6 Firewall: Bugfix: Remark in hostgroups and servicegroups was not changeable
Another Bugfix: Layout of hostgroups was broken when more than 1 vpn
connection is defined. There where dropdownboxes for every vpn
connection instead of only one
2014-03-17 14:09:17 +01:00
Alexander Marx
dadffbf738 fwhost.cgi: disable "use warnings" 2014-03-13 15:37:33 +01:00
Alexander Marx
40962f9760 Firewall: Bugfix - when creating a new hostgroup, the system checked for existing name in servicegroups instead of hostgroups 2014-03-04 14:40:59 +01:00
Alexander Marx
7429ee78b6 Firewall: Fix oversized Textfields 2014-03-04 14:07:04 +01:00
Alexander Marx
f620fa34df Firewall: Fix Bug 10490 and broken colorization of tables in firewall groups 2014-03-04 11:37:58 +01:00
Alf Høgemark
f8aa06792f cgi-bin: Add title attribute to input type image where missing
Almost all of <input type="image"... has both an alt and a
title attribute, but some are missing title, and when the icon
is not very clear, it makes it harder to understand what the icon
does. By adding title, the browser displays text when mouse pointer
is over the icon.

Also add missing quotes for alt and title attributes where needed.
2014-02-19 18:31:02 +01:00
Alexander Marx
726e688235 Firewallgroups: added untranslated string 'name' 2014-01-29 14:32:34 +01:00
Alexander Marx
b985d3160a FIREWALL: changes column title in firewall-groups from IP Address to IP/MAC Address 2014-01-29 14:32:31 +01:00
Alexander Marx
aeefcc9caa Firewall: modified firewall-groups so that they can be empty even if used in rules
Now one can create a group, use it in a rule and then delete every entry
from the group. (The firewallrule then will be displayed yellow and
disabled).
2014-01-11 12:13:45 +01:00
Alexander Marx
4d74a20df0 Layout of fwhosts title 2014-01-09 16:26:40 +01:00
Alexander Marx
bc8ecbd6ae Layout changes fwhosts.cgi 2014-01-09 15:05:00 +01:00
Alexander Marx
902a15be1d fifteen-theme: made all tables in firewall-groups themeable 2014-01-07 09:34:01 +01:00
Alexander Marx
49da7d7975 Firewall: added check if firewallrules need to be updated when editing services or servicegroups 2014-01-06 14:18:19 +01:00
Alexander Marx
a8b113e73d Firewall: Now servicegroups and networkgroups can be renamed 2013-12-20 12:10:35 +01:00
Alexander Marx
5f037986b7 Firewall: added JS to automatically select radiobuttons in fwhosts 2013-12-20 12:10:03 +01:00
Alexander Marx
484269ceac FIrewall: Rewrote complete counters for firewall-groups (hosts,networks, network-groups) 2013-12-20 12:09:52 +01:00
Alexander Marx
3a162dc14f Firewall: rebuild complete counter procedure in firewall-groups. This way the counters are on the fly generated and stable. also this is a prequisite to the new option that firewall-servicegroups can be rolled out by installation 2013-12-10 12:21:48 +01:00