caddy: stop filtering the RTL and Mempool sites by client address
c33457fput an address check (sovran_lan_only) on the Hub, RTL and Mempool sites. It was written for ports 80/443 being forwarded and a Host header selecting a site, and that only ever applied to the Hub. RTL and Mempool are sites on ports of their own (:3051, :60847): a request on 80/443 cannot select them, whatever Host it carries. Checked with Caddy 2.9.1 and the Caddyfile this module generates for Server + Desktop with every domain configured, serving the public sites on a stand-in port: Host: sovransystemsos.local, localhost:8937, 127.0.0.1 and x:3051 all get an empty 200, and Host: matrix.example.org gets the Synapse stand-in. With the Hub off Caddy the guard has nothing left to guard, and it could not be made right for the two sites that remain: - IPv6. A laptop's global address on the LAN looks exactly like a stranger's. The choice was between letting all of 2000::/3 through, which is the whole IPv6 internet and is whatc33457fdoes, and refusing every LAN device that connects over a global address unless the operator copies the ISP's prefix into a Nix option. - They do not need it. RTL has a random 20-character password (pwgen -s 20, about 119 bits) and, since 0.15.12, which Sovran_Bitcoin pins, a 30-minute lockout keyed on the client address. Mempool shows public chain data. If someone forwards 3051 or 60847 that is the same exposure as any other port on the machine, and SECURITY.md says not to. Remove the snippet and its two imports, and tests/test_caddy_lan_only.py with them. What is still worth pinning moves to test_hub_direct.py: no address filter anywhere in caddy.nix, the two sites are plain proxies to their loopback ports, and no option for a declared prefix is left half-wired. Behaviour change: RTL and Mempool answer any client that can reach :3051 or :60847, as they did beforec33457f. In practice that is the local network, because nothing asks you to forward those ports. Checked with the real generator and Caddy 2.9.1: Node Only generates `auto_https off` and the two plain sites and validates. Run live next to the real Hub, a LAN client gets the Hub, RTL and Mempool; a stranger's address gets RTL and Mempool (by design) and a 403 from the Hub; port 80 is not listening on Node Only.
This commit is contained in:
+7
-5
@@ -63,11 +63,13 @@ The check goes by the address a connection comes from. A router that rewrites
|
||||
that address when it forwards a port makes an outsider look local, so the check
|
||||
is a second lock and not a reason to forward port 8937: don't.
|
||||
|
||||
Caddy serves 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.
|
||||
Ride The Lightning (port 3051) and Mempool (port 60847) listen on loopback only,
|
||||
and Caddy is how your local network reaches them. Caddy does not filter them by
|
||||
client address: forwarding ports 80 and 443 for public services does not reach
|
||||
them, because they answer on ports of their own, which nothing asks you to
|
||||
forward. Do not forward 3051 or 60847. If you do, Ride The Lightning still asks
|
||||
for its own random password and locks out repeated failures, and Mempool shows
|
||||
public blockchain data, but neither should face the internet.
|
||||
|
||||
### Public services and your home IP address
|
||||
|
||||
|
||||
Reference in New Issue
Block a user