mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:39:23 +08:00
services.wireguard: do not open port when behind NAT
This commit is contained in:
@@ -38,7 +38,11 @@ inputs:
|
||||
{
|
||||
networking =
|
||||
{
|
||||
firewall = { allowedUDPPorts = [ wireguard.listenPort ]; trustedInterfaces = [ "wireguard" ]; };
|
||||
firewall =
|
||||
{
|
||||
allowedUDPPorts = inputs.lib.mkIf (!wireguard.behindNat) [ wireguard.listenPort ];
|
||||
trustedInterfaces = [ "wireguard" ];
|
||||
};
|
||||
wireguard.interfaces.wireguard =
|
||||
{
|
||||
ips = [ "${wireguard.wireguardIp}/24" ];
|
||||
|
||||
Reference in New Issue
Block a user