Skip to content

Commit e1c5d84

Browse files
authored
Merge pull request #142 from ormergi/allow-insecure-ciphers
webhook server,tls: Allow using insecure ciphers and ciphers suites when tls-min-version is 1.3
2 parents 556a72f + 8e77798 commit e1c5d84

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

cmd/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ func main() {
8888
"Supported values are tls package constants names (e.g. VersionTLS13), please see "+
8989
"https://pkg.go.dev/crypto/tls#pkg-constants")
9090
flag.StringVar(&tlsCipherSuitesRaw, "tls-cipher-suites", "",
91-
"Comma-separated list of TLS cipher suite names (OpenSSL names. E.g: TLS_AES_128_GCM_SHA256).")
91+
"Comma-separated list of TLS cipher suite names."+
92+
"Supported values are tls package constants names (e.g. TLS_AES_128_GCM_SHA256), please see "+
93+
"https://pkg.go.dev/crypto/tls#pkg-constants"+
94+
"When 'min-tls-version' is 'VersionTLS13', cipher suites are selected by the runtime.")
9295
flag.StringVar(&tlsCurvePreferencesRaw, "tls-curve-preferences", "",
9396
"Comma-separated list of TLS curve preference names. "+
9497
"Supported values are tls package constants names (e.g. CurveP256), please see "+

pkg/config/tls.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ func ParseTLSOptions(
6868
}
6969

7070
cipherSuiteNames := parseStringSlice(tlsCipherSuitesRaw)
71-
if err := validateSafeCipherSuite(cipherSuiteNames); err != nil {
72-
return nil, err
73-
}
74-
if err := validateTLSVersionConfigurableCiphers(tlsMinVersion, cipherSuiteNames); err != nil {
75-
return nil, err
76-
}
7771
cipherSuiteIDs, err := toCipherSuiteIDs(cipherSuiteNames)
7872
if err != nil {
7973
return nil, err
@@ -110,22 +104,6 @@ func toTLSVersion(tlsVersionName string) (uint16, error) {
110104
return tlsVersion, nil
111105
}
112106

113-
func validateSafeCipherSuite(cipherSuiteNames []string) error {
114-
for _, cipherSuiteName := range cipherSuiteNames {
115-
if _, exist := indexedInsecureCipherSuiteNames[cipherSuiteName]; exist {
116-
return fmt.Errorf("using insecure cipher suite %q is not allowed", cipherSuiteName)
117-
}
118-
}
119-
return nil
120-
}
121-
122-
func validateTLSVersionConfigurableCiphers(versionID uint16, cipherSuiteNames []string) error {
123-
if versionID == tls.VersionTLS13 && len(cipherSuiteNames) > 0 {
124-
return fmt.Errorf("configuring cipher suites for TLS 1.3 is not allowed")
125-
}
126-
return nil
127-
}
128-
129107
func toCipherSuiteIDs(cipherSuiteNames []string) ([]uint16, error) {
130108
ids, err := getValuesByKeys(tlsCipherSuiteIDByName, cipherSuiteNames)
131109
if err != nil {

pkg/config/tls_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,6 @@ var _ = Describe("ParseTLSOptions", func() {
6565
ciphers: "TLS_AES_128_GCM_SHA256",
6666
},
6767
),
68-
Entry("cipher suites are specified and minimal version is 1.3",
69-
flags{
70-
minVersion: "VersionTLS13",
71-
ciphers: "TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384",
72-
},
73-
),
74-
Entry("insecure cipher suite is specified",
75-
flags{
76-
minVersion: "VersionTLS12",
77-
// TLS_RSA_WITH_AES_128_CBC_SHA256 is insecure cipher suite for TLS 1.2
78-
ciphers: "TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA256",
79-
},
80-
),
8168
)
8269

8370
DescribeTable("should succeed, given",

0 commit comments

Comments
 (0)