moshcode 0.88.0 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dns.mjs +25 -0
package/package.json
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -3294,6 +3294,7 @@ export async function dnsCommand(args = [], out = console.log, deps = {}) {
|
|
|
3294
3294
|
// Moshpit names and cannot verify them, which is bad; a machine whose DNS
|
|
3295
3295
|
// was refused because an optional component would not start is worse.
|
|
3296
3296
|
let proxyUnitPath = null;
|
|
3297
|
+
let ours = false;
|
|
3297
3298
|
if (!rest.includes("--no-proxy") && platform === "linux") {
|
|
3298
3299
|
if (!proxyWrapper()) {
|
|
3299
3300
|
out(" -- no pinned-TLS proxy installed — https:// on a name will not verify");
|
|
@@ -3306,6 +3307,10 @@ export async function dnsCommand(args = [], out = console.log, deps = {}) {
|
|
|
3306
3307
|
out(` ${step.ok ? "ok " : "-- "} ${step.step}${step.error ? ` — ${step.error}` : ""}`);
|
|
3307
3308
|
}
|
|
3308
3309
|
if (!ensured.ok) out(` -- the proxy is not serving (${ensured.reason}) — https:// will not verify`);
|
|
3310
|
+
// Started by this run, and confirmed holding the port. That is the
|
|
3311
|
+
// strongest evidence available that the proxy on 443 is ours, and it is
|
|
3312
|
+
// strictly better than the handshake below.
|
|
3313
|
+
ours = ensured.ok;
|
|
3309
3314
|
}
|
|
3310
3315
|
}
|
|
3311
3316
|
|
|
@@ -3363,6 +3368,26 @@ export async function dnsCommand(args = [], out = console.log, deps = {}) {
|
|
|
3363
3368
|
// proxy and retracting it two lines later is worse than not looking.
|
|
3364
3369
|
out(" -- the bridge already running was not started by this run, so it keeps its own");
|
|
3365
3370
|
out(" mode — to pick up proxy mode: moshcode dns disable && moshcode dns enable");
|
|
3371
|
+
} else if (ours) {
|
|
3372
|
+
// No handshake needed, and none that would work.
|
|
3373
|
+
//
|
|
3374
|
+
// The probe asks the proxy for a certificate under some name. The proxy
|
|
3375
|
+
// will not present one for a name with no key published in the registry —
|
|
3376
|
+
// deliberately, so a browser gets a TLS failure it can explain rather than
|
|
3377
|
+
// a reset mid-request — and this command has no way to invent a name that
|
|
3378
|
+
// someone has registered. There is no endpoint that lists names, only
|
|
3379
|
+
// endings, so `a.<ending>` is the best it could ever do and that is
|
|
3380
|
+
// exactly the name the proxy refuses.
|
|
3381
|
+
//
|
|
3382
|
+
// Which made the check impossible to pass on a correctly configured
|
|
3383
|
+
// machine: `proxy holds 127.0.0.1:443` and `no pinned-TLS proxy on this
|
|
3384
|
+
// machine`, three lines apart, both true as written.
|
|
3385
|
+
//
|
|
3386
|
+
// So when this run installed the unit, started it, and watched it take the
|
|
3387
|
+
// port, that is the answer. The probe below stays for a proxy this run did
|
|
3388
|
+
// not start, where the question is genuinely open.
|
|
3389
|
+
proxyAddress = { v4: DEFAULT_HOST, v6: null };
|
|
3390
|
+
out(` ok pinned-TLS proxy on ${DEFAULT_HOST}:${PROXY_PORT} — started by this run, so every live name will answer there`);
|
|
3366
3391
|
} else if (!rest.includes("--no-proxy")) {
|
|
3367
3392
|
const probeName = moshpitProbe || "";
|
|
3368
3393
|
if (!probeName) {
|