From 4e61b8bef901134dcf8c9a39d9e13cb140961d3a Mon Sep 17 00:00:00 2001 From: Vincent Li Date: Fri, 4 Jul 2025 02:59:22 +0000 Subject: [PATCH] firewall.cgi: Highlight any deleted WireGuard peers commit 77631ba4c738432c31cd4b6fad0da28b880fb0c7 Author: Michael Tremer Date: Tue Apr 22 18:09:31 2025 +0200 firewall.cgi: Highlight any deleted WireGuard peers Signed-off-by: Michael Tremer Signed-off-by: Vincent Li --- html/cgi-bin/firewall.cgi | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/html/cgi-bin/firewall.cgi b/html/cgi-bin/firewall.cgi index 86beb7593..26d168317 100644 --- a/html/cgi-bin/firewall.cgi +++ b/html/cgi-bin/firewall.cgi @@ -1575,6 +1575,10 @@ sub getcolor } } #VPN networks + if ($nettype eq 'wg_peer_src' || $nettype eq 'wg_peer_tgt'){ + $tdcolor="style='background-color: $Header::colourwg;color:white;'"; + return; + } 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'){ $tdcolor="style='background-color: $Header::colourovpn;color:white;'"; return; @@ -2630,10 +2634,10 @@ END @tmpsrc=(); @tmptgt=(); #check if vpn hosts/nets have been deleted - if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /ovpn/i){ + if($$hash{$key}[3] =~ /ipsec/i || $$hash{$key}[3] =~ /^wg_/ || $$hash{$key}[3] =~ /ovpn/i){ push (@tmpsrc,$$hash{$key}[4]); } - if($$hash{$key}[5] =~ /ipsec/i || $$hash{$key}[5] =~ /ovpn/i){ + if($$hash{$key}[5] =~ /ipsec/i || $$hash{$key}[5] =~ /^wg_/ || $$hash{$key}[5] =~ /ovpn/i){ push (@tmptgt,$$hash{$key}[6]); } foreach my $host (@tmpsrc){ @@ -2653,6 +2657,10 @@ END if(&fwlib::get_ovpn_host_ip($host,33) eq ''){ $coloryellow='on'; } + }elsif($$hash{$key}[3] eq 'wg_peer_src') { + if (!defined &Wireguard::get_peer_by_name($host)) { + $coloryellow = 'on'; + } } } foreach my $host (@tmptgt){ @@ -2672,6 +2680,10 @@ END if(&fwlib::get_ovpn_host_ip($host,33) eq ''){ $coloryellow='on'; } + }elsif($$hash{$key}[5] eq 'wg_peer_tgt') { + if (!defined &Wireguard::get_peer_by_name($host)) { + $coloryellow = 'on'; + } } } #check if networkgroups or servicegroups are empty