]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
firewall: Add WireGuard RW to the UI
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Sep 2024 17:39:26 +0000 (19:39 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 22 Apr 2025 14:48:53 +0000 (16:48 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
14 files changed:
config/cfgroot/general-functions.pl
doc/language_issues.de
doc/language_issues.en
doc/language_issues.es
doc/language_issues.fr
doc/language_issues.it
doc/language_issues.nl
doc/language_issues.pl
doc/language_issues.ru
doc/language_issues.tr
doc/language_missings
html/cgi-bin/firewall.cgi
html/cgi-bin/fwhosts.cgi
langs/en/cgi-bin/en.pl

index a86bade5344d64ac3abdaaf60f0b0038e31992c4..cc5d9fd812ea43e110ef8837ff15c5982888e816 100644 (file)
@@ -24,6 +24,7 @@ $General::swroot = 'CONFIG_ROOT';
 $General::noipprefix = 'noipg-';
 
 require "${General::swroot}/network-functions.pl";
+require "${General::swroot}/wireguard-functions.pl";
 
 # Load the main settings file
 our %mainsettings = ();
@@ -256,6 +257,13 @@ sub setup_default_networks
                        $defaultNetworks->{"IPsec RW (${netaddress}/${prefix})"}{'NET'}  = $netaddress;
                }
        }
+
+       # WireGuard
+       if ($Wireguard::settings{'CLIENT_POOL'}) {
+               my $name = $Lang::tr{'wg rw peers'};
+
+               $defaultNetworks->{$name}{'NAME'} = "WGRW";
+       }
 }
 sub get_aliases
 {
index 90f9ab1ea68506d03aaafe74b2b3393993b42f7e..8c3f8b2a0079bf7276c87627f464832f2f62757b 100644 (file)
@@ -1059,6 +1059,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: winbind daemon = Winbind Daemon
index c136b8bcd6e6c025e9e64d3dc45b37a4dc0c176d..79ee563071f0adae58c34fe9aa226bf4953d00b3 100644 (file)
@@ -2167,6 +2167,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index 2b2c79f866c6847068cc87c3f364dc9b7d831775..bb366eba014a612f705f986d62cc9ac56349bf77 100644 (file)
@@ -1126,6 +1126,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index fb21be048af88741adf5ae8ad2dea78d8bdd142b..14a2e031a256295bc4e46060d13a697cc05e11af 100644 (file)
@@ -1066,6 +1066,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index 5d661aa347d3d014eff0b72f6e39aba81d2954a5..2ae1661876ed400bc782bc1c877db38ee7a987bd 100644 (file)
@@ -1412,6 +1412,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index 4fcfa89f07a9ce6898cea3b6397d12e49cc46eda..db7272f9f94973f0fc7ddc10339f2a323767a7a4 100644 (file)
@@ -1433,6 +1433,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index 2fb06b4956fc85662d86398cc90a440f345b8a2d..19093a22b412f26160fb8777c63b571e8f0160ea 100644 (file)
@@ -1675,6 +1675,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index 17172b90b85d020c1e33a54c9f0fcc4543ce9dcf..b7e599b369ce586570974eaa9613e54226141396 100644 (file)
@@ -1668,6 +1668,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index d8d081613406a653f53e81ca60712c8204e5be3b..16a8bcf7e26aa794ade36e6614aa0e8ade1e1f0b 100644 (file)
@@ -1295,6 +1295,7 @@ WARNING: untranslated string: wg no more free addresses in pool = No more free a
 WARNING: untranslated string: wg no remote subnets = No remote subnets given
 WARNING: untranslated string: wg peer configuration = Peer Configuration
 WARNING: untranslated string: wg peer does not exist = Peer does not exist
+WARNING: untranslated string: wg rw peers = WireGuard Roadwarrior Peers
 WARNING: untranslated string: wg scan the qr code = Scan the QR code to import the WireGuard configuration into a mobile client.
 WARNING: untranslated string: wg warning configuration only shown once = Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.
 WARNING: untranslated string: whitelisted = Whitelisted
index fbf4b43eb01dfa1424530e8d99e63f09f2b64190..69b38c2333ab9e2e5ce28a74d7403b57f439f065 100644 (file)
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < winbind daemon
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
 < wg peer configuration
 < wg peer does not exist
 < wg pre-shared key (optional)
+< wg rw peers
 < wg scan the qr code
 < wg warning configuration only shown once
 < whitelisted
index e87a7fed02f3a7a17962e0f92f056a7b7919c33f..f7cd1899dc3a1cda81d118e572459254cd8f30a8 100644 (file)
@@ -33,6 +33,7 @@ no warnings 'uninitialized';
 
 require '/var/ipfire/general-functions.pl';
 require '/var/ipfire/network-functions.pl';
+require '/var/ipfire/wireguard-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 require "${General::swroot}/location-functions.pl";
@@ -875,8 +876,14 @@ sub checkrule
                                        $hint.=$Lang::tr{'fwdfw hint ip2'}." Source: $networkip1/$scidr Target: $networkip2/$tcidr<br>";
                                }
                }else{
+                       $errormessage .= $sip;
+                       $errormessage .= $scidr;
+
+                       $errormessage .= $tip;
+                       $errormessage .= $tcidr;
+
                        if ( &General::IpInSubnet($networkip2,$sip,&General::iporsubtodec($scidr)) ){
-                       $errormessage.=$Lang::tr{'fwdfw err samesub'};
+                       $errormessage.=$Lang::tr{'fwdfw err samesub'} . $fwdfwsettings{'grp1'} .$fwdfwsettings{$fwdfwsettings{'grp1'}} . $fwdfwsettings{'grp2'} . $fwdfwsettings{$fwdfwsettings{'grp2'}};
                        }
                }
        }
