diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2019-03-25 22:15:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 22:15:17 -0400 |
commit | d468f4b27e32b0fbff10d999bb50a7a5b1c86721 (patch) | |
tree | 49c02d16121b450ff7961386d89e2bc48faa2930 /nixos | |
parent | b332d66ce4fc9df7694ea77a731e3dea6d085fda (diff) | |
parent | 18bc8203a10720a4db98670cbcbe75aa0579c145 (diff) | |
download | nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar.gz nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar.bz2 nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar.lz nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar.xz nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.tar.zst nixlib-d468f4b27e32b0fbff10d999bb50a7a5b1c86721.zip |
Merge pull request #57139 from delroth/firewall-dedup
nixos/firewall: canonicalize ports lists
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/networking/firewall.nix | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix index aba64e4f60ff..4ea891262e56 100644 --- a/nixos/modules/services/networking/firewall.nix +++ b/nixos/modules/services/networking/firewall.nix @@ -261,10 +261,14 @@ let fi ''; + canonicalizePortList = + ports: lib.unique (builtins.sort builtins.lessThan ports); + commonOptions = { allowedTCPPorts = mkOption { - type = types.listOf types.int; + type = types.listOf types.port; default = [ ]; + apply = canonicalizePortList; example = [ 22 80 ]; description = '' @@ -274,7 +278,7 @@ let }; allowedTCPPortRanges = mkOption { - type = types.listOf (types.attrsOf types.int); + type = types.listOf (types.attrsOf types.port); default = [ ]; example = [ { from = 8999; to = 9003; } ]; description = @@ -285,8 +289,9 @@ let }; allowedUDPPorts = mkOption { - type = types.listOf types.int; + type = types.listOf types.port; default = [ ]; + apply = canonicalizePortList; example = [ 53 ]; description = '' @@ -295,7 +300,7 @@ let }; allowedUDPPortRanges = mkOption { - type = types.listOf (types.attrsOf types.int); + type = types.listOf (types.attrsOf types.port); default = [ ]; example = [ { from = 60000; to = 61000; } ]; description = |