Commit Graph

107 Commits

Author SHA1 Message Date
Vincent Li
0e302b1efc firewall.cgi: Fixes XSS potential
commit 21539d63dfcb15f186309b3107f63d455e4008ea
Author: Adolf Belka <adolf.belka@ipfire.org>
Date:   Thu Oct 2 13:10:15 2025 +0200

    firewall.cgi: Fixes XSS potential

    - Related to CVE-2025-50975
    - Fixes PROT
    - ruleremark was already escaped when firewall.cgi was initially merged back in Core
       Update 77.
    - SRC_PORT, TGT_PORT, dnaport, src_addr & tgt_addr are already validated in the code as
       ports or port ranges.
    - std_net_tgt is a string defined in the code and not a variable
    - The variable key ignores any input that is not a digit and subsequently uses the next
       free rulenumber digit

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-10-03 18:09:01 +00:00
Vincent Li
f09bba1d6c firewall.cgi: Remove some left-over debugging code
commit 0ee4f61deaf50b5c091d94afbedd5615c002cfae
Author: Michael Tremer <michael.tremer@ipfire.org>
Date:   Wed Jun 25 15:22:32 2025 +0100

    firewall.cgi: Remove some left-over debugging code

    This code prevented that any firewall rules could have been created due
    to the WUI always assuming that there would be some error.

    Fixes: #13860 - Error message when creating a firewall rule with a subnet for src
    Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-09 22:25:28 +00:00
Vincent Li
4e61b8bef9 firewall.cgi: Highlight any deleted WireGuard peers
commit 77631ba4c738432c31cd4b6fad0da28b880fb0c7
    Author: Michael Tremer <michael.tremer@ipfire.org>
    Date:   Tue Apr 22 18:09:31 2025 +0200

        firewall.cgi: Highlight any deleted WireGuard peers

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-04 02:59:22 +00:00
Vincent Li
03efd275ec firewall.cgi: Add dropdown to add WireGuard peers to a firewall rule
commit 468e9831d5c7b99a2dc20b66d881f43ecb0a424b
    Author: Michael Tremer <michael.tremer@ipfire.org>
    Date:   Tue Apr 22 17:41:12 2025 +0200

        firewall.cgi: Add dropdown to add WireGuard peers to a firewall rule

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

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2025-07-04 02:46:14 +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
Vincent Li
56c5212374 firewall.cgi XDP SYNPROXY UI option
only show XDP SYNPROXY option when protocol
TCP is selected.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-04-17 16:09:54 +00:00
Vincent Li
968fd0ca40 make sub routine for various rule check
with routine, we could reuse the code if possible.

Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-14 23:49:14 +00:00
Vincent Li
852567122e Add XDP SYNPROXY iptables rule UI option
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
2024-03-12 02:41:43 +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
Alexander Marx
feef6aca68 BUG12301: Iptables “host/network ‘none’ not found”
Fixes: #12301

When using hosts with MAC-addresses in a hostgroup,
the rule won't be generated if those hosts are selected as target.
There is a hint but due to a wrong hashparameter the hint was not shown.

With this patch the hint is shown again.
Additionally the rule is skipped when rules.pl creates rules.

There are no bootmessages with failed target "none" anymore.
Acked-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-02-06 17:18:31 +00:00
Stefan Schantl
55da553742 firewall.cgi: Bring back check for single IP when using DNAT.
This check has been removed by commit: bbe8e009b8

So it was able to create DNAT rules with a network as target.

Signed-off-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-09-05 08:41:12 +00:00
Stefan Schantl
446dc99e25 firewall.cgi: Map rule if manual target address belongs to IPFire
Automatically map the rule target if a manual entered target address is
assigned to a network zone.

