{"record":{"id":"a9e292a157946b63","repo":"diegosouzapw/OmniRoute","slug":"tproxy-ca-trust-install-is-linux-only","errorCode":null,"errorMessage":"TPROXY CA trust install is Linux-only.","messagePattern":"TPROXY CA trust install is Linux-only\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/mitm/tproxy/caTrust.ts","lineNumber":87,"sourceCode":"};\n\n/**\n * Install the dynamic CA cert (PEM) into the OS trust store under the dedicated\n * TPROXY slot. Stages the PEM to a temp file, then (privileged) copies it into the\n * anchor dir and refreshes the trust store. Throws on non-Linux hosts.\n */\nexport async function installTproxyCa(\n  caPem: string,\n  sudoPassword = \"\",\n  deps: Partial<CaTrustDeps> = {}\n): Promise<void> {\n  if (process.env.OMNIROUTE_SKIP_SYSTEM_TRUST === \"1\" && deps.run === undefined) {\n    console.log(\"[tproxy-ca] OMNIROUTE_SKIP_SYSTEM_TRUST=1 — skipping OS trust-store mutation\");\n    return;\n  }\n  const d = { ...realDeps, ...deps };\n  if (d.platform() !== \"linux\") {\n    throw new Error(\"TPROXY CA trust install is Linux-only.\");\n  }\n  const cfg = d.certConfig();\n  const staged = path.join(d.tmpDir(), TPROXY_CA_CERT_NAME);\n  const dest = `${cfg.dir}/${TPROXY_CA_CERT_NAME}`;\n  d.writeFile(staged, caPem);\n  try {\n    await d.run(\"sudo\", [\"-S\", \"mkdir\", \"-p\", cfg.dir], sudoPassword);\n    await d.run(\"sudo\", [\"-S\", \"cp\", staged, dest], sudoPassword);\n    await d.run(\"sudo\", [\"-S\", cfg.cmd], sudoPassword);\n  } finally {\n    d.rmFile(staged);\n  }\n}\n\n/**\n * Remove the TPROXY CA from the OS trust store (its dedicated slot only — leaves\n * the static MITM cert untouched) and refresh. No-op on non-Linux hosts.\n */","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/mitm/tproxy/caTrust.ts#L69-L105","documentation":"Error \"TPROXY CA trust install is Linux-only.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/mitm/tproxy/caTrust.ts:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}