-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] phpredis: Added full TLS support for RedisCluster #40882
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's possible to add test for this?
I'm not sure RedisClusterNodeProxy
is related to adding tls support?
Sure. I think I can come up with tests. The issue this is addressing is that when you're using redis cluster, and getHosts gets called, it makes a new Redis object for each redis cluster node and runs commands intended just for that node via this secondary connection. The problem with that, is that when you call _masters on a RedisCluster, it does not indicate if tls is used or not. The secondary connections will be setup without tls. I've looked over the phpredis code and it does not expose in any way if its using tls or not. The easy fix for this is to just reuse the connections that RedisCluster already has to each node, using the method described in the phpredis documentation. RedisClusterNodeProxy provides a structure to encapsulate the method calls to \RedisCluster using the same interface that \Redis presents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Can you please rebase+target 4.4? This is a bugfix.
Here are some comments before merging.
Rebased against 4.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the smooth cooperation, that's a nice fix, I learned a few things about phpredis :)
Very welcome! |
@nicolas-grekas What about psalm? I'm not sure what its upset about. |
psalm is drunk here, it can be ignored :) |
What is remaining? |
Can someone approve workflows? |
I switched the default value for ssl back to null. I start seeing client disconnects / timeouts when the value provided is an empty array. In the C++ code its default null. I think the presence of the array at all forces the driver into ssl mode. |
Thank you @jackthomasatl. |
…(jackthomasatl) This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Cache] phpredis: Added full TLS support for RedisCluster | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | n/a This Pr bridges the gap for full TLS support when using phpredis driver implementation of TLS. Adds the 'ssl' options array for cache configuration when using RedisCluster https://www.php.net/manual/en/context.ssl.php Switches directed node commands from using individual \Redis connections to using the recommended implementation from the phpredis documentation: https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#directed-node-commands This pr will enable compatibility with Amazon ElastiCache redis cluster mode using In Transit encryption (TLS) using the phpredis driver, Supports tagging & binary data types. Commits ------- a1e0408 [Cache] phpredis: Added full TLS support for RedisCluster
(dunno why github displays this has having no commits, but the merge is confirmed in f8518ca) |
Ah, I did an empty merge commit trying to trigger the test suite to run again, it was stuck. |
This Pr bridges the gap for full TLS support when using phpredis driver implementation of TLS.
Adds the 'ssl' options array for cache configuration when using RedisCluster
https://www.php.net/manual/en/context.ssl.php
Switches directed node commands from using individual \Redis connections to using the recommended implementation from the phpredis documentation:
https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#directed-node-commands
This pr will enable compatibility with Amazon ElastiCache redis cluster mode using In Transit encryption (TLS) using the phpredis driver, Supports tagging & binary data types.