Files
AZ-NIX-CLIENTS/roles/thin-client/network/firewall.nix
T

28 lines
685 B
Nix

# roles/thin-client/network/firewall.nix
#
# Hardened firewall: deny all inbound except NetBird interface and ICMP.
{
config,
lib,
...
}: let
inherit (lib) mkIf;
cfg = config.az.tc;
in {
config = mkIf cfg.enable {
networking.firewall = {
enable = true;
allowPing = true;
# No inbound TCP/UDP ports opened — all access via NetBird.
allowedTCPPorts = [];
allowedUDPPorts = [];
# NetBird's WireGuard port (allowed by NetBird service itself,
# but make explicit here).
interfaces."wt0".allowedTCPPorts = lib.mkIf cfg.features.netbird [22];
trustedInterfaces = ["lo"];
checkReversePath = "loose";
};
};
}