@@ -1261,19 +1268,23 @@ sub get_ip
                if ($fwdfwsettings{$grp} eq $val.'_addr'){
                        ($a,$b)   = split (/\//, $fwdfwsettings{$fwdfwsettings{$grp}});
                }elsif($fwdfwsettings{$grp} eq 'std_net_'.$val){
-                       if ($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Gr/i){
+                       if ($fwdfwsettings{$fwdfwsettings{$grp}} eq "GREEN"){
                                $a=$netsettings{'GREEN_NETADDRESS'};
                                $b=&General::iporsubtocidr($netsettings{'GREEN_NETMASK'});
-                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Ora/i){
+                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} eq "ORANGE"){
                                $a=$netsettings{'ORANGE_NETADDRESS'};
                                $b=&General::iporsubtocidr($netsettings{'ORANGE_NETMASK'});
-                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /Bl/i){
+                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} eq "BLUE"){
                                $a=$netsettings{'BLUE_NETADDRESS'};
                                $b=&General::iporsubtocidr($netsettings{'BLUE_NETMASK'});
-                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} =~ /OpenVPN/i){
+                       }elsif($fwdfwsettings{$fwdfwsettings{$grp}} eq "OpenVPN-Dyn"){
                                &General::readhash("$configovpn",\%ovpnsettings);
                                ($a,$b)   = split (/\//, $ovpnsettings{'DOVPN_SUBNET'});
                                $b=&General::iporsubtocidr($b);
+
+                       # WireGuard
+                       } elsif ($fwdfwsettings{$fwdfwsettings{$grp}} eq "WGRW") {
+                               return $Wireguard::settings{'CLIENT_POOL'};
                        }
                }elsif($fwdfwsettings{$grp} eq 'cust_net_'.$val){
                        &General::readhasharray("$confignet", \%customnetwork);
@@ -1424,6 +1435,9 @@ sub getcolor
                }elsif ($val eq 'IPsec RW' ){
                        $tdcolor="style='background-color: $Header::colourvpn;color:white;'";
                        return;
+               }elsif ($val eq "WGRW") {
+                       $tdcolor="style='background-color: $Header::colourwg; color: white;'";
+                       return;
                }elsif($val =~ /^(.*?)\/(.*?)$/){
                        my ($sip,$scidr) = split ("/",$val);
                        if ( &Header::orange_used() && &General::IpInSubnet($sip,$netsettings{'ORANGE_ADDRESS'},$netsettings{'ORANGE_NETMASK'})){
@@ -1490,6 +1504,14 @@ sub getcolor
                                        }
                                }
                        }
+
+                       # WireGuard Roadwarrior
+                       if ($Wireguard::settings{'CLIENT_POOL'}) {
+                               if (&Network::ip_address_in_network($c, $Wireguard::settings{'CLIENT_POOL'})) {
+                                       $tdcolor="style='background-color: $Header::colourwg; color:white;'";
+                                       return;
+                               }
+                       }
                }
                #VPN networks
                if ($nettype eq 'ovpn_n2n_src' || $nettype eq 'ovpn_n2n_tgt' || $nettype eq 'ovpn_net_src' || $nettype eq 'ovpn_net_tgt'|| $nettype eq 'ovpn_host_src' || $nettype eq 'ovpn_host_tgt'){
@@ -1500,6 +1522,7 @@ sub getcolor
                        $tdcolor="style='background-color: $Header::colourvpn;color:white;'";
                        return;
                }
+
                #ALIASE
                foreach my $alias (sort keys %aliases)
                {
index d29940b8dabe6ae8e61bb4bd1c65dba377fdb267..bbe2acc3c020e954526d3b03162f1468f4d34fb5 100644 (file)
@@ -1973,6 +1973,14 @@ sub getcolor
                        $tdcolor="<font style='color: $Header::colourred;'>$c</font>";
                        return $tdcolor;
                }
+
+               # WireGuard Roadwarrior
+               if ($Wireguard::settings{'CLIENT_POOL'}) {
+                       if (&Network::ip_address_in_network($sip, $Wireguard::settings{'CLIENT_POOL'})) {
+                               return "<font style='color: $Header::colourwg;'>$c</font>"
+                       }
+               }
+
                #Check if IP is part of OpenVPN N2N subnet
                foreach my $key (sort keys %ccdhost){
                        if ($ccdhost{$key}[3] eq 'net'){
@@ -3055,6 +3063,9 @@ sub getipforgroup
                        &General::readhash("${General::swroot}/ethernet/settings",\%hash);
                        return $hash{'ORANGE_NETADDRESS'}."/".&Network::convert_netmask2prefix($hash{'ORANGE_NETMASK'}) || $hash{'ORANGE_NETMASK'};
                }
+               if ($name eq "WGRW") {
+                       return $Wireguard::settings{'CLIENT_POOL'};
+               }
                if ($name eq 'ALL'){
                        return "0.0.0.0/0";
                }
index 220d99c7b25aa36580ce55a4cddb5f171e7cb0eb..8763b2c7ca663c90183887725c2a8f363102e7ad 100644 (file)
 'wg peer configuration' => 'Peer Configuration',
 'wg peer does not exist' => 'Peer does not exist',
 'wg pre-shared key (optional)' => 'Pre-Shared Key (optional)',
+'wg rw peers' => 'WireGuard Roadwarrior Peers',
 'wg scan the qr code' => 'Scan the QR code to import the WireGuard configuration into a mobile client.',
 'wg warning configuration only shown once' => 'Attention: This WireGuard configuration file will only be shown this one time as it contains private key material that is not being stored on IPFire.',
 'whitelisted' => 'Whitelisted',