Unverified Commit 3160f3b9 authored by Sizhe Zhao's avatar Sizhe Zhao
Browse files

nixos/netbird: use firewalld zone

parent 3a7a4fb4
Loading
Loading
Loading
Loading
+26 −10
Original line number Diff line number Diff line
@@ -507,7 +507,8 @@ in
        ) "loose";

        # Ports opened on a specific
        interfaces = listToAttrs (
        interfaces = lib.mkIf (config.networking.firewall.backend != "firewalld") (
          listToAttrs (
            toClientList (client: {
              name = client.interface;
              value.allowedUDPPorts = optionals client.openInternalFirewall [
@@ -517,9 +518,24 @@ in
                22054 # >=0.59.0 DNS forwarder port
              ];
            })
          )
        );
      };

      services.firewalld.zones.netbird = {
        interfaces = lib.pipe cfg.clients [
          (lib.filterAttrs (_: client: client.openFirewall))
          lib.attrValues
          (map (client: client.interface))
        ];
        ports = [
          {
            protocol = "udp";
            port = 5353;
          }
        ];
      };

      systemd.network.networks = mkIf config.networking.useNetworkd (
        toClientAttrs (
          client: