Skip to content

Commit 26cea6f

Browse files
committed
Test cleanup, default to AllowValidOnly
Signed-off-by: sheidkamp <[email protected]>
1 parent bbcfaff commit 26cea6f

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

test/e2e/features/frontendtls/suite.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ var (
3131
curlPodWithCerts = filepath.Join(fsutils.MustGetThisDir(), "testdata", "curl-pod-with-certs.yaml")
3232

3333
// client certificate paths inside the curl pod (for verify-certificate-hash tests)
34-
clientCertPath8443 = "/etc/client-certs/client-8443.crt"
35-
clientKeyPath8443 = "/etc/client-certs/client-8443.key"
36-
clientCertPath9443 = "/etc/client-certs/client-9443.crt"
37-
clientKeyPath9443 = "/etc/client-certs/client-9443.key"
34+
clientCertPath8443 = "/etc/client-certs/client-8443.crt"
35+
clientKeyPath8443 = "/etc/client-certs/client-8443.key"
36+
clientCertPath9443 = "/etc/client-certs/client-9443.crt"
37+
clientKeyPath9443 = "/etc/client-certs/client-9443.key"
38+
commonClientCertPath = "/etc/client-certs-frontend/tls.crt"
39+
commonClientKeyPath = "/etc/client-certs-frontend/tls.key"
3840

3941
// manifests for FrontendTLSConfig tests (TestFrontendTLSConfig)
4042
// Note: gatewayManifest and curlPodWithCerts are shared with verify-certificate-hash tests
@@ -334,7 +336,7 @@ func (s *testingSuite) TestFrontendTLSConfig() {
334336
// Should succeed with client cert on port 8445
335337
s.assertEventualCurlResponse(
336338
curl.WithPort(8445),
337-
curl.WithClientCert("/etc/client-certs-frontend/tls.crt", "/etc/client-certs-frontend/tls.key"),
339+
curl.WithClientCert(commonClientCertPath, commonClientKeyPath),
338340
)
339341
})
340342

@@ -350,7 +352,7 @@ func (s *testingSuite) TestFrontendTLSConfig() {
350352
// Should succeed with client cert on port 8444
351353
s.assertEventualCurlResponse(
352354
curl.WithPort(8444),
353-
curl.WithClientCert("/etc/client-certs-frontend/tls.crt", "/etc/client-certs-frontend/tls.key"),
355+
curl.WithClientCert(commonClientCertPath, commonClientKeyPath),
354356
)
355357
})
356358
}
@@ -364,7 +366,7 @@ func (s *testingSuite) TestMultipleCACertificates() {
364366
// Port 8446 has multiple CA cert refs (ca-cert and ca-cert-2) for wildcard domain *.example.com
365367
// Client cert signed by ca-cert should be accepted
366368
curlOpts := append(commonCurlOptsForMTLS(wildcardHostname, 8446),
367-
curl.WithClientCert("/etc/client-certs-frontend/tls.crt", "/etc/client-certs-frontend/tls.key"))
369+
curl.WithClientCert(commonClientCertPath, commonClientKeyPath))
368370
s.TestInstallation.Assertions.AssertEventualCurlResponse(
369371
s.Ctx,
370372
testdefaults.CurlPodExecOpt,
@@ -381,7 +383,7 @@ func (s *testingSuite) TestMultipleCACertificates() {
381383
// Port 8446 has multiple CA cert refs (ca-cert and ca-cert-2) for wildcard domain *.example.com
382384
// Client cert signed by ca-cert-2 should be accepted
383385
curlOpts := append(commonCurlOptsForMTLS(wildcardHostname, 8446),
384-
curl.WithClientCert("/etc/client-certs-2-frontend/tls.crt", "/etc/client-certs-2-frontend/tls.key"))
386+
curl.WithClientCert(commonClientCertPath, commonClientKeyPath))
385387
s.TestInstallation.Assertions.AssertEventualCurlResponse(
386388
s.Ctx,
387389
testdefaults.CurlPodExecOpt,
@@ -397,7 +399,7 @@ func (s *testingSuite) TestMultipleCACertificates() {
397399
s.Run("no client cert fails on wildcard domain", func() {
398400
// Port 8446 requires client cert (AllowValidOnly mode) for wildcard domain *.example.com
399401
// Connection without client cert should fail
400-
curlOpts := append(commonCurlOptsForMTLS(wildcardHostname, 8446))
402+
curlOpts := commonCurlOptsForMTLS(wildcardHostname, 8446)
401403
s.TestInstallation.Assertions.AssertEventualCurlError(
402404
s.Ctx,
403405
testdefaults.CurlPodExecOpt,

test/e2e/features/frontendtls/testdata/gw.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ spec:
99
frontend:
1010
default:
1111
validation:
12-
mode: AllowInsecureFallback
12+
mode: AllowValidOnly
1313
caCertificateRefs:
1414
- name: ca-cert
1515
kind: ConfigMap
1616
group: ""
1717
perPort:
18-
- port: 8444
18+
- port: 443
1919
tls:
2020
validation:
21-
mode: AllowInsecureFallback
21+
mode: AllowInsecureFallback # Testing TLS options, not certificate validation
2222
caCertificateRefs:
2323
- name: ca-cert
2424
kind: ConfigMap
2525
group: ""
26-
- port: 8445
26+
- port: 8444
2727
tls:
2828
validation:
29-
mode: AllowValidOnly
29+
mode: AllowInsecureFallback # Specifically test AllowInsecureFallback mode
3030
caCertificateRefs:
3131
- name: ca-cert
3232
kind: ConfigMap

0 commit comments

Comments
 (0)