|
8 | 8 | . "github.com/onsi/ginkgo/v2" |
9 | 9 | . "github.com/onsi/gomega" |
10 | 10 | . "github.com/onsi/gomega/gstruct" |
| 11 | + configv1 "github.com/openshift/api/config/v1" |
11 | 12 | monv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" |
12 | 13 | networkingv1 "k8s.io/api/networking/v1" |
13 | 14 |
|
@@ -104,6 +105,11 @@ var _ = Describe("App server assets", func() { |
104 | 105 | TLSCertificatePath: path.Join(utils.OLSAppCertsMountRoot, utils.OLSCertsSecretName, "tls.crt"), |
105 | 106 | TLSKeyPath: path.Join(utils.OLSAppCertsMountRoot, utils.OLSCertsSecretName, "tls.key"), |
106 | 107 | }, |
| 108 | + TLSSecurityProfile: &utils.TLSSecurityProfileConfig{ |
| 109 | + ProfileType: "IntermediateType", |
| 110 | + MinTLSVersion: string(configv1.TLSProfiles[configv1.TLSProfileIntermediateType].MinTLSVersion), |
| 111 | + Ciphers: configv1.TLSProfiles[configv1.TLSProfileIntermediateType].Ciphers, |
| 112 | + }, |
107 | 113 | ReferenceContent: utils.ReferenceContent{ |
108 | 114 | EmbeddingsModelPath: "/app-root/embeddings_model", |
109 | 115 | Indexes: []utils.ReferenceIndex{ |
@@ -154,6 +160,48 @@ var _ = Describe("App server assets", func() { |
154 | 160 | utils.DeleteTelemetryPullSecret(ctx, k8sClient) |
155 | 161 | }) |
156 | 162 |
|
| 163 | + It("should generate configmap with modern TLS security profile", func() { |
| 164 | + cr.Spec.OLSConfig.TLSSecurityProfile = &configv1.TLSSecurityProfile{ |
| 165 | + Type: configv1.TLSProfileModernType, |
| 166 | + } |
| 167 | + cm, err := GenerateOLSConfigMap(testReconcilerInstance, context.TODO(), cr) |
| 168 | + Expect(err).NotTo(HaveOccurred()) |
| 169 | + |
| 170 | + var olsConfigMap map[string]interface{} |
| 171 | + err = yaml.Unmarshal([]byte(cm.Data[utils.OLSConfigFilename]), &olsConfigMap) |
| 172 | + Expect(err).NotTo(HaveOccurred()) |
| 173 | + Expect(olsConfigMap).To(HaveKeyWithValue("ols_config", HaveKeyWithValue("tlsSecurityProfile", MatchKeys(Options(IgnoreExtras), Keys{ |
| 174 | + "type": Equal("ModernType"), |
| 175 | + "minTLSVersion": Equal(string(configv1.TLSProfiles[configv1.TLSProfileModernType].MinTLSVersion)), |
| 176 | + })))) |
| 177 | + }) |
| 178 | + |
| 179 | + It("should generate configmap with custom TLS security profile", func() { |
| 180 | + cr.Spec.OLSConfig.TLSSecurityProfile = &configv1.TLSSecurityProfile{ |
| 181 | + Type: configv1.TLSProfileCustomType, |
| 182 | + Custom: &configv1.CustomTLSProfile{ |
| 183 | + TLSProfileSpec: configv1.TLSProfileSpec{ |
| 184 | + MinTLSVersion: configv1.VersionTLS13, |
| 185 | + Ciphers: []string{ |
| 186 | + "TLS_AES_128_GCM_SHA256", |
| 187 | + "TLS_AES_256_GCM_SHA384", |
| 188 | + }, |
| 189 | + }, |
| 190 | + }, |
| 191 | + } |
| 192 | + cm, err := GenerateOLSConfigMap(testReconcilerInstance, context.TODO(), cr) |
| 193 | + Expect(err).NotTo(HaveOccurred()) |
| 194 | + |
| 195 | + var olsConfigMap map[string]interface{} |
| 196 | + err = yaml.Unmarshal([]byte(cm.Data[utils.OLSConfigFilename]), &olsConfigMap) |
| 197 | + Expect(err).NotTo(HaveOccurred()) |
| 198 | + Expect(olsConfigMap).To(HaveKeyWithValue("ols_config", HaveKeyWithValue("tlsSecurityProfile", MatchKeys(Options(IgnoreExtras), Keys{ |
| 199 | + "type": Equal("Custom"), |
| 200 | + "minTLSVersion": Equal("VersionTLS13"), |
| 201 | + "ciphers": ContainElements("TLS_AES_128_GCM_SHA256", "TLS_AES_256_GCM_SHA384"), |
| 202 | + })))) |
| 203 | + }) |
| 204 | + |
157 | 205 | It("should generate configmap with queryFilters", func() { |
158 | 206 | crWithFilters := utils.WithQueryFilters(cr) |
159 | 207 | cm, err := GenerateOLSConfigMap(testReconcilerInstance, context.TODO(), crWithFilters) |
@@ -1237,6 +1285,19 @@ ols_config: |
1237 | 1285 | - product_docs_index_id: ocp-product-docs-` + major + `_` + minor + ` |
1238 | 1286 | product_docs_index_path: /app-root/vector_db/ocp_product_docs/` + major + `.` + minor + ` |
1239 | 1287 | product_docs_origin: Red Hat OpenShift 123.456 documentation |
| 1288 | + tlsSecurityProfile: |
| 1289 | + ciphers: |
| 1290 | + - TLS_AES_128_GCM_SHA256 |
| 1291 | + - TLS_AES_256_GCM_SHA384 |
| 1292 | + - TLS_CHACHA20_POLY1305_SHA256 |
| 1293 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 1294 | + - ECDHE-RSA-AES128-GCM-SHA256 |
| 1295 | + - ECDHE-ECDSA-AES256-GCM-SHA384 |
| 1296 | + - ECDHE-RSA-AES256-GCM-SHA384 |
| 1297 | + - ECDHE-ECDSA-CHACHA20-POLY1305 |
| 1298 | + - ECDHE-RSA-CHACHA20-POLY1305 |
| 1299 | + minTLSVersion: VersionTLS12 |
| 1300 | + type: IntermediateType |
1240 | 1301 | tls_config: |
1241 | 1302 | tls_certificate_path: /etc/certs/lightspeed-tls/tls.crt |
1242 | 1303 | tls_key_path: /etc/certs/lightspeed-tls/tls.key |
@@ -1297,6 +1358,19 @@ ols_config: |
1297 | 1358 | - product_docs_index_id: ocp-product-docs-` + major + `_` + minor + ` |
1298 | 1359 | product_docs_index_path: /app-root/vector_db/ocp_product_docs/` + major + `.` + minor + ` |
1299 | 1360 | product_docs_origin: Red Hat OpenShift 123.456 documentation |
| 1361 | + tlsSecurityProfile: |
| 1362 | + ciphers: |
| 1363 | + - TLS_AES_128_GCM_SHA256 |
| 1364 | + - TLS_AES_256_GCM_SHA384 |
| 1365 | + - TLS_CHACHA20_POLY1305_SHA256 |
| 1366 | + - ECDHE-ECDSA-AES128-GCM-SHA256 |
| 1367 | + - ECDHE-RSA-AES128-GCM-SHA256 |
| 1368 | + - ECDHE-ECDSA-AES256-GCM-SHA384 |
| 1369 | + - ECDHE-RSA-AES256-GCM-SHA384 |
| 1370 | + - ECDHE-ECDSA-CHACHA20-POLY1305 |
| 1371 | + - ECDHE-RSA-CHACHA20-POLY1305 |
| 1372 | + minTLSVersion: VersionTLS12 |
| 1373 | + type: IntermediateType |
1300 | 1374 | tls_config: |
1301 | 1375 | tls_certificate_path: /etc/certs/lightspeed-tls/tls.crt |
1302 | 1376 | tls_key_path: /etc/certs/lightspeed-tls/tls.key |
|
0 commit comments