-
Notifications
You must be signed in to change notification settings - Fork 332
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
chore: support SSL for redis #8488
Conversation
Signed-off-by: Matt Krick <[email protected]>
Redis docker images are built with TLS support (see this) as indicated in the Redis' documentation. You should be able to run Redis as a Docker container with the parameters shown here. Do not forget adding I have found an example of someone that did a test for running Redis with TLS and generating their own TLS certs. Check it out here. It looks good, but I haven't checked it deeply. |
Redis provides a script to help with the certificate generation in their own utils!! see here. I think is the same script you can find in the example I shared above. And this example is very clear. |
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
Signed-off-by: Matt Krick <[email protected]>
success! notes:
|
Signed-off-by: Matt Krick <[email protected]>
…. The folder must host only certificates for Redis
Looks like working in an on-demand environment (redis-tls). I would just:
In some cases, like the one I used for testing, it will be hard to force the certificates to that names and it might be way easier to have the possibility of customizing the names. If you prefer to skip that and just use fixed names, I would keep what I proposed in the commit I did: ca.crt, tls.crt and tls.key. That would already help us in our on-demand-env case and wouldn't make any difference with other arbitrary chosen names. |
BTW I still need to test it with a GCP Memorystore Redis with TLS enabled. Could you rebase, verify on your end and push it (generating a Docker image)? I would then redeploy Redis in our current staging and make a real-environment test 💪🏼 |
Okey then. I was validating how to connect to the Memorystore Redis with TLS enabled and, as I suspected (and shared in a comment that I deleted because I wanted to validate it again), we need to be able to pass ONLY the CA certificate and not any tls.key or tls.crt. Memory store supports authentication through password and TLS in-transit connection but does not allows you to generate or use client certificates. In sum up:
Once you have done that, and we can do the testing together if needed, please generate a Docker image so I can test in all situations! Thanks! |
More information: In GCP Memorystore Redis we can:
So, we need to be able to support the following cases:
In sum up:
All the combinations are required depending on the case.
|
Question: how is the application going to manage server certificate rotations? please check Google's documentation. |
Gotcha, so our app has to be ready for a TLS error at some point & when that happens we just re-try reading the certs from filesystem? Any extra reading material on the CA-only method? I always thought that got paired with client/server certs |
If I get correctly what Google's documentation says, what gets rotated is the server certificate (like the cert we use for action.parbol.co) but not the CA certificate (which would be, for action.parabol.co, Let's Encrypt). The CA cert that the app reads from its file system will not change (it expires only 10 years after creation - check Google's documentation). So, the application should do the same that a browser would do if a web page's certificate expires while it is navigating it. I imagine there is a retry asking the server to provide a new TLS server certificate, that then is verified using the CA certificate again.
Nothing else as a file. Only the password is available, but not mandatory. TLS in-transit encryption isn't really coupled with TLS authentication. Here we are encrypting the communication, but not really adding more than that as security. Google Memorystore provides only authentication string as auth method. Check Google's documentation on Redis Auth to better understand it. |
@rafaelromcar-parabol ready for review! to test locally:
|
Signed-off-by: Matt Krick <[email protected]>
Yes, it does! Check the Redis 6.2 Dockerfile. It is also available in 7.0 and 7.2. But those images do not have any environment variable to ease the setup of TLS options 😸 and you need to add arguments to the Docker cmd (redis-server) like here. I'll try to use the official image to test it. Should we use this opportunity and branch to upgrade Redis to 7.0? It is available in GCP and it is what we have in Digital Ocean already. 7.2 isn't available in GCP. |
Testing with the official Docker image redis:6.2 I can make Redis run with TLS enabled with a redis.conf correctly configured. Testing with TLS enabled, both with CA (implies tls-auth-clients optional in Redis config) or with all certs (default for Redis, it requires tls auth certs), regardless of using a password or not, I'm always getting the following:
When I run Redis with password only, no TLS enabled, and the app has also configured only
In both cases the application works normally and I can do a retro, creating reflections and grouping them. It is like if everything worked even if the DB Migrations were complaining 🤔 it doesn't make sense, but the app works. I pushed my modified version of the dev.yml for Docker Compose and also the redis.conf I'm using to play with Redis. More info about how to configure Redis here. If needed, I should be available for a sync in your early morning tomorrow. Or on Monday in an easier hour for you probably. Let me know. |
LGTM Just:
|
Signed-off-by: Matt Krick <[email protected]>
Description
fix #7564
similar to #7175
Supports TLS for redis
TEST
POSTGRES_SSL_DIR
which is the path to a directory on the file system where the certs liverediss
Inside that directory, put the following files:
Note: I'm not sure if this works! it's possible that we have to break up the REDIS_URL into proto/host/port. If you give me some self-signed certs I can test it locally