aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--modules/host/default.nix6
-rw-r--r--modules/host/egress.lua11
3 files changed, 15 insertions, 14 deletions
diff --git a/README.md b/README.md
index 04fc02f..c37b1fb 100644
--- a/README.md
+++ b/README.md
@@ -91,13 +91,13 @@ Each user has any number of named whitelists, in
```sh
fc-egress list
-fc-egress allow cache.nixos.org # the domain and its subdomains
-fc-egress allow github.com/NixOS/ # only paths starting with /NixOS/
+fc-egress allow https://cache.nixos.org # the domain and its subdomains
+fc-egress allow https://github.com/NixOS/ # only paths starting with /NixOS/
fc-egress allow tcp://192.0.2.7:22 # plain TCP to that address and port
fc-egress allow tcp://git.example.org:22 # or name (resolved by the host)
fc-egress allow udp://192.0.2.0/24:5000-5100
-fc-egress deny github.com/NixOS/
-fc-egress -l work allow example.com # the list "work"
+fc-egress deny https://github.com/NixOS/
+fc-egress -l work allow https://example.com # the list "work"
fc-egress lists
fc-egress log -f
```
@@ -107,11 +107,11 @@ VMs), and uses one list: the one given with `--egress`, else the one
named like the VM, else (no name) `default`:
```sh
-fc-egress -l box allow cache.nixos.org
+fc-egress -l box allow https://cache.nixos.org
./result/bin/run-firecracker-vm --name box # list box
./result/bin/run-firecracker-vm --name box2 --egress box # list box, too
fc-egress vms # running VMs: tap (as in the log), name, list
-fc-egress -v box allow example.org # the list box uses
+fc-egress -v box allow https://example.org # the list box uses
fc-egress use box default # switch box to another list
```
diff --git a/modules/host/default.nix b/modules/host/default.nix
index af1994a..1a9375e 100644
--- a/modules/host/default.nix
+++ b/modules/host/default.nix
@@ -207,8 +207,8 @@ ${lib.concatMapStrings (t: " ${t.name}) user=${t.user} ;;\n") taps}
echo " or default)"
echo "VM is a running VM's name (run-firecracker-vm --name) or tap;"
echo " -v VM means the list it uses"
- echo "RULE is DOMAIN (HTTPS, with subdomains, not decrypted)"
- echo " or DOMAIN/PATH-PREFIX (HTTPS, decrypted to check the path)"
+ echo "RULE is https://DOMAIN (with subdomains, not decrypted)"
+ echo " or https://DOMAIN/PATH-PREFIX (decrypted to check the path)"
echo " or tcp://ADDRESS[/PREFIXLEN]:PORT[-PORT] (likewise udp://...)"
echo " or tcp://NAME:PORT[-PORT] (resolved by the host, IPv4)"
echo "vms shows the running VMs' taps (as in the log), names and lists"
@@ -261,7 +261,7 @@ ${lib.concatMapStrings (t: " ${t.name}) user=${t.user} ;;\n") taps}
echo "fc-egress: bad rule: $r" >&2
exit 1
fi
- if ! printf %s "$r" | grep -qxE '[a-z0-9-]+(\.[a-z0-9-]+)*(/[A-Za-z0-9._~!$&()*+,;=:@%/-]*)?' ||
+ if ! printf %s "$r" | grep -qxE 'https://[a-z0-9-]+(\.[a-z0-9-]+)*(/[A-Za-z0-9._~!$&()*+,;=:@%/-]*)?' ||
printf %s "$r" | grep -qE '/\.\.?(/|$)'; then
echo "fc-egress: bad rule: $r" >&2
exit 1
diff --git a/modules/host/egress.lua b/modules/host/egress.lua
index c4c92eb..37411df 100644
--- a/modules/host/egress.lua
+++ b/modules/host/egress.lua
@@ -4,10 +4,11 @@
-- address (which the bridge makes sure of, see default.nix). VMS/TAP has
-- the name of the VM's list, RULES/USER/LIST its rules, one per line, both
-- read on every connection and request:
--- example.com example.com and its subdomains, passed through
--- without decrypting
--- example.com/foo/ only requests whose path starts with /foo/,
--- decrypted to check that
+-- https://example.com example.com and its subdomains, passed
+-- through without decrypting
+-- https://example.com/foo/ only requests whose path starts with /foo/,
+-- decrypted to check that
+-- (tcp:// and udp:// rules are for nftables, see default.nix.)
-- A domain with any whole-domain rule is passed through, whatever path
-- rules it has. Everything else gets denied.
--
@@ -53,7 +54,7 @@ local function rules(guest, name)
local text = f:read(65536) or ""
f:close()
for line in text:gmatch("[^\n]+") do
- local domain, path = line:match("^%s*([^/%s]+)(/?%S*)%s*$")
+ local domain, path = line:match("^%s*https://([^/%s]+)(/?%S*)%s*$")
if valid_name(domain) then
if path == "" then
domains[domain] = true