1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-04-02 20:41:02 +02:00

fix: ssh connection closed after idle time, fixes #425

This commit is contained in:
Fabio Di Stasio 2022-12-29 13:04:20 +01:00
parent 0e7b93c2df
commit 6fa430adf6
4 changed files with 32 additions and 2 deletions

19
package-lock.json generated
View File

@ -52,6 +52,7 @@
"@types/marked": "~4.0.7",
"@types/node": "~17.0.23",
"@types/pg": "~8.6.5",
"@types/ssh2": "~1.11.6",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"@vue/compiler-sfc": "~3.2.33",
@ -2703,6 +2704,15 @@
"@types/node": "*"
}
},
"node_modules/@types/ssh2": {
"version": "1.11.6",
"resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-1.11.6.tgz",
"integrity": "sha512-8Mf6bhzYYBLEB/G6COux7DS/F5bCWwojv/qFo2yH/e4cLzAavJnxvFXrYW59iKfXdhG6OmzJcXDasgOb/s0rxw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/verror": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",
@ -17985,6 +17995,15 @@
"@types/node": "*"
}
},
"@types/ssh2": {
"version": "1.11.6",
"resolved": "https://registry.npmjs.org/@types/ssh2/-/ssh2-1.11.6.tgz",
"integrity": "sha512-8Mf6bhzYYBLEB/G6COux7DS/F5bCWwojv/qFo2yH/e4cLzAavJnxvFXrYW59iKfXdhG6OmzJcXDasgOb/s0rxw==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/verror": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.6.tgz",

View File

@ -161,6 +161,7 @@
"@types/marked": "~4.0.7",
"@types/node": "~17.0.23",
"@types/pg": "~8.6.5",
"@types/ssh2": "~1.11.6",
"@typescript-eslint/eslint-plugin": "~5.18.0",
"@typescript-eslint/parser": "~5.18.0",
"@vue/compiler-sfc": "~3.2.33",

View File

@ -147,7 +147,13 @@ export class MySQLClient extends AntaresCore {
if (this._params.ssh) {
try {
this._ssh = new SSH2Promise({ ...this._params.ssh });
if (this._params.ssh.password === '') delete this._params.ssh.password;
this._ssh = new SSH2Promise({
...this._params.ssh,
keepaliveInterval: 20000,
debug: process.env.NODE_ENV !== 'production' ? (s) => console.log(s) : null
});
const tunnel = await this._ssh.addTunnel({
remoteAddr: this._params.host,

View File

@ -162,7 +162,11 @@ export class PostgreSQLClient extends AntaresCore {
if (this._params.ssh) {
try {
this._ssh = new SSH2Promise({ ...this._params.ssh });
this._ssh = new SSH2Promise({
...this._params.ssh,
keepaliveInterval: 20000,
debug: process.env.NODE_ENV !== 'production' ? (s) => console.log(s) : null
});
const tunnel = await this._ssh.addTunnel({
remoteAddr: this._params.host,