From 3d488da5ab6b4f8ac064c3f19d675cf996523d17 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 3 Aug 2022 17:06:23 +0000 Subject: [PATCH] fix: ssh tunnel --- apps/api/src/lib/common.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 6bfbcc47c..7cf27a22f 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -488,18 +488,16 @@ export async function createRemoteEngineConfiguration(id: string) { } await asyncExecShell(`SSH_AUTH_SOCK=/tmp/ssh-agent.pid ssh-add -q ${sshKeyFile}`) - const { stdout: numberOfSSHTunnelsRunning } = await asyncExecShell(`ps ax | grep 'ssh -fNL 11122:localhost:22' | grep -v grep | wc -l`) - console.log(numberOfSSHTunnelsRunning) + const { stdout: numberOfSSHTunnelsRunning } = await asyncExecShell(`ps ax | grep 'ssh -o StrictHostKeyChecking no -fNL 11122:localhost:${remotePort}' | grep -v grep | wc -l`) if (numberOfSSHTunnelsRunning !== '' && Number(numberOfSSHTunnelsRunning.trim()) == 0) { try { - await asyncExecShell(`SSH_AUTH_SOCK=/tmp/ssh-agent.pid ssh -fNL 11122:localhost:22 ${remoteIpAddress}`) + await asyncExecShell(`SSH_AUTH_SOCK=/tmp/ssh-agent.pid ssh -o "StrictHostKeyChecking no" -fNL 11122:localhost:${remotePort} ${remoteUser}@${remoteIpAddress}`) } catch(error){ console.log(error) } } - const config = sshConfig.parse('') const found = config.find({ Host: remoteIpAddress })