{"id":46166,"library":"redis-ssh","title":"Redis SSH Tunnel","description":"redis-ssh v1.0.0 establishes a Redis connection through an SSH tunnel using the ssh2 and redis packages. It wraps the SSH tunnel lifecycle and provides a simple connect() function that returns a Redis client and a close() method. This package simplifies connecting to a remote Redis instance behind a firewall without manual SSH port forwarding. Unlike full VPN solutions, it is lightweight and specific to Redis. The release cadence is ad-hoc with no recent updates; it is stable for its limited use case but not actively maintained.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/nicolazj/redis-ssh","tags":["javascript","redis","ssh"],"install":[{"cmd":"npm install redis-ssh","lang":"bash","label":"npm"},{"cmd":"yarn add redis-ssh","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-ssh","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"required for SSH tunnel creation","package":"ssh2","optional":false},{"reason":"required for Redis client","package":"redis","optional":false}],"imports":[{"note":"ESM-friendly; but package uses CommonJS exports. Both import styles work.","wrong":"const Redis = require('redis-ssh')","symbol":"default (connect function)","correct":"import Redis from 'redis-ssh'"},{"note":"Named export 'connect' is available via destructuring. No default export for connect only.","wrong":"","symbol":"connect","correct":"const { connect } = require('redis-ssh')"}],"quickstart":{"code":"const Redis = require('redis-ssh');\nconst fs = require('fs');\n\nasync function main() {\n  const { client, close } = await Redis.connect(\n    {\n      host: 'ssh.example.com',\n      username: 'user',\n      privateKey: fs.readFileSync('/path/to/key.pem'),\n    },\n    {\n      host: '127.0.0.1',\n      port: 6379,\n      password: 'redis-pass',\n    }\n  );\n\n  client.set('key', 'value', (err, reply) => {\n    if (err) throw err;\n    console.log(reply);\n    close();\n  });\n}\n\nmain().catch(console.error);","lang":"javascript","description":"Connects to a Redis server through an SSH tunnel, sets a key, then closes the tunnel."},"warnings":[{"fix":"Always call close() after finishing Redis operations, preferably in a finally block.","message":"Missing close() call leaves SSH tunnel open, causing resource leaks.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Refer to ssh2 and redis documentation for correct parameters.","message":"sshConfig and redisConfig objects must follow ssh2 and redis package specs exactly.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Destructure the returned object to access client and close.","message":"The function returns { client, close }, not just a client.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using ioredis with manual SSH tunneling via ssh2, or switch to a more maintained library.","message":"The redis package (v3+) is being replaced by @redis/client for ioredis-like API.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'activ':92 'ad':76 'ad-hoc':75 'behind':52 'cadenc':73 'case':89 'client':38 'close':41 'connect':11,32,46 'establish':8 'firewal':54 'forward':59 'full':61 'function':33 'hoc':77 'instanc':51 'javascript':94 'lifecycl':27 'lightweight':66 'limit':87 'maintain':93 'manual':56 'method':42 'packag':21,44 'port':58 'provid':29 'recent':80 'redi':1,5,10,20,37,50,70,95 'redis-ssh':4 'releas':72 'remot':49 'return':35 'simpl':31 'simplifi':45 'solut':63 'specif':68 'ssh':2,6,14,25,57,96 'ssh2':18 'stabl':84 'tunnel':3,15,26 'unlik':60 'updat':81 'use':16,88 'v1.0.0':7 'vpn':62 'without':55 'wrap':23","created_at":"2026-06-07T12:58:37.052285+00:00","updated_at":"2026-06-07T12:58:37.052285+00:00","problems":[{"fix":"Verify sshConfig credentials and that Redis is listening on the remote host and port.","cause":"SSH tunnel not set up correctly or Redis is not running on the remote end.","error":"Error: connect ECONNREFUSED 127.0.0.1:6379"},{"fix":"Use const Redis = require('redis-ssh'); then Redis.connect().","cause":"Import style mismatch; using default import when CommonJS require is expected, or vice versa.","error":"TypeError: Redis.connect is not a function"},{"fix":"Check SSH private key path, permissions, username, and host.","cause":"SSH authentication failure (bad key, username, or host).","error":"Error: All configured authentication methods failed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/nicolazj/redis-ssh#readme","github":"https://github.com/nicolazj/redis-ssh","docs":null,"changelog":null,"pypi":null,"npm":"redis-ssh","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","security"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}