{"id":20485303,"url":"https://github.com/runnable/redis-stunnel","last_synced_at":"2025-09-09T13:34:18.569Z","repository":{"id":70965100,"uuid":"53704222","full_name":"Runnable/redis-stunnel","owner":"Runnable","description":"Easy stunnel container for TLS connections to Redis","archived":false,"fork":false,"pushed_at":"2020-02-02T17:10:39.000Z","size":7,"stargazers_count":9,"open_issues_count":1,"forks_count":7,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-13T14:53:42.619Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/runnable/redis-stunnel/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Runnable.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-12T00:02:36.000Z","updated_at":"2021-07-20T17:45:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c2a9e08-ab03-425c-b167-50d3e4059183","html_url":"https://github.com/Runnable/redis-stunnel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Runnable/redis-stunnel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Fredis-stunnel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Fredis-stunnel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Fredis-stunnel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Fredis-stunnel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Runnable","download_url":"https://codeload.github.com/Runnable/redis-stunnel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Runnable%2Fredis-stunnel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270962391,"owners_count":24675965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T16:29:20.057Z","updated_at":"2025-08-18T08:04:40.115Z","avatar_url":"https://github.com/Runnable.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redis-stunnel\n\nDocker image for providing a TLS endpoint for accessing Redis.\n\n## Usage\n\nThe easiest setup is to have this running in parallel with a Redis container on a host machine. The basic gist is as follows:\n\n* Start `redis` container (no need to expose the port)\n* Create a CA and server certificate (see below)\n* Start `redis-stunnel` container with a link to the `redis` container and exposing the TLS port\n\nDetails are below.\n\n### Redis Container\n\nPretty straight forward:\n\n```bash\ndocker run -d --name redis redis:2.8\n```\n\n### CA and Certificate\n\nThis is a little more involved. These are roughly the steps:\n\n```bash\n# Generate a CA key - will ask for a passphrase\nopenssl genrsa -aes256 -out ca-key.pem 4096 \n# Generate the CA - will ask for various details, defaults all fine\nopenssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem\n# Generate a key for the server certificate\nopenssl genrsa -out server-key.pem 4096\n# Generate a certificate signing request\nHOST=localhost openssl req -subj \"/CN=$HOST\" -sha256 -new -key server-key.pem -out server.csr\n# Generate a server certificate w/ appropriate options - will ask for passphrase\necho subjectAltName = IP:127.0.0.1 \u003e extfile.cnf\nopenssl x509 -req -days 365 -sha256 -in server.csr -CA ca.pem -CAkey ca-key.pem \\\n  -CAcreateserial -out server-cert.pem -extfile extfile.cnf\n# Combine key and certificate for stunnel server\ncat server-key.pem server-cert.pem \u003e rediscert.pem \n```\n\n### stunnel Container\n\nStart the new container with the certificate, link, and exposed ports:\n\n```bash\ndocker run -d \\\n  --link redis:redis \\\n  -v `pwd`/rediscert.pem:/stunnel/private.pem:ro \\\n  -p 6380:6380 \\\n  runnable/redis-stunnel\n```\n\n## Testing the Setup\n\nTo test the `stunnel` setup, run the following NodeJS script. It should print out `[]` (an empty list) if it is a clean Redis server, but would otherwise print out all the keys on the server.\n\nBefore being able to run this script, `ioredis` needs to be installed with `npm`.\n\n```js\nvar fs = require('fs')\nvar Redis = require('ioredis')\n\nvar redis = new Redis({\n  host: '127.0.0.1',\n  port: 6380,\n  tls: {\n    ca: fs.readFileSync('ca.pem')\n  }\n})\n\nredis.keys('*', (err, keys) =\u003e {\n  if (err) { throw err }\n  console.log(keys)\n  redis.disconnect()\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Fredis-stunnel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frunnable%2Fredis-stunnel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frunnable%2Fredis-stunnel/lists"}