Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use with rediss urls and self-signed certificates #17

Open
prognostikos opened this issue Jan 13, 2023 · 1 comment
Open

Unable to use with rediss urls and self-signed certificates #17

prognostikos opened this issue Jan 13, 2023 · 1 comment

Comments

@prognostikos
Copy link

Right now the redis client will not work with rediss urls if the redis server presents a self-signed certificate. This is the case for e.g. Heroku Redis. The following error is raised:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 peeraddr=x.x.x.x:20229 state=error: certificate verify failed (self signed certificate in certificate chain)

To enable this we can pass an additional parameter when calling Redis.new e.g.

Redis.new(
  url: ENV["REDIS_URL"],
  ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
)

Would you accept a pull request to add a configuration option for this? Let me know if you have a preference as to what the configuration API should look like.

@alexisbernard
Copy link
Member

Yes, sure, you're welcome. I prefer to leave the responsibility of creating the connections if it cannot work with a simple URL. Thus it should work for any case in the futur (I hope :-)), instead of adding an argument options.

# config/initializers/redis_dashboard.rb
# You can create any connections with any options.
# You're not forced to have the same options for all connections.
Redis.connections = [
  Redis.new(url: ENV["REDIS_URL1"], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }),
  Redis.new(url: ENV["REDIS_URL2"], reconnect_attempts: 10),
  # ...
)

If no connections has been set, it should fallback to Redis.urls to not break compatibility.

This change means that RedisDashboard::Client.new should accept both an URL and a connection.

It may break some views where the Redis URL is displayed. But I don't think it will be too hard to fix that.

Does it sounds good to you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants