I am running a RHEL-based Linux distribution on a VPS, that is supposed to be a VPN-Gateway Server. I am using Wireguard for interconnecting Clients with each other over this Gateway. The Server has ipv4-forwarding enabled, all Clients are connected to the same Wireguard-interface on the Server and are on the same Subnet (10.0.100.0/24
if this matters). The most simple setup could looks like this
Wireguard Wireguard
[ClientA] <---------> [Server] <---------> [ClientB]
10.0.100.10 10.0.100.1 10.0.100.20
I created a Firewalld-zone called vpn
, where I added the Wireguard-NIC as interface, and added 10.0.100.0/24
as Source to this zone. The Server itself is running other services besides the VPN Gateway (e.g. Cockpit).
I want, that ClientA can access ALL PORTS of all other Clients on the same Subnet (e.g. ClientB), but restrict ALL Clients from accessing ANY services exposed on the Server (e.g. Cockpit).
If I set the target
of the zone to ACCEPT
, ClientA can access every Port of ClientB (which is awesome), but sadly also everything running on the Server is exposed to the Clients as well (which is a no-no because the Devices are not always trustworthy). At this point, how do I tell firewalld to not expose any ports of the Server itself?
If I keep the target
of the zone on default
client's can ping each other, but cannot access each others ports (and nothing from the Server is exposed, which is what I expect). If going with this approach, how could one allow that traffic is forwarded to Clients? (something like --add-port/--add-service
just for the forwarded traffic?)
Is there a way to configure Firewalld, so that it forwards traffic between clients in a zone, but also restricting access to services exposed on the server?