Signed-off-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-09-05 08:41:00 +00:00
Stefan Schantl
a9611629cc firewall.cgi: Allow to creating input rules from Orange to another zone.
It was not able to create a firewall rule from the orange network to a
different network address of the firewall. ( For example: Orange -> IPFire's green address)

These rules always have been handled as FORWARD rules which is totaly
wrong.

Fixes #12265.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Tested-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>
2021-09-05 08:40:45 +00:00
Stefan Schantl
ec0ed11d71 firewall.cgi: Make checked and selected hashes private for each single function.
Some functions uses those two hashes and are altering them - making them
private will erase and fill it with new data.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-02 08:56:56 +00:00
Stefan Schantl
04b6a4baa8 firewall.cgi: Fix multiple usage of configured net or interface.
When configuring a standard network as source or target the same
interface would be pre-selected as firewall interface when editing an
existing rule.

In case an existing input rule with an configured firewall interface
should be changed, the same network device has been pre-selected in the
standard networks dropdown box.

This easily confuses users and may lead to false configurations when
saving an edited rule.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-02 08:56:42 +00:00
Stefan Schantl
0e9b164722 firewall.cgi: Remove faulty assignments for selected hash.
The removed assignments are wrong because both are trying to assign
something different to the same key and will overwrite each other.

Secondary the assignment to the hash is not needed at this place, so it
safely can be removed.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-02 08:56:07 +00:00
Michael Tremer
43ecaceb4d firewall.cgi: Use new system commands
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
Alexander Marx
284bf12c58 BUG12479: Copied NAT rule in Firewall displays incorrect source Port
Fixes: #12479

When copying a NAT rule in the firewall the existing sourceport is copied, too.
This Fix deletes the sourceport from a copied NAT rule. After Saving, the correct port is used.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-03-22 10:36:31 +00:00
Stefan Schantl
10ef824bb7 firewall.cgi: Rework to use location-functions.pl
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2020-06-12 19:31:41 +02:00
Arne Fitzenreiter
5653e55107 perl-scripts: suppress smartmatch experimental warning
smartmatch was introduced with perl 5.10 and was marked
as experimental in 5.14

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2019-08-16 12:21:26 +02:00
Michael Tremer
b38710a1cd firewall: Allow SNAT rules with RED interface
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-07 23:45:17 +01:00
Alexander Marx
d303638793 BUG11805: Firewall rule with source orange and target firewall-interface-orange not possible
Now its possible to create a rule with orange source and target orange interface of the firewall.

Fixes: #11805

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-08-22 14:46:10 +01:00
Alexander Marx
93a017cbcf BUG11559: firewall.cgi
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 has the changes for firewall.cgi
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:41 +01:00
Alexander Marx
bbe8e009b8 BUG11184: Error if DNAT address ends with 0 or 255 now disabled
When using dnat addresses, it is possible to use big subnets and host addresses like 172.16.0.0/12.
These addresses where rejected because it was recognised as network address.
The check is now removed.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-09-15 18:58:51 +01: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
Alexander Marx
8b7417c50b BUG10806: fix wrong customhostgroupcheck
The function to check for valid hostgroup entries not only
checked the target hostgroup but also the source hostgroup if any.
This lead to the error.
Now the check only affects target hostgroups because it does not matter if a sourcegroup contains mac addresses.

 Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2015-10-18 19:18:59 +01:00
Stefan Schantl
c98b743c09 firewall.cgi: Dynamically show/hide DNAT and SNAT configure elements.
Fixes #10732.
2015-04-19 01:19:11 +02:00
Stefan Schantl
93bfe63d55 Merge branch 'seventeen-geoip' into next-geoip 2015-03-15 11:38:45 +01:00
Alexander Marx
5ca4ae11ae BUG10756: fixes possibillity to enable logging when editing a rule. Also remark can be deleted 2015-03-02 15:33:44 +01:00
Alexander Marx
84a0531148 BUG10756: consolidate rulecheck 2015-03-02 15:20:32 +01:00
Stefan Schantl
c0a97a0f4a firewall.cgi: Add support for GeoIP locations / GeoIP groups. 2015-02-08 18:41:44 +01:00
Michael Tremer
3906cf7e85 Merge remote-tracking branch 'amarx/vpn-statistic1' into next 2015-01-13 17:37:18 +01:00
Michael Tremer
60bce6ba6a Merge remote-tracking branch 'amarx/BUG10615' into next 2014-09-26 13:02:28 +02:00
Alexander Marx
59c2888bae BUG10617: Allow rules from local networks to firewall itself 2014-09-19 08:11:24 +02:00
Alexander Marx
5751876534 BUG10615: fix wrong values in firewall.cgi 2014-09-11 15:10:48 +02:00
Alexander Marx
d8deec0b4f BUG10615 part2: Add ratelimit to firewallgui 2014-09-11 13:59:54 +02:00
Alexander Marx
79ad6f7e53 BUG10615 part1: Add connectionlimit to firewallgui 2014-09-11 10:59:25 +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
Alexander Marx
f1dd19724c Firewall: Add ip addres after alias name in dropdown for source and target 2014-05-07 12:00:49 +02:00
Alexander Marx
1be052f995 Firewall: When using custom hosts and not having BLUE or ORANGE, the Ruletable took very long to display every Line
With this commit the page is shown quickly because there's now a check
if ORANGE or BLUE exist before we test if a host might be in that
subnet.
2014-05-06 13:21:32 +02:00
Alexander Marx
107060da53 Firewall: When using DNAT AUTO, don't display the IP anymore in brackets 2014-04-28 16:18:10 +02:00
Alexander Marx
2ed8330ee5 Firewall: BUG 10526 (missing RED iface in SNAT Dropdown) 2014-04-22 12:35:39 +02:00
Michael Tremer
cc81c43053 firewall: Fix spelling and seperate spelling issues. 2014-04-12 16:01:11 +02:00
Michael Tremer
2dd3aa93f4 firewall: Change headlines for rule sections. 2014-04-12 15:55:44 +02:00
Michael Tremer
28e003e486 firewall.cgi: Sort protocols alphabetically. 2014-04-12 15:23:45 +02:00
Alexander Marx
0626fac1ac Firewall: When having rules with more than 3 protocols, show "many" and tooltip 2014-04-11 12:07:41 +02:00
Alexander Marx
712500d0dc Firewall: Fix 10510 - Show all protocols from servicegroups (GRE,IPIP,IPV6,...) 2014-04-10 08:19:56 +02:00
Alexander Marx
6effa000ec Firewall: Fix source preselection of alias when Firewall is selected 2014-04-07 16:52:55 +02:00
Alexander Marx
476b122fa8 Firewall: BUGFIX 10507 2014-04-07 16:52:42 +02:00