mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 15:01:15 +00:00
* refactor(process): centralize bounded command execution * refactor(process): migrate core one-shot commands * refactor(plugins): migrate one-shot commands * fix(process): await Windows tree termination * chore(plugin-sdk): refresh process runtime surface * refactor(process): migrate remaining bounded commands * refactor(process): normalize command result handling * refactor(process): split execution responsibilities * chore(plugin-sdk): refresh API baseline * chore(process): remove release-owned changelog entry * fix(process): narrow binary command input checks * fix(process): cap sandbox command output * fix(qa-lab): preserve exact node probe env * chore(ci): refresh dead export baseline * fix(process): preserve force-kill command deadlines * fix(process): avoid post-exit timeout reclassification * test(process): update scp staging wrapper mock * test(process): update remaining wrapper mocks * refactor(qa-lab): preserve Execa tar execution
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
// Proxy capture CA helpers create and inspect local capture CA certificates.
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { resolveSystemBin } from "../infra/resolve-system-bin.js";
|
|
import { runExec } from "../process/exec.js";
|
|
|
|
// Ensure a short-lived root CA for local MITM debug proxy runs. Existing certs
|
|
// are reused within the cert dir so repeated starts do not prompt regeneration.
|
|
export async function ensureDebugProxyCa(certDir: string): Promise<{
|
|
certPath: string;
|
|
keyPath: string;
|
|
}> {
|
|
fs.mkdirSync(certDir, { recursive: true });
|
|
const certPath = path.join(certDir, "root-ca.pem");
|
|
const keyPath = path.join(certDir, "root-ca-key.pem");
|
|
if (fs.existsSync(certPath) && fs.existsSync(keyPath)) {
|
|
return { certPath, keyPath };
|
|
}
|
|
const openssl = resolveSystemBin("openssl");
|
|
if (!openssl) {
|
|
throw new Error("openssl is required to generate debug proxy certificates");
|
|
}
|
|
await runExec(
|
|
openssl,
|
|
[
|
|
"req",
|
|
"-x509",
|
|
"-newkey",
|
|
"rsa:2048",
|
|
"-sha256",
|
|
"-days",
|
|
"7",
|
|
"-nodes",
|
|
"-keyout",
|
|
keyPath,
|
|
"-out",
|
|
certPath,
|
|
"-subj",
|
|
"/CN=OpenClaw Debug Proxy",
|
|
],
|
|
{ logOutput: false },
|
|
);
|
|
return { certPath, keyPath };
|
|
}
|