mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(ssh): pin tunnel listener to loopback
This commit is contained in:
@@ -70,7 +70,7 @@ describe("startSshPortForward", () => {
|
||||
function spawnFakeSshListening() {
|
||||
mocks.spawn.mockImplementation((_cmd: string, args: string[]) => {
|
||||
const forwardSpec = args[args.indexOf("-L") + 1] ?? "";
|
||||
const localPort = Number(forwardSpec.split(":")[0]);
|
||||
const localPort = Number(forwardSpec.split(":")[1]);
|
||||
const server = net.createServer();
|
||||
server.on("error", () => {});
|
||||
openServers.push(server);
|
||||
@@ -146,7 +146,7 @@ describe("startSshPortForward", () => {
|
||||
expect(tunnel.localPort).toBeGreaterThan(0);
|
||||
expect(mocks.spawn).toHaveBeenCalledWith(
|
||||
"/usr/bin/ssh",
|
||||
expect.arrayContaining(["-L", `${tunnel.localPort}:127.0.0.1:18789`]),
|
||||
expect.arrayContaining(["-L", `127.0.0.1:${tunnel.localPort}:127.0.0.1:18789`]),
|
||||
expect.anything(),
|
||||
);
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ export async function startSshPortForward(opts: {
|
||||
const args = [
|
||||
"-N",
|
||||
"-L",
|
||||
`${localPort}:127.0.0.1:${opts.remotePort}`,
|
||||
`127.0.0.1:${localPort}:127.0.0.1:${opts.remotePort}`,
|
||||
"-p",
|
||||
String(parsed.port),
|
||||
"-o",
|
||||
|
||||
Reference in New Issue
Block a user