Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions cmd/webhook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,6 @@ func startHTTPServers(config *ServerConfig) (func(), error) {
if err != nil {
return nil, fmt.Errorf("error parsing TLS min version %q: %w", config.TLSMinVersion, err)
}

// Validate that the minimum TLS version is at least TLS 1.2
if tlsMinVersionID < tls.VersionTLS12 {
return nil, fmt.Errorf("TLS min version %q is below the minimum required version TLS 1.2", config.TLSMinVersion)
}
}

applyTLSOptions := func(to *tls.Config) *tls.Config {
Expand Down
15 changes: 3 additions & 12 deletions cmd/webhook/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,15 @@ func testHTTPServers() {
})
})

DescribeTable("should reject TLS min versions below TLS 1.2",
func(version string) {
config.TLSMinVersion = version
_, err := startHTTPServers(config)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("below the minimum required version TLS 1.2"))
},
Entry("TLS 1.0", "VersionTLS10"),
Entry("TLS 1.1", "VersionTLS11"),
)

DescribeTable("should accept TLS min versions at or above TLS 1.2",
DescribeTable("should accept all TLS min versions",
func(version string) {
config.TLSMinVersion = version
var err error
cleanup, err = startHTTPServers(config)
Expect(err).NotTo(HaveOccurred())
},
Entry("TLS 1.0", "VersionTLS10"),
Entry("TLS 1.1", "VersionTLS11"),
Entry("TLS 1.2", "VersionTLS12"),
Entry("TLS 1.3", "VersionTLS13"),
)
Expand Down