openwrt fixes

This commit is contained in:
ari committed 2026-08-27 12:09:26 -04:00
1 parent 027552a3db
commit c1c17ec8e6
12 files changed
+207 -82

No files matched your search

+16 -7
View File
@@ -33,14 +33,18 @@ openwrt-gen firewall < config.json # prints UCI firewall rules (uci batch form
## Input shape (`config.rs`)
- `generalMappings`: `[{ ip, domains[] }]` — shared domain→IP records.
- `networks`: `{ <network>: [ { mac, name, id?, domains?, justMac? } ] }` — per-network hosts.
- `networks`: `{ <network>: [ { mac, name, id?, domains?, justMac?, internetOnly? } ] }` —
per-network hosts. A device with `internetOnly: true` is restricted to internet-only
access (matched by MAC), on any network.
- `dnsResolvers`: `[{ ip, port?, name? }]` — upstream `server=` entries for dnsmasq.
- `internetOnly`: `[<network>, ...]` — networks restricted to internet-only access.
## Internet-only firewall rules (`firewall.rs`)
For each network in `internetOnly`, the generator emits UCI `config rule` blocks that DROP
forwarded traffic from that network to the rest of the LAN (`10.0.0.0/16`):
The generator emits UCI `config rule` blocks that DROP forwarded traffic to the rest of the
LAN (`10.0.0.0/16` IPv4, `fd59:de0a:bff5::/48` IPv6). Two sources of restriction:
**Network-level** — for each network in `internetOnly`:
- **IPv4** — one rule per network matching the whole subnet (catches every device on it).
- **IPv6** — one rule per known device MAC. All subnets share a single ULA /64
@@ -48,10 +52,15 @@ forwarded traffic from that network to the rest of the LAN (`10.0.0.0/16`):
in IPv6 and blocking is done per known device. An *unknown* IPv6-only device on those
subnets is **not** blocked (inherent to the flat-L2 topology).
Rules are named `skyg_<network>_drop_lan` (IPv4) and `skyg_<network>_drop_lan_v6` (IPv6) so
the deploy script owns exactly these. They are inserted before port-specific ACCEPT rules
(e.g. the existing `sambasharelan`) so the DROPs win. Reverse direction (LAN → restricted
network) stays open, and within-subnet traffic (e.g. cam→cam) is blocked.
**Device-level** — for any device with `internetOnly: true` (on any network):
- **IPv4 + IPv6** — one rule each matched by that device's MAC. This lets you restrict a
single machine (e.g. a printer on `lab`) without restricting its whole subnet.
Rules are named `skyg_<network>_drop_lan` / `skyg_<network>_drop_lan_v6` (network-level) and
`skyg_mac_<mac>_drop_lan` / `skyg_mac_<mac>_drop_lan_v6` (device-level, MAC with colons
stripped) so the deploy script owns exactly these. Reverse direction (LAN → restricted
device) stays open, and within-subnet traffic (e.g. cam→cam) is blocked.
## Conventions