-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[core] Support encrypted redis connection. #28628
Conversation
e625292
to
977abdd
Compare
9fbbec2
to
1afb5a9
Compare
hmmm, it seems the building of redis has some issues. I'm looking into this. |
I need to change the bazel rule to build redis. |
@@ -655,6 +655,16 @@ RAY_CONFIG(std::string, TLS_SERVER_CERT, "") | |||
RAY_CONFIG(std::string, TLS_SERVER_KEY, "") | |||
RAY_CONFIG(std::string, TLS_CA_CERT, "") | |||
|
|||
/// Location of Redis TLS credentials | |||
/// https://github.com/redis/hiredis/blob/c78d0926bf169670d15cfc1214e4f5d21673396b/README.md#hiredis-openssl-wrappers | |||
RAY_CONFIG(bool, REDIS_ENABLE_SSL, false) |
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.
hmm why upper case?
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.
also, is it possible to add a test to show it works e2e?
} | ||
} | ||
|
||
|
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.
should we call redisFreeSSLContext
here in the destructor?
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.
I'm a little bit confused by this PR. What's the workflow for:
- use SSL with the redis bundled/started by Ray (I assume this is supported by the
services.py:_start_redis_instance
change. Do users need to supply all the CERTs parameters? - Which env var does the user use to connect to hosted redis (e.g. aws memorystore https://docs.aws.amazon.com/memorydb/latest/devguide/getting-startedclusters.connecttonode.html)
bazel/ray_deps_setup.bzl
Outdated
# patches = [ | ||
# "@com_github_ray_project_ray//thirdparty/patches:redis-quiet.patch", | ||
# ], |
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 we still need this patch?
didn't mean to approve, this PR needs documentation change as well
@scv119 ah,, I forget to include the unit test. I actually have one but forgot to add. |
@simon-mo the services change is only for testing. Ray will not start redis for the user anymore. Ideally, the Redis change should be moved from the service.py to test.py.
It's the user's responsibility to bring a redis. How to setup the cert it depends on the Redis doc.
I'm not quite sure about AWS's use case. I think here it's more related to the Redis client itself. Everything is based on Redis protocol. |
@simon-mo right now, all the GCS Fault Tolerance features are only to support ray serve and the only place where ray serves can be HA will be in KubeRay Ray Service Operator. The users can't simply use these features by themselves. I think we should just add the flags into the kuberay's doc. So it shouldn't be in this one. I'll add it once it's merged. |
952f959
to
7adaf08
Compare
f5b383b
to
7d578a7
Compare
bazel/ray_deps_setup.bzl
Outdated
@@ -98,8 +98,8 @@ def ray_deps_setup(): | |||
auto_http_archive( | |||
name = "com_github_antirez_redis", | |||
build_file = "@com_github_ray_project_ray//bazel:BUILD.redis", | |||
url = "https://github.com/redis/redis/archive/6.0.10.tar.gz", | |||
sha256 = "900cb82227bac58242c9b7668e7113cd952253b256fe04bbdab1b78979cf255a", | |||
url = "https://github.com/redis/redis/archive/refs/tags/7.0.4.tar.gz", |
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.
Can we switch to 7.0.5
for Security Fixes?
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.
can we consider a better API like RAY_REDIS_ADDRESS=rediss://...
?
@simon-mo updated to rediss:// |
…anch Signed-off-by: Yi Cheng <74173148+iycheng@users.noreply.github.com>
Signed-off-by: Yi Cheng <74173148+iycheng@users.noreply.github.com>
b01a624
to
ec7d467
Compare
Signed-off-by: Yi Cheng <74173148+iycheng@users.noreply.github.com>
Signed-off-by: Yi Cheng <74173148+iycheng@users.noreply.github.com>
Signed-off-by: Yi Cheng <74173148+iycheng@users.noreply.github.com>
test failure not related. |
This reverts commit 7167f9c.
Reverts #28628 Looks like this fails the build in the master. I verified it works after reverting this PR ``` ERROR: /Users/sangbincho/work/ray/BUILD.bazel:2764:18 Executing genrule //:cp_redis failed: (Exit 64): bash failed: error executing command (cd /private/var/tmp/_bazel_sangbincho/f7d6f25d281df169000c577629db7adf/sandbox/darwin-sandbox/1985/execroot/com_github_ray_project_ray && \ exec env - \ PATH=/Users/sangbincho/google-cloud-sdk/bin:/Users/sangbincho/anaconda3/envs/core/bin:/Users/sangbincho/anaconda3/condabin:/Users/sangbincho/.nvm/versions/node/v14.19.2/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/sangbincho/.cargo/bin:/Users/sangbincho/bin \ /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; mkdir tmp-redis-bin cp bazel-out/darwin-opt/bin/external/com_github_antirez_redis/copy_redis/redis bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/bin/redis-cli bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/bin/redis-server bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/include ./tmp-redis-bin/ -rf cp tmp-redis-bin/redis-server bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-server chmod +x bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-server cp tmp-redis-bin/redis-cli bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-cli chmod +x bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-cli rm -rf tmp-redis-bin ') Execution platform: @local_config_platform//:host ```
This PR supports the encrypted redis connection. If the address starts with rediss://, it'll start the redis in SSL mode. To support better ssl, redis is also upgraded. It's not supposed to impact ray because it's the user's responsibility to provide a redis. Right now all flags are provided by the os envs. It's not ideal and we should design a better format when we refactor the db layer. Besides, right now gRPC is using OS envs for the encrypted connection in ray, just follow this pattern for now. Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Reverts ray-project#28628 Looks like this fails the build in the master. I verified it works after reverting this PR ``` ERROR: /Users/sangbincho/work/ray/BUILD.bazel:2764:18 Executing genrule //:cp_redis failed: (Exit 64): bash failed: error executing command (cd /private/var/tmp/_bazel_sangbincho/f7d6f25d281df169000c577629db7adf/sandbox/darwin-sandbox/1985/execroot/com_github_ray_project_ray && \ exec env - \ PATH=/Users/sangbincho/google-cloud-sdk/bin:/Users/sangbincho/anaconda3/envs/core/bin:/Users/sangbincho/anaconda3/condabin:/Users/sangbincho/.nvm/versions/node/v14.19.2/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/sangbincho/.cargo/bin:/Users/sangbincho/bin \ /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; mkdir tmp-redis-bin cp bazel-out/darwin-opt/bin/external/com_github_antirez_redis/copy_redis/redis bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/bin/redis-cli bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/bin/redis-server bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis/include ./tmp-redis-bin/ -rf cp tmp-redis-bin/redis-server bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-server chmod +x bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-server cp tmp-redis-bin/redis-cli bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-cli chmod +x bazel-out/darwin-opt/bin/external/com_github_antirez_redis/redis-cli rm -rf tmp-redis-bin ') Execution platform: @local_config_platform//:host ``` Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Why are these changes needed?
This PR support encrypted redis connection. If the address starts with
rediss://
, it'll start the redis in SSL mode.To support better ssl, redis is also upgraded. It's not supposed to impact ray because it's the user's responsibility to provide a redis.
Right now all flags are provided by the os envs. It's not ideal and we should design a better format when we refactor the db layer.
Besides, right now gRPC is using OS envs for the encrypted connection in ray, just follow this pattern for now.
Related issue number
Closes #27371
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.