diff options
| -rw-r--r-- | host.nix | 29 |
1 files changed, 27 insertions, 2 deletions
@@ -204,8 +204,14 @@ in { # with scripted networking, which assigns it regardless.) systemd.network.networks."40-fcbr0".networkConfig.ConfigureWithoutCarrier = true; - # forward only rejects; for anything else the host's own forward chain - # decides. redirect sends the guests' TLS to nginx, see above. + # What the guests may do on the host's network: DHCP and DNS with our + # dnsmasq, and TLS to nginx (port 443 of any address, redirected to + # 172.16.0.1:proxyPort). Nothing else, neither to the host (whose own + # services, like ssh, the guests would otherwise reach at 172.16.0.1, + # where DNS sends every name, or at any other of its addresses) nor + # through it (nothing gets forwarded), nor to each other (bridge). + # These chains only reject; for what they let through, the host's own + # chains decide, too. networking.nftables.enable = true; networking.nftables.tables.firecracker = { family = "inet"; @@ -215,12 +221,31 @@ in { iifname "fcbr0" tcp dport 443 redirect to :${toString proxyPort} } + chain input { + type filter hook input priority filter; policy accept; + iifname != "fcbr0" accept + ct state { established, related } accept + ip daddr { 172.16.0.1, 255.255.255.255 } udp dport 67 accept + ip daddr 172.16.0.1 udp dport 53 accept + ip daddr 172.16.0.1 tcp dport { 53, ${toString proxyPort} } accept + reject with icmpx admin-prohibited + } + chain forward { type filter hook forward priority filter; policy accept; iifname "fcbr0" reject with icmpx admin-prohibited } ''; }; + networking.nftables.tables.firecracker-bridge = { + family = "bridge"; + content = '' + chain forward { + type filter hook forward priority filter; policy accept; + iifname "fctap*" oifname "fctap*" drop + } + ''; + }; # A dnsmasq of its own, so it doesn't get mixed up with one the host might # run otherwise. DHCP, and DNS that resolves every name to 172.16.0.1 |
