From ff3dafcc0003ffc2d48244fcd6e98984b6a9174d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Nov 2026 01:01:06 +0000 Subject: per-user egress rules The host module takes users = { NAME = TAPS; ... } instead of a single user: each user gets that many taps, and rules of their own, in /var/lib/fc-egress/USER/allowed, managed with fc-egress as before. The proxy tells whose a guest is by its address: each tap has a fixed one, handed out by dnsmasq by MAC address (derived from the tap's number, as the run script does), and the bridge drops anything a guest sends from another address. The decrypting server gets a socket per user, as it can't see the guest's address. The run script only takes the user's own taps. --- README.md | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 69ee20c..d5fb323 100644 --- a/README.md +++ b/README.md @@ -20,17 +20,19 @@ In the host's NixOS configuration: ```nix imports = [ - (import /path/to/firecracker/modules/host { user = "tv"; }) + (import /path/to/firecracker/modules/host { users = { tv = 8; alice = 2; }; }) ]; ``` -This sets up a bridge `fcbr0` (172.16.0.1/24) with tap devices for the -given user, DHCP and DNS for the guests, the egress proxy, and nftables -rules that keep the guests from reaching anything else, on the host or -beyond. It needs `networking.nftables` (and enables it). +`users` says who may run VMs, and how many at the same time: each gets +that many tap devices. This sets up a bridge `fcbr0` (172.16.0.1/24) +with the taps, DHCP and DNS for the guests, the egress proxy, and +nftables rules that keep the guests from reaching anything else, on the +host, beyond, or each other. Each tap has a fixed address, and the bridge +drops anything a guest sends from another, so the proxy knows whose a +connection is. It needs `networking.nftables` (and enables it). -Optional arguments: `taps` (default 8, the number of VMs that can run at -the same time) and `proxyPort` (default 10443, where the proxy listens; +Optional argument: `proxyPort` (default 10443, where the proxy listens; the guests' port 443 gets redirected there). If the host has a firewall of its own, it has to let the guests in on @@ -73,8 +75,9 @@ nix-build pkgs/run-firecracker-vm \ ## Egress The guests resolve every name to the host, and all their HTTPS goes to -the proxy, which decides by the server name and the rules in -`/var/lib/fc-egress/allowed`. The user manages these with `fc-egress`: +the proxy, which decides by the server name and the rules of the guest's +user, in `/var/lib/fc-egress/USER/allowed`. Each user manages their own +with `fc-egress`: ```sh fc-egress list -- cgit v1.3.1