-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Can't connect via client to frontend service with cert-manager mTLS certificate #722
Comments
Hi! |
Hey, I am using version v0.18.0 of the operator. |
Hi @andrewbelu ! This may be an issue with #715. |
@alexandrevilain Hello! Tried with v0.17 of the operator and same deal. Here is the info of the certificate (omitted unnecessary details):
Perhaps it's the SAN? I notice that it's giving a different namespace for the worker than the one the worker pod is actually in, but I am unsure if this is intended or not.
I should add the original Python error (forgot to copy paste that):
|
Hi @andrewbelu ! Sorry for the late reply, I'm trying to reproduce your issue, but it works well on my side. Here are the steps I followed: kubectl apply -f examples/cluster-mtls/00-namespace.yaml
kubectl apply -f examples/cluster-mtls/01-postgresql.yaml
kubectl apply -f examples/cluster-mtls/02-temporal-cluster.yaml
# waiting for the cluster to be up and running
kubectl apply -f examples/cluster-mtls/03-temporal-cluster-client.yaml
kubectl cert-manager inspect secret -n demo prod-my-worker-mtls-certificate # using cert-manager kubectl plugin
# exporting certificates
kubectl view-secret prod-my-worker-mtls-certificate -n demo tls.key > /tmp/tls.key
kubectl view-secret prod-my-worker-mtls-certificate -n demo tls.crt > /tmp/tls.crt
kubectl view-secret prod-my-worker-mtls-certificate -n demo ca.crt > /tmp/ca.crt
# exporting SERVER_NAME
export SERVER_NAME=$(kubectl get temporalclusterclient my-worker -o=template="{{.status.serverName}}")
# on another shell:
kubectl port-forward service/prod-frontend -n demo 7233:7233
# then same test:
openssl s_client -connect localhost:7233 -cert /tmp/tls.crt -key /tmp/tls.key -CAfile /tmp/ca.crt -servername $SERVER_NAME Here is the result I get:
Is there something I'm missing to reproduce your issue ? |
I am troubleshooting a similar issue and figured I'd weigh in here so we can make progress on #746. @andrewbelu, in your error I see temporalHostPort := os.Getenv("TEMPORAL_ADDRESS")
temporalNamespace := os.Getenv("TEMPORAL_NAMESPACE")
temporalTLSCert := os.Getenv("TEMPORAL_TLS_CERT")
temporalTLSKey := os.Getenv("TEMPORAL_TLS_KEY")
temporalTLSCACert := os.Getenv("TEMPORAL_TLS_CA_CERT")
temporalTLSServerName := os.Getenv("TEMPORAL_TLS_SERVER_NAME")
serverCAPool := x509.NewCertPool()
b, err := os.ReadFile(temporalTLSCACert)
if err != nil {
log.Fatalln("Unable to read server CA certificate", err)
}
if !serverCAPool.AppendCertsFromPEM(b) {
log.Fatalln("Unable to append server CA certificate to pool")
}
clientOptions := client.Options{
HostPort: temporalHostPort,
ConnectionOptions: client.ConnectionOptions{
TLS: &tls.Config{
GetClientCertificate: func(info *tls.CertificateRequestInfo) (*tls.Certificate, error) {
cert, err := tls.LoadX509KeyPair(temporalTLSCert, temporalTLSKey)
if err != nil {
return nil, err
}
return &cert, nil
},
RootCAs: serverCAPool,
ServerName: temporalTLSServerName,
},
},
Namespace: temporalNamespace,
}
c, err := client.Dial(clientOptions)
if err != nil {
log.Fatalln("Unable to create client", err)
}
defer c.Close() Looking at the Python docs, it looks like there's a My issue is that once certificates expire, things don't seem to refresh, which I'll follow up in the relevant issue. |
Hey,
I've been trying to get mTLS up and running on my Temporal deployment. I have enabled mTLS on both internode communication and frontend communication. I have deployed the Temporal cluster like so (omitted extraneous data):
I then created a TemporalClusterClient to get a certificate signed by the frontend intermediate CA in the test namespace:
The secret is provisioned correctly into the test namespace. I then mount that secret into my pod (other data omitted for brevity):
I get a bad certificate error when attempting to connect with the certificate:
The relevant worker code:
I've also tried remove the server_root_ca_cert option and still get errors. However with exactly the same setup, if I replace the cert generated by the TemporalClusterClient with the frontend-intermediate certificate secret (in the temporal namespace, just copied over), everything works just fine.
Running an openssl s_client results in a similar story:
With the TemporalClusterClient generated certificate:
With the frontend intermediate:
Any ideas? I am scratching my head trying to figure out what I might be doing wrong here.
The text was updated successfully, but these errors were encountered: