From 207692c75602d05aded5a94d1aac439e6bb178c7 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Fri, 28 Jun 2024 18:31:31 +0200 Subject: [PATCH] ca: verify certificates strictly (cherry picked from commit 1d10e91072d9628b27d7b4e5d509b8d7990fb29c) --- e2e/openssl/openssl_test.go | 4 +-- internal/ca/ca.go | 53 ++++++++++++++++++------------------- internal/ca/ca_test.go | 41 ++++++++++++++++++++++++---- 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/e2e/openssl/openssl_test.go b/e2e/openssl/openssl_test.go index 1721cdeb57..7fff46ab81 100644 --- a/e2e/openssl/openssl_test.go +++ b/e2e/openssl/openssl_test.go @@ -152,7 +152,7 @@ func TestOpenSSL(t *testing.T) { stdout, stderr, err := c.ExecDeployment(ctx, ct.Namespace, opensslFrontend, []string{"/bin/bash", "-c", opensslConnectCmd("openssl-backend:443", "mesh-ca.pem")}) t.Log("openssl with wrong certificates:", stdout) require.Error(err) - require.Contains(stderr, "certificate signature failure") + require.Contains(stderr, "self-signed certificate in certificate chain") // Connect from backend to fronted, because the frontend does not require client certs. // This should succeed because the root cert did not change. @@ -186,6 +186,6 @@ func TestMain(m *testing.M) { func opensslConnectCmd(addr, caCert string) string { return fmt.Sprintf( - `openssl s_client -connect %s -verify_return_error -CAfile /tls-config/%s -cert /tls-config/certChain.pem -key /tls-config/key.pem