diff --git a/SECURITY.md b/SECURITY.md index 7ea8960..12559a7 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -35,6 +35,12 @@ external networks and are outside a “fully offline” model. The local Hub currently uses HTTP. Authentication does not encrypt local network traffic, so use a trusted LAN and avoid public or guest Wi-Fi. +Caddy serves the Hub (`sovransystemsos.local`), Ride The Lightning (port 3051), +and Mempool (port 60847) only to this computer and to clients on your local +network (private, link-local, and VPN addresses), even when ports 80 and 443 are +forwarded to this computer for public services. Other IPv4 clients get the +connection closed. IPv6 global addresses are not filtered. + ### Public services and your home IP address Server + Desktop publishes services under your own domain. The Dynamic DNS diff --git a/modules/core/caddy.nix b/modules/core/caddy.nix index 5f6d9e3..d90c4e8 100755 --- a/modules/core/caddy.nix +++ b/modules/core/caddy.nix @@ -89,6 +89,26 @@ EOF EOF ''} + # ── LAN-only guard ────────────────────────────── + # The Hub, RTL and Mempool sites below are meant for this home network + # only. Forwarding ports 80/443 on the router also lets other clients + # reach Caddy, so these sites check where a request comes from, not just + # which Host it asks for. Anyone else gets the connection closed. + # private_ranges 10/8, 172.16/12, 192.168/16, 127/8, fd00::/8, ::1 + # 100.64.0.0/10 Tailscale and other VPN addresses + # 169.254.0.0/16, fe80::/10, fc00::/7 link-local and unique-local + # 2000::/3 IPv6 global addresses. Computers on this network + # often connect over their own global address, which + # looks the same as one from the internet, so IPv6 + # global addresses are not filtered. + cat >> /run/caddy/Caddyfile <<'EOF' + +(sovran_lan_only) { + @outside not remote_ip private_ranges 100.64.0.0/10 169.254.0.0/16 fe80::/10 fc00::/7 2000::/3 + abort @outside +} +EOF + # ── Matrix ────────────────────────────────────── if [ -n "$MATRIX" ]; then if [ -f /run/caddy/element-calling.snippet ]; then @@ -206,6 +226,7 @@ EOF cat >> /run/caddy/Caddyfile <> /run/caddy/Caddyfile <> /run/caddy/Caddyfile <