diff --git a/packages/nodes-base/nodes/MySql/v2/transport/index.ts b/packages/nodes-base/nodes/MySql/v2/transport/index.ts index aaef1c2172..9df57bb846 100644 --- a/packages/nodes-base/nodes/MySql/v2/transport/index.ts +++ b/packages/nodes-base/nodes/MySql/v2/transport/index.ts @@ -3,7 +3,6 @@ import { formatPrivateKey } from '@utils/utilities'; import mysql2 from 'mysql2/promise'; import type { Client, ConnectConfig } from 'ssh2'; -import { rm } from 'fs/promises'; import type { Mysql2Pool } from '../helpers/interfaces'; @@ -107,12 +106,6 @@ export async function createPool( dstPort: credentials.port as number, }; - if (sshAuthenticateWith === 'privateKey') { - sshClient.on('end', async () => { - await rm(tunnelConfig.privateKey as string); - }); - } - const poolSetup = new Promise((resolve, reject) => { sshClient .on('ready', () => { diff --git a/packages/nodes-base/nodes/Postgres/v2/transport/index.ts b/packages/nodes-base/nodes/Postgres/v2/transport/index.ts index 06083dec3a..1e60ebf7f1 100644 --- a/packages/nodes-base/nodes/Postgres/v2/transport/index.ts +++ b/packages/nodes-base/nodes/Postgres/v2/transport/index.ts @@ -8,9 +8,6 @@ import type { Server } from 'net'; import { createServer } from 'net'; import pgPromise from 'pg-promise'; - -import { rm } from 'fs/promises'; - import type { PgpDatabase } from '../helpers/interfaces'; async function createSshConnectConfig(credentials: IDataObject) { @@ -143,9 +140,6 @@ export async function configurePostgres( }); sshClient.on('end', async () => { - if (tunnelConfig.privateKey) { - await rm(tunnelConfig.privateKey as string, { force: true }); - } if (proxy) proxy.close(); }); }).catch((err) => { diff --git a/packages/nodes-base/utils/utilities.ts b/packages/nodes-base/utils/utilities.ts index da9694de18..6c2165e9bf 100644 --- a/packages/nodes-base/utils/utilities.ts +++ b/packages/nodes-base/utils/utilities.ts @@ -236,11 +236,9 @@ export function formatPrivateKey(privateKey: string): string { const passRegex = /Proc-Type|DEK-Info/; if (passRegex.test(part)) { part = part.replace(/:\s+/g, ':'); - formattedPrivateKey += part.replace(/\\n/g, '\n'); - formattedPrivateKey += part.replace(/\s+/g, '\n'); + formattedPrivateKey += part.replace(/\\n/g, '\n').replace(/\s+/g, '\n'); } else { - formattedPrivateKey += part.replace(/\\n/g, '\n'); - formattedPrivateKey += part.replace(/\s+/g, '\n'); + formattedPrivateKey += part.replace(/\\n/g, '\n').replace(/\s+/g, '\n'); } } }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fc376057b3..35dbd66a4d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' settings: autoInstallPeers: true