♻️ [pi4] Refactor firewall with variables

This commit is contained in:
2025-06-23 18:12:52 +00:00
parent 5704ebe712
commit 763ee6312a
2 changed files with 6 additions and 8 deletions

View File

@ -1,3 +1,5 @@
{ common, ... }:
{
networking = {
firewall = {
@ -6,13 +8,8 @@
80
443
];
trustedInterfaces = [ "tailscale0" ];
extraInputRules =
let
localIPv4Range = "192.168.10.0/24";
in
''
ip saddr ${localIPv4Range} accept
extraInputRules = ''
ip saddr ${common.localIpRange} accept
'';
};
nftables.enable = true;

View File

@ -16,6 +16,7 @@ rec {
domain = "martials.no";
tailnetDomain = "dns.${domain}";
localIpPrefix = "192.168.10.";
localIpRange = "${localIpPrefix}0/24";
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
tailnetAddr = host: "${host}.${tailnetDomain}";