Skip to content

Commit eea8646

Browse files
committed
Support modern TLS security Profile
1 parent 191249b commit eea8646

File tree

2 files changed

+5
-36
lines changed

2 files changed

+5
-36
lines changed

openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func validateTLSSecurityProfileType(fieldPath *field.Path, profile *configv1.TLS
184184
string(configv1.TLSProfileOldType),
185185
string(configv1.TLSProfileIntermediateType),
186186
string(configv1.TLSProfileCustomType),
187+
string(configv1.TLSProfileModernType),
187188
}
188189

189190
switch profile.Type {
@@ -200,7 +201,9 @@ func validateTLSSecurityProfileType(fieldPath *field.Path, profile *configv1.TLS
200201
errs = append(errs, field.Required(fieldPath.Child("intermediate"), fmt.Sprintf(typeProfileMismatchFmt, profile.Type)))
201202
}
202203
case configv1.TLSProfileModernType:
203-
errs = append(errs, field.NotSupported(fieldPath.Child("type"), profile.Type, availableTypes))
204+
if profile.Modern == nil {
205+
errs = append(errs, field.Required(fieldPath.Child("modern"), fmt.Sprintf(typeProfileMismatchFmt, profile.Type)))
206+
}
204207
case configv1.TLSProfileCustomType:
205208
if profile.Custom == nil {
206209
errs = append(errs, field.Required(fieldPath.Child("custom"), fmt.Sprintf(typeProfileMismatchFmt, profile.Type)))
@@ -247,10 +250,6 @@ func haveRequiredHTTP2CipherSuites(suites []string) bool {
247250
func validateMinTLSVersion(fieldPath *field.Path, version configv1.TLSProtocolVersion) field.ErrorList {
248251
errs := field.ErrorList{}
249252

250-
if version == configv1.VersionTLS13 {
251-
return append(errs, field.NotSupported(fieldPath, version, []string{string(configv1.VersionTLS10), string(configv1.VersionTLS11), string(configv1.VersionTLS12)}))
252-
}
253-
254253
if _, err := libgocrypto.TLSVersion(string(version)); err != nil {
255254
errs = append(errs, field.Invalid(fieldPath, version, err.Error()))
256255
}

openshift-kube-apiserver/admission/customresourcevalidation/apiserver/validate_apiserver_test.go

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -143,28 +143,13 @@ func Test_validateTLSSecurityProfile(t *testing.T) {
143143
field.Required(rootFieldPath.Child("intermediate"), "type set to Intermediate, but the corresponding field is unset"),
144144
},
145145
},
146-
{
147-
name: "modern type - currently unsupported",
148-
profile: &configv1.TLSSecurityProfile{
149-
Type: configv1.TLSProfileModernType,
150-
Modern: &configv1.ModernTLSProfile{},
151-
},
152-
want: field.ErrorList{
153-
field.NotSupported(rootFieldPath.Child("type"), configv1.TLSProfileModernType,
154-
[]string{
155-
string(configv1.TLSProfileOldType),
156-
string(configv1.TLSProfileIntermediateType),
157-
string(configv1.TLSProfileCustomType),
158-
}),
159-
},
160-
},
161146
{
162147
name: "unknown type",
163148
profile: &configv1.TLSSecurityProfile{
164149
Type: "something",
165150
},
166151
want: field.ErrorList{
167-
field.Invalid(rootFieldPath.Child("type"), "something", "unknown type, valid values are: [Old Intermediate Custom]"),
152+
field.Invalid(rootFieldPath.Child("type"), "something", "unknown type, valid values are: [Old Intermediate Custom Modern]"),
168153
},
169154
},
170155
{
@@ -211,21 +196,6 @@ func Test_validateTLSSecurityProfile(t *testing.T) {
211196
field.Invalid(rootFieldPath.Child("custom", "ciphers"), []string(nil), "http2: TLSConfig.CipherSuites is missing an HTTP/2-required AES_128_GCM_SHA256 cipher (need at least one of ECDHE-RSA-AES128-GCM-SHA256 or ECDHE-ECDSA-AES128-GCM-SHA256)"),
212197
},
213198
},
214-
{
215-
name: "min tls 1.3 - currently unsupported",
216-
profile: &configv1.TLSSecurityProfile{
217-
Type: "Custom",
218-
Custom: &configv1.CustomTLSProfile{
219-
TLSProfileSpec: configv1.TLSProfileSpec{
220-
Ciphers: []string{"ECDHE-ECDSA-CHACHA20-POLY1305"},
221-
MinTLSVersion: configv1.VersionTLS13,
222-
},
223-
},
224-
},
225-
want: field.ErrorList{
226-
field.NotSupported(rootFieldPath.Child("custom", "minTLSVersion"), configv1.VersionTLS13, []string{string(configv1.VersionTLS10), string(configv1.VersionTLS11), string(configv1.VersionTLS12)}),
227-
},
228-
},
229199
{
230200
name: "custom profile missing required http2 ciphers",
231201
profile: &configv1.TLSSecurityProfile{

0 commit comments

Comments
 (0)