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>
This commit is contained in:
Vincent Li
2025-07-04 02:46:14 +00:00
parent 2580c06cb7
commit 03efd275ec

View File

@@ -1214,6 +1214,40 @@ END
#End left table. start right table (vpn)
print"</tr></table></td><td valign='top'><table width='95%' border='0' align='right'><tr>";
# WireGuard Peers
if (%Wireguard::peers || $optionsfw{'SHOWDROPDOWN'} eq 'on') {
print <<EOF;
<tr>
<td>
<input type='radio' name='$grp' id='wg_peer_$srctgt' value='wg_peer_$srctgt' $checked{$grp}{'wg_peer_'.$srctgt}>
</td>
<td nowrap='nowrap' width='16%'>
$Lang::tr{'fwhost wg peers'}
</td>
<td nowrap='nowrap' width='1%' align='right'>
<select name='wg_peer_$srctgt' style='width:200px;'>"
EOF
# Sort peers by name
foreach my $key (sort { $Wireguard::peers{$a}[2] cmp $Wireguard::peers{$b}[2] } keys %Wireguard::peers) {
# Load the peer
my $peer = &Wireguard::load_peer($key);
# Is this peer selected?
my $selected = ($fwdfwsettings{$fwdfwsettings{$grp}} eq $peer->{'NAME'}) ? "selected" : "";
print <<EOF;
<option value="$peer->{'NAME'}" $selected>$peer->{'NAME'}</option>
EOF
}
print <<EOF;
</select>
</td>
</tr>
EOF
}
# CCD networks
if( ! -z $configccdnet || $optionsfw{'SHOWDROPDOWN'} eq 'on'){
print"<td width='1%'><input type='radio' name='$grp' id='ovpn_net_$srctgt' value='ovpn_net_$srctgt' $checked{$grp}{'ovpn_net_'.$srctgt}></td><td nowrap='nowrap' width='16%'>$Lang::tr{'fwhost ccdnet'}</td><td nowrap='nowrap' width='1%' align='right'><select name='ovpn_net_$srctgt' style='width:200px;'>";