Repository navigation
feat(start-wrt): default Remote Access to Never - #4722
Conversation
Fresh routers and factory resets start with Remote Access set to Never, and a one-time migration moves routers still on the previous default, When behind NAT, to Never and drops its WAN rules before the firewall starts. Owners can opt back in under Settings. When behind NAT is now stored as `behind-nat`; `default` named it only while it was the default, and leaves the migration unambiguous: a stored `default` can only be the old default, never a later choice. A configuration with no preferences section now reads as the defaults. It read as empty strings, which `system.info` passed on to the UI.
Each hostname-route firewall rule now names the address its port's listener holds, as the HTTP redirect's rule already named the WAN address. A rule written by an earlier build is rewritten on the next reconcile, and a renumbered WAN rewrites it again once routes re-key.
helix-white
left a comment
There was a problem hiding this comment.
Requesting changes for one correctness regression on 75ccc84.
[P2] Preserve admission for a newly granted route during WAN renumbering (projects/start-wrt/backend/ctrl/src/port_control.rs:965–968). An existing hostname route can still hold 203.0.113.7:8443 when add_sni_route observes a new WAN address, 203.0.113.8, and registers another hostname on that port. Registration does not re-key the existing routes; hotplug/sweep maintenance does that separately. The snapshot orders the old address first, so want.entry(route.ext_port).or_insert(route.ext_ip) retains only .7. Reconciliation succeeds and the new mapping is reported as granted, but the firewall rejects connections to .8 until maintenance runs. This is reachable on a single WAN when registration precedes the renumbering maintenance; it does not require multi-WAN support. The previous port-only rule admitted the new listener too.
The proposal reconciles every live listening-address/port pair, retaining the destination restriction. It gives the rules distinct UCI names, records the admission guarantee at its production owner, and adds a regression covering a grant before maintenance and removal of the old address afterward. Re-keying existing routes inline before granting is another valid approach if it preserves admission on failure paths.
Proposed changes: 75ccc84...proposal/4722
The reviewed head merges cleanly with current master. I did not build, run tests, or lint; the proposed regression is unexecuted and needs author verification if adopted. CI was still in progress when inspected. The PR branch is untouched.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
The PR merged before my review was submitted. The merged change therefore does not include the WAN-renumbering fix described in that review: a newly granted hostname route can remain blocked until maintenance reconciles the address. The proposed patch and unexecuted regression are preserved in commit e0f6362 for follow-up. I have not changed the PR branch. |
What changes
Remote Access defaults to Never. Fresh routers and factory resets start with it off, so the router's web interface and SSH accept WAN-side connections only once the owner opts in under Settings > General.
TurnOffRemoteAccess) moves a router still on the previous default, When behind NAT, to Never and removes its WAN rules. It runs at boot before the firewall starts. A mode the owner chose (never,behind-nat,always) is left alone.behind-nat.defaultnamed it only while it was the default, and retiring the name keeps the migration unambiguous: a storeddefaultcan only be the old default.system.set-preferencesrejectsdefault.preferencessection now reads as the defaults. It read as empty strings, whichsystem.infopassed on to the UI.settings.md,published-ports.md) and the bench notes follow the new default.Hostname-route admission is scoped to the listening address. Each hostname-route firewall rule now names the address its port's listener holds, as the HTTP redirect's rule already named the WAN address. A rule written by an earlier build is rewritten on the next reconcile, and a renumbered WAN rewrites it again once routes re-key.
Release
Intended for the 1.4.0 re-cut; the version stays 1.4.0 and
check-versionpasses. The migration takes index 15, so #4691's migration lands after it.Verification
Code verified on c061c947e, whose tree is the head's apart from a changelog fragment's filename (head 75ccc84; master de922c7 was already the base, no update needed).
make start-wrt-test: 954 + 37 passed, including the newset_preferences_takes_only_the_listed_remote_access_modesand the migration case with nopreferencessection, which failed before the reader fix.npm run check:i18n,check:wrt,check:rpc-clients: pass (run on ac71f5089; no web change since).make start-wrt-format-check, prettier 3.8.3 on the changed files,node scripts/changelog.mjs check-version projects/start-wrt,bench.test.sh: pass.never, the activity log recorded it, and the WAN ports closed.defaultwas rejected.preferencesdefault change made after that bench session (bootstrap, andset-preferenceson a configuration with nopreferencessection). Unit tests cover it.