p3x-redis-ui-server
Advanced tools
Comparing version 2024.4.173 to 2024.4.174
@@ -28,3 +28,3 @@ [//]: #@corifeus-header | ||
[**P3X-REDIS-UI-SERVER**](https://corifeus.com/redis-ui-server) Build v2024.4.173 | ||
[**P3X-REDIS-UI-SERVER**](https://corifeus.com/redis-ui-server) Build v2024.4.174 | ||
@@ -31,0 +31,0 @@ [![NPM](https://img.shields.io/npm/v/p3x-redis-ui-server.svg)](https://www.npmjs.com/package/p3x-redis-ui-server) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) |
{ | ||
"name": "p3x-redis-ui-server", | ||
"version": "2024.4.173", | ||
"version": "2024.4.174", | ||
"description": "🏍️ The p3x-redis-ui-server package motor that is connected to the p3x-redis-ui-material web user interface", | ||
@@ -66,3 +66,4 @@ "corifeus": { | ||
"lodash": "^4.17.21", | ||
"socket.io": "^4.7.5" | ||
"socket.io": "^4.7.5", | ||
"tunnel-ssh": "^5.1.2" | ||
}, | ||
@@ -69,0 +70,0 @@ "engines": { |
@@ -15,3 +15,3 @@ # This is a development package | ||
--- | ||
# 🏍️ The p3x-redis-ui-server package motor that is connected to the p3x-redis-ui-material web user interface v2024.4.173 | ||
# 🏍️ The p3x-redis-ui-server package motor that is connected to the p3x-redis-ui-material web user interface v2024.4.174 | ||
@@ -116,3 +116,3 @@ | ||
[**P3X-REDIS-UI-SERVER**](https://corifeus.com/redis-ui-server) Build v2024.4.173 | ||
[**P3X-REDIS-UI-SERVER**](https://corifeus.com/redis-ui-server) Build v2024.4.174 | ||
@@ -119,0 +119,0 @@ [![NPM](https://img.shields.io/npm/v/p3x-redis-ui-server.svg)](https://www.npmjs.com/package/p3x-redis-ui-server) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) |
@@ -207,2 +207,54 @@ const donationWareFeatureError = new Error('donation-ware-feature') | ||
if (!Array.isArray(redisConfig)) { | ||
if (redisConfig.ssh === true) { | ||
const tunnelOptions = { | ||
autoClose: false | ||
} | ||
const sshOptions = { | ||
host: redisConfig.sshHost, | ||
port: redisConfig.sshPort, | ||
username: redisConfig.sshUsername, | ||
}; | ||
if (redisConfig.sshPrivateKey) { | ||
sshOptions.privateKey = redisConfig.sshPrivateKey | ||
} else { | ||
sshOptions.password = redisConfig.sshPassword | ||
} | ||
const serverOptions = null | ||
const forwardOptions = { | ||
dstAddr: redisConfig.host, | ||
dstPort: redisConfig.port, | ||
} | ||
const { createTunnel } = require('tunnel-ssh') | ||
let [server, client] = await createTunnel(tunnelOptions, serverOptions, sshOptions, forwardOptions); | ||
socket.p3xrs.tunnel = server | ||
redisConfig.port = server.address().port | ||
server.on('error',(e)=>{ | ||
console.error(e); | ||
socket.p3xrs.tunnel.close() | ||
socket.emit(options.responseEvent, { | ||
status: 'error', | ||
error: e.message | ||
}) | ||
}); | ||
client.on('error',(e)=>{ | ||
console.error(e); | ||
socket.p3xrs.tunnel.close() | ||
socket.emit(options.responseEvent, { | ||
status: 'error', | ||
error: e.message | ||
}) | ||
}); | ||
} | ||
} | ||
let redis = new Redis(redisConfig) | ||
@@ -209,0 +261,0 @@ //console.warn('redis connection', redisConfig) |
@@ -37,3 +37,13 @@ const sharedIoRedis = require('../shared') | ||
} | ||
if (p3xrs.connections.list[connectionIndexExisting].id === connectionSave.tlsCa) { | ||
connectionSave.tlsCa = p3xrs.connections.list[connectionIndexExisting].tlsCa; | ||
} | ||
if (p3xrs.connections.list[connectionIndexExisting].id === connectionSave.sshPassword) { | ||
connectionSave.sshPassword = p3xrs.connections.list[connectionIndexExisting].sshPassword | ||
} | ||
if (p3xrs.connections.list[connectionIndexExisting].id === connectionSave.sshPrivateKey) { | ||
connectionSave.sshPrivateKey = p3xrs.connections.list[connectionIndexExisting].sshPrivateKey | ||
} | ||
//TODO fix secured nodes password | ||
@@ -40,0 +50,0 @@ if (Array.isArray(connectionSave.nodes)) { |
@@ -22,2 +22,8 @@ const Redis = require('../../../lib/ioredis-cluster') | ||
} | ||
if (redisConfig.sshPassword === actualConnection.id) { | ||
redisConfig.sshPassword = actualConnection.sshPassword; | ||
} | ||
if (redisConfig.sshPrivateKey === actualConnection.id) { | ||
redisConfig.sshPrivateKey = actualConnection.sshPrivateKey; | ||
} | ||
} | ||
@@ -77,2 +83,60 @@ | ||
} | ||
let ssh = { | ||
server: undefined, | ||
client: undefined, | ||
} | ||
if (!Array.isArray(redisConfig)) { | ||
if (redisConfig.ssh === true) { | ||
const tunnelOptions = { | ||
autoClose: false | ||
} | ||
const sshOptions = { | ||
host: redisConfig.sshHost, | ||
port: redisConfig.sshPort, | ||
username: redisConfig.sshUsername, | ||
}; | ||
if (redisConfig.sshPrivateKey) { | ||
sshOptions.privateKey = redisConfig.sshPrivateKey | ||
} else { | ||
sshOptions.password = redisConfig.sshPassword | ||
} | ||
const serverOptions = null | ||
const forwardOptions = { | ||
dstAddr: redisConfig.host, | ||
dstPort: redisConfig.port, | ||
} | ||
const { createTunnel } = require('tunnel-ssh') | ||
let [server, client] = await createTunnel(tunnelOptions, serverOptions, sshOptions, forwardOptions); | ||
ssh.server = server | ||
ssh.client = client | ||
redisConfig.port = server.address().port | ||
server.on('error',(e)=>{ | ||
console.error(e); | ||
ssh.server.close() | ||
socket.emit(options.responseEvent, { | ||
status: 'error', | ||
error: e.message | ||
}) | ||
}); | ||
client.on('error',(e)=>{ | ||
console.error(e); | ||
ssh.server.close() | ||
socket.emit(options.responseEvent, { | ||
status: 'error', | ||
error: e.message | ||
}) | ||
}); | ||
} | ||
} | ||
let redis = new Redis(redisConfig) | ||
@@ -87,2 +151,5 @@ console.info('redis-test-connection', redisConfig) | ||
redis.disconnect() | ||
if (ssh.server) { | ||
ssh.server.close() | ||
} | ||
}) | ||
@@ -106,3 +173,5 @@ redis.on('connect', async function () { | ||
redis.disconnect() | ||
if (ssh.server) { | ||
ssh.server.close() | ||
} | ||
} | ||
@@ -109,0 +178,0 @@ }) |
@@ -73,2 +73,4 @@ const triggerDisconnect = (options) => { | ||
delete connection.tlsCa | ||
delete connection.sshPassword | ||
delete connection.sshPrivateKey | ||
@@ -106,2 +108,6 @@ //TODO fix secured nodes password | ||
socket.p3xrs.ioredisSubscriber = undefined | ||
if (socket.p3xrs.tunnel !== undefined) { | ||
socket.p3xrs.tunnel.close() | ||
socket.p3xrs.tunnel = undefined | ||
} | ||
} | ||
@@ -108,0 +114,0 @@ } |
@@ -26,2 +26,3 @@ const socketIoShared = require('./shared') | ||
ioredisSubscriber: undefined, | ||
tunnel: undefined, | ||
readonly: undefined, | ||
@@ -28,0 +29,0 @@ // commands: undefined, |
170394
2543
10
+ Addedtunnel-ssh@^5.1.2
+ Addedasn1@0.2.6(transitive)
+ Addedbcrypt-pbkdf@1.0.2(transitive)
+ Addedbuildcheck@0.0.6(transitive)
+ Addedcpu-features@0.0.10(transitive)
+ Addednan@2.22.0(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedssh2@1.16.0(transitive)
+ Addedtunnel-ssh@5.2.0(transitive)
+ Addedtweetnacl@0.14.5(transitive)