feat(security): implement dynamic trusted home Wi-Fi firewall via NetworkManager dispatcher

- Add initialization for `nixos-fw-home` iptables and ip6tables chains in `system/core.nix`.
- Configure a NetworkManager dispatcher script to automatically whitelist incoming traffic when connected to the trusted home SSID ("VICTORIA").
- Implement automatic fallback to strict default firewall rules upon disconnection or network switching.
- Update input revisions and lockfile (`flake.lock`) for `nixpkgs`, `home-manager`, `DankMaterialShell`, `dankcalendar`, and `antigravity-nix`.

This change removes development port friction when working on the trusted home network while preserving strict security boundaries on public or untrusted connections.
This commit is contained in:
kiskaadee committed 2026-10-01 00:55:14 -05:00
1 parent 8046f88d98
commit da8ba03f55
2 files changed
+75 -25

No files matched your search

Generated
+25 -25
View File
@@ -8,11 +8,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1790493315, "lastModified": 1790752932,
"narHash": "sha256-3+CxEj+/A4F5e1jieViENf5UgjhPhCgXHc2Jl2jVET0=", "narHash": "sha256-9YvO04TlwSV2I4h2foSE5ERAchI/4j3myslyr7OcTaI=",
"owner": "jacopone", "owner": "jacopone",
"repo": "antigravity-nix", "repo": "antigravity-nix",
"rev": "035886f06f81f9645d83ea2a2bd75db18f4e4a24", "rev": "5659be61a6bfad97d934ab43f4dd9edb463612b3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -61,11 +61,11 @@
"dank-qml-common_2": { "dank-qml-common_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1790212412, "lastModified": 1790691843,
"narHash": "sha256-K42tXEVWy8EoeuZf2YL5frZnK3rtxPUG5r8vw6HH0q8=", "narHash": "sha256-ZoqLNYx8vgjFV18mI3l8vvkG9SufqZD2qr7q/j+aCns=",
"owner": "AvengeMedia", "owner": "AvengeMedia",
"repo": "dank-qml-common", "repo": "dank-qml-common",
"rev": "971aa3d326cb01e174d34f4dc843719386c6464f", "rev": "7092ee89ba7bab4afe74a215f31b999ae1546b9f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -77,11 +77,11 @@
"dank-qml-common_3": { "dank-qml-common_3": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1790556036, "lastModified": 1790818052,
"narHash": "sha256-E72MwG5riYkqj4mjW8BMsUnjlJqPc8HBSll+iUWxPtU=", "narHash": "sha256-B4QALG/6pkJuxKOOSs7wU+qJdOXHWYUt2YK6E3Y5M84=",
"owner": "AvengeMedia", "owner": "AvengeMedia",
"repo": "dank-qml-common", "repo": "dank-qml-common",
"rev": "660b04470bb7937b970c862024bcadd7000e6a89", "rev": "fdd2dfe3f3444585bc1f44180837724abbdfe7f1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -98,11 +98,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1790214656, "lastModified": 1790692174,
"narHash": "sha256-dIXQuotufps/E5AMtDhh7k2nacS4BhqZgUd0rycie/w=", "narHash": "sha256-XUCLGNxV3zA5OY4YF9s4tQzCfiIqtftdyCWLKzrkmgE=",
"owner": "AvengeMedia", "owner": "AvengeMedia",
"repo": "dankcalendar", "repo": "dankcalendar",
"rev": "161be60696e2dc2b80147eb51b46a7a75517d772", "rev": "506bef4c73c156c3157cd35e9c6e36868e4f1437",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -160,11 +160,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1790566629, "lastModified": 1790818540,
"narHash": "sha256-TcUusGR0QrWZsqbytv24DfTzS7LQnVL8mwilZCts9Qg=", "narHash": "sha256-B+VFBwWfpnJTRpVXwT8Dqm6DxLnBvq7H8riMSbou5+I=",
"owner": "AvengeMedia", "owner": "AvengeMedia",
"repo": "DankMaterialShell", "repo": "DankMaterialShell",
"rev": "a609b5f999a9182e002b226f2197347b0d1bc747", "rev": "a8623e3ccb8a09bfcd5f793f23687282f5c6dd64",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -214,11 +214,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1790365885, "lastModified": 1790819692,
"narHash": "sha256-iQ0ebhiVo64NktTnwft9hNxlFu4j5cvljVxyJaEVIP4=", "narHash": "sha256-rvubAPbh3QCliic3sAK+CXTrPCGgJstY52OTs/5H1J4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7b4c5ec4bedaf1e062bbc1bcaeddbc6bd242aa1b", "rev": "c8ecc29e5175452bee4a2aa1ba2383856d795338",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -250,11 +250,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1790578696, "lastModified": 1790689126,
"narHash": "sha256-EvoKOTtoIJ7Xflls2Nfo5WDcqjFJB0kuzwOz0nLWs0w=", "narHash": "sha256-VyUI5WA3WdOB9kjb04A0pxE6XTWC6cG95ZkoPSv58F0=",
"rev": "7a0f122f5090cf4c2ade2a13a0e229d4e19ba71f", "rev": "b4fd65b198c599cbe814fcb9f42d25d021595ec9",
"type": "tarball", "type": "tarball",
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1080855.7a0f122f5090/nixexprs.tar.zst" "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1082427.b4fd65b198c5/nixexprs.tar.zst"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@@ -297,11 +297,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1790568199, "lastModified": 1790742031,
"narHash": "sha256-h3AHjsOZr9iBEkNfK+Zh7/DoN5iMRpJd/6h/5NxCz9I=", "narHash": "sha256-zno5kJyjkflDauJgy9NHyoHfhAr0S2kCCMEwaHJ0a6A=",
"owner": "0xc000022070", "owner": "0xc000022070",
"repo": "zen-browser-flake", "repo": "zen-browser-flake",
"rev": "e50ed94ebf28bae95397e482dbb1c020f50c20c1", "rev": "90424e159acc21e53ea76780a3ad9cb5acef7cba",
"type": "github" "type": "github"
}, },
"original": { "original": {
+50
View File
@@ -19,6 +19,56 @@
networking.hostName = "laptop"; networking.hostName = "laptop";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
# 🛡️ Dynamic Firewall for Trusted Home Wi-Fi
# Automatically marks the Wi-Fi interface as fully trusted (accepting all incoming ports)
# ONLY when connected to the trusted home Wi-Fi network ("VICTORIA"), removing the friction of
# managing arbitrary development ports. Restores the strict default firewall immediately upon
# disconnecting or connecting to any public / untrusted network.
networking.firewall.extraCommands = ''
iptables -N nixos-fw-home 2>/dev/null || true
iptables -C nixos-fw -j nixos-fw-home 2>/dev/null || iptables -I nixos-fw 1 -j nixos-fw-home
ip6tables -N nixos-fw-home 2>/dev/null || true
ip6tables -C nixos-fw -j nixos-fw-home 2>/dev/null || ip6tables -I nixos-fw 1 -j nixos-fw-home
'';
networking.networkmanager.dispatcherScripts = [
{
source = pkgs.writeShellScript "nm-trusted-wifi-firewall" ''
IFACE="$1"
ACTION="$2"
TRUSTED_SSID="VICTORIA"
IPT="${pkgs.iptables}/bin/iptables"
IP6T="${pkgs.iptables}/bin/ip6tables"
LOGGER="${pkgs.util-linux}/bin/logger"
manage_chain() {
local cmd="$1"
$cmd -N nixos-fw-home 2>/dev/null || true
$cmd -C nixos-fw -j nixos-fw-home 2>/dev/null || $cmd -I nixos-fw 1 -j nixos-fw-home
}
manage_chain "$IPT"
manage_chain "$IP6T"
if [ "$ACTION" = "up" ] && [ "$CONNECTION_ID" = "$TRUSTED_SSID" ]; then
$IPT -F nixos-fw-home
$IPT -A nixos-fw-home -i "$IFACE" -j ACCEPT
$IP6T -F nixos-fw-home
$IP6T -A nixos-fw-home -i "$IFACE" -j ACCEPT
$LOGGER -t nm-firewall "Connected to trusted network $TRUSTED_SSID: trusted interface $IFACE (all incoming ports accepted)"
elif [ "$ACTION" = "down" ] || [ -n "$CONNECTION_ID" -a "$CONNECTION_ID" != "$TRUSTED_SSID" ]; then
$IPT -F nixos-fw-home
$IP6T -F nixos-fw-home
$LOGGER -t nm-firewall "Untrusted or disconnected network ($CONNECTION_ID): restored strict firewall"
fi
'';
type = "basic";
}
];
# Regional and language settings # Regional and language settings
time.timeZone = "America/Bogota"; time.timeZone = "America/Bogota";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";