Open tdg5 opened 2 weeks ago
Hi @tdg5
Thanks so much for your feedback, it's true that the CA certificate could be potentially omitted. That's said, I think CertManger integration is still possible. Check this example:
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: redis-clusterissuer
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: redis-ca-crt
spec:
secretName: redis-ca-crt
commonName: redis-root-ca
isCA: true
issuerRef:
name: redis-clusterissuer
kind: Issuer
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: redis-ca-issuer
spec:
ca:
secretName: redis-ca-crt
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: redis-crt
spec:
secretName: redis-crt
commonName: redis.default.svc.cluster.local
issuerRef:
name: redis-ca-issuer
kind: Issuer
subject:
organizations:
- "Redis"
dnsNames:
- '127.0.0.1'
- 'localhost'
- '*.redis'
- '*.redis.default'
- '*.redis.default.svc'
- '*.redis.default.svc.cluster.local'
- '*.redis-headless'
- '*.redis-headless.default'
- '*.redis-headless.default.svc'
- '*.redis-headless.default.svc.cluster.local'
privateKey:
algorithm: RSA
size: 2048
duration: 2160h
renewBefore: 360h
redis-crt
contains tls.crt
, tls.key
and ca.crt
keys. These are precisely the keys expected by Redis chart:$ kubectl get certificate
NAME READY SECRET AGE
redis-ca-crt True redis-ca-crt 17s
redis-crt True redis-crt 16s
$ kubectl get secret redis-crt -o json | jq .data
{
"ca.crt": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvRENDQWVTZ0F3SUJBZ0lRUnJTODZPMWk3bUdCRkRHM1pQNzIrVEFOQmdrcWhraUc5dzBCQVFzRkFEQVkKTVJZd0ZBWURWUVFERXcxeVpXUnBjeTF5YjI5MExXTmhNQjRYRFRJME1URXhOVEV5TURReE5Gb1hEVEkxTURJeApNekV5TURReE5Gb3dHREVXTUJRR0ExVUVBeE1OY21Wa2FYTXRjbTl2ZEMxallUQ0NBU0l3RFFZSktvWklodmNOCkFR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FDQXc4cGJsNHBUL3lECi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg=="
}
Hey @juan131! Thank you for the very thorough response!
I understand that cert-manager
can be used to create a self-signed certificate, but I'm specifically trying to use a certificate created by a legitimate external authority that does not include a CA certificate when issuing a certificate (because that's how ACME works).
If I were interested in using a self-signed certificate, I could just use the redis.createTlsSecret
functionality built into the chart.
I may very well be missing something, but as far as I see it, using a self-signed certificate leads me down one of two roads:
I think both of these options are inherently less secure and both create additional operational complexity that should be unnecessary given the ubiquitous public key infrastructure of the web.
I'm open to being convinced that a self-signed certificate is as secure as a certificate signed by a well known CA, but that still wouldn't change the reality that it requires additional operational complexity to ignore or broadcast that CA.
A self-signed certificate seems like choosing a solution that is less secure and more of a hassle when there's another solution that is more secure and less of a hassle readily available.
Perhaps an option that could at least make my more minimal hack less hacky would be to make it so that if the certCAFilename
value is an absolute path, then the chart wouldn't try to prepend /opt/bitnami/redis/certs/
. Then I could avoid doing this silliness and feel like there was more certainty that the solution would continue to be supported in the future.
Hi @tdg5
Please note I'm not suggesting using a self-signed certificate, I just shared it as an example. The problem here is that depending of the Issuer, ACME in you case, the CA certificate may not be included in the secret.
I created a draft PR that might address this issue, could you please give it a try?
Name and Version
bitnami/redis 20.2.1
What is the problem this feature will solve?
In order to use TLS, Redis needs
redis-cli
is a little more flexible in that it will:As such,
bitnami/redis
also insists upon being given a CA certificate.This presents a problem when working with
cert-manager
which doesn't always include aca.crt
when issuing certificates:This leads to trouble with
bitnami/redis
because I'm left with two options:cert-manager
secret that also includes a manually retrieved copy of the appropriate root certificate.Option 1 doesn't work great for a CA like Let's Encrypt which issues certificates with a TTL of 90 days. Option 2 is the route I've been forced to go, but the path forward is brittle and hacky.
I've created
tdg5/bitnami-redis-ca-cert-shenanigans
to document the working hack I've found and to demonstrate that it should be easier than this.I'm happy to help contribute a solution, but I'd need some guidance on the right way to go about simplifying this problem.
What is the feature you are proposing to solve the problem?
I think the best option is to make the source of the CA certificate more configurable (e.g. don't require it to be a part of the TLS certificate). This would allow injecting custom root certificates and/or using trusted root certs already available in the docker image.
I don't love that this still requires mounting extra volumes to the pods (if the system doesn't have an acceptable root cert), but at least its a more explicitly supported path. At a minimum, it seems like forcing the CA certificate path to start with
/opt/bitnami/redis/certs
severely limits options and should be made more flexible.Another less good option (IMHO) would be to make
cacert
an optional argument for uses ofredis-cli
sinceredis-cli
will fallback to using thedefault system-wide trusted root certs
. I've found that redis server will work if I tell it the CA istls.crt
, butredis-cli
will not cooperate. This could allow for making the CA cert more generally optional. I worry though that this is not very explicit and maybe only solves a subset of awkwardness.What alternatives have you considered?
Maybe I'm missing something, but it seems that the only alternative would be to craft a custom secret from the
cert-manager
certificate secret that also includes the CA, but that makes automation very difficult so it's not an option I'm willing to accept.