Skip to content

fix(dns): dns service must point names at the local proxy - #466

Merged
ralyodio merged 1 commit into
mainfrom
fix/service-proxy
Aug 30, 2026
Merged

fix(dns): dns service must point names at the local proxy#466
ralyodio merged 1 commit into
mainfrom
fix/service-proxy

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

dns enable probes for the pinned-TLS proxy and passes it to the daemon, so Moshpit names answer on loopback and TLS terminates somewhere the local root covers. dns service — added in v0.78.0 — never did, so the unit it wrote started a bridge that answered every name with its origin.

The origin serves a certificate no CA signed, which is the entire reason the proxy exists. So on a machine with the proxy installed, trusted and running, every https:// URL still failed — and the supervised bridge v0.78.0 told people to use was the one way to run Moshpit where HTTPS could never work. The name resolved, curl said self-signed certificate, and nothing in the output connected the two.

The fix

dns service now runs the same probe enable does, at generation time — while the command can still ask — and bakes --proxy into ExecStart. The unit runs at boot and has no way to find out later.

When no proxy is found it says so, and says what that means for https://, rather than writing a unit that resolves names it cannot serve. --no-proxy skips the probe. An origin (nginx on 443) correctly finds nothing — pointing names at loopback there would hand them to a web server that never heard of them.

Tests

Four added: the flag is written for v4 and v6, absent rather than empty when there's no proxy, and doesn't collide with --upstream.

Verified on this box, which is an origin: it reports no proxy found and omits the flag, which is the correct branch here.

Suite: 2730 tests, 0 failures.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ThnQwoieWt8VR6N7gtgnhp

`dns enable` probes for the pinned-TLS proxy and passes it to the daemon, so
Moshpit names answer on loopback and TLS terminates somewhere the local root
covers. `dns service` — added in v0.78.0 — never did, so the unit it wrote
started a bridge that answered every name with its origin.

The origin serves a certificate no CA signed, which is the whole reason the
proxy exists. So on a machine with the proxy installed, trusted and running,
every https:// URL still failed, and the supervised bridge that v0.78.0 told
people to use was the one way to run Moshpit where HTTPS could not work at all.
The name resolved, curl said "self-signed certificate", and nothing in the
output connected the two.

`dns service` now runs the same probe `enable` does, at generation time — while
this command can still ask — and bakes `--proxy` into ExecStart. The unit runs
at boot and has no way to find out later.

When no proxy is found it says so, and says what that means for https://,
rather than writing a unit that resolves names and cannot serve them.
`--no-proxy` skips the probe. An origin has nginx on 443 and correctly finds
nothing: pointing names at loopback there would hand them to a web server that
never heard of them.

Four tests: the flag is written for v4 and v6, absent rather than empty when
there is no proxy, and does not collide with --upstream.
Suite: 2730 tests, 0 failures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01ThnQwoieWt8VR6N7gtgnhp
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

1 finding(s) in the 3 file(s) this pull request changes.

HIGH/CRITICAL: 1

Severity Rule Location
HIGH tls-verification-disabled src/dns.mjs:766
90 pre-existing finding(s) elsewhere in the repository — **HIGH/CRITICAL**: 7 | **MEDIUM**: 73 | **LOW**: 10

Not introduced by this pull request. The full set is in the Security tab.

Severity Rule Location
HIGH js-ssrf-outbound-request apps/pwa/public/sw.js:45
HIGH tls-verification-disabled apps/pwa/src/lib/moshpit-gateway.mjs:299
HIGH sh-remote-script-execution install.sh:86
HIGH sh-remote-script-execution install.sh:90
HIGH sh-remote-script-execution install.sh:202
HIGH sh-remote-script-execution install.sh:213
HIGH sh-remote-script-execution install.sh:219
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:139
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:153
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:179
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:373
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:377
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:422
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:671
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:867
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:869
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:928
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:974
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1044
MEDIUM sql-template-interpolation apps/pwa/src/moshpit.mjs:1147

…and 70 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 83beeb1 into main Aug 30, 2026
6 checks passed
@ralyodio ralyodio mentioned this pull request Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant