fix: ssh tunnel

This commit is contained in:
Andras Bacsai 2022-08-03 17:06:23 +00:00
parent b07ad4e3fa
commit 3d488da5ab

View File

@ -488,11 +488,10 @@ 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)
@ -500,7 +499,6 @@ export async function createRemoteEngineConfiguration(id: string) {
}
const config = sshConfig.parse('')
const found = config.find({ Host: remoteIpAddress })
if (!found) {