♻️ [pi4] Refactor firewall with variables
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
{ common, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
networking = {
|
networking = {
|
||||||
firewall = {
|
firewall = {
|
||||||
@ -6,14 +8,9 @@
|
|||||||
80
|
80
|
||||||
443
|
443
|
||||||
];
|
];
|
||||||
trustedInterfaces = [ "tailscale0" ];
|
extraInputRules = ''
|
||||||
extraInputRules =
|
ip saddr ${common.localIpRange} accept
|
||||||
let
|
'';
|
||||||
localIPv4Range = "192.168.10.0/24";
|
|
||||||
in
|
|
||||||
''
|
|
||||||
ip saddr ${localIPv4Range} accept
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
nftables.enable = true;
|
nftables.enable = true;
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@ rec {
|
|||||||
domain = "martials.no";
|
domain = "martials.no";
|
||||||
tailnetDomain = "dns.${domain}";
|
tailnetDomain = "dns.${domain}";
|
||||||
localIpPrefix = "192.168.10.";
|
localIpPrefix = "192.168.10.";
|
||||||
|
localIpRange = "${localIpPrefix}0/24";
|
||||||
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
|
localIpAddr = subAddr: "${localIpPrefix}${builtins.toString subAddr}";
|
||||||
tailnetAddr = host: "${host}.${tailnetDomain}";
|
tailnetAddr = host: "${host}.${tailnetDomain}";
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user