8000 Add FIPS compliance requirements and improve test coverage by Elmo33 · Pull Request #2001 · Altinity/clickhouse-operator · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
4 changes: 4 additions & 0 deletions tests/e2e/kubectl.py
8000
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ def get_pod_names(chi_name, ns=None, shell=None):
return get_obj_names(chi_name, "pods", kind="chi", ns=ns, shell=shell)


def get_chk_pod_names(chk_name, ns=None, shell=None):
return get_obj_names(chk_name, "pods", kind="chk", ns=ns, shell=shell)


def get_obj_names(chi_name, obj_type="pods", kind = "chi", ns=None, shell=None):
label = ""
if kind == "chi":
Expand Down
65 changes: 65 additions & 0 deletions tests/e2e/manifests/chi/test-020015-chi-fips-scale-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# test-plan §6 CH row 6 — FIPS scale-up (start: 1 replica).
# Pair with test-020015-chi-fips-scale-2.yaml (same CHI name, replicasCount=2).
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-020015-chi-fips-scale
spec:
defaults:
templates:
podTemplate: fips
configuration:
clusters:
- name: default
secure: "yes"
insecure: "no"
layout:
shardsCount: 1
replicasCount: 1
settings:
http_port: _removed_
tcp_port: _removed_
mysql_port: _removed_
postgresql_port: _removed_
interserver_http_port: _removed_
tcp_port_secure: 9440
https_port: 8443
files:
openssl.xml: |
<yandex>
<openSSL>
<server>
<certificateFile>/etc/clickhouse-server/secrets.d/server.crt/clickhouse-certs/server.crt</certificateFile>
<privateKeyFile>/etc/clickhouse-server/secrets.d/server.key/clickhouse-certs/server.key</privateKeyFile>
<dhParamsFile>/etc/clickhouse-server/secrets.d/dhparam.pem/clickhouse-certs/dhparam.pem</dhParamsFile>
<verificationMode>none</verificationMode>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
</server>
</openSSL>
</yandex>
server.crt:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.crt
server.key:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.key
dhparam.pem:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: dhparam.pem
templates:
podTemplates:
- name: fips
spec:
containers:
- name: clickhouse
image: altinity/clickhouse-server:25.3.8.30001.altinityfips
imagePullPolicy: IfNotPresent
66 changes: 66 additions & 0 deletions tests/e2e/manifests/chi/test-020015-chi-fips-scale-2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# test-plan §6 CH row 6 — FIPS scale-up (target: 2 replicas).
# Same chi name as test-020015-chi-fips-scale-1.yaml so the operator scales,
# not recreates. Only replicasCount changes — every other field is identical.
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-020015-chi-fips-scale
spec:
defaults:
templates:
podTemplate: fips
configuration:
clusters:
- name: default
secure: "yes"
insecure: "no"
layout:
shardsCount: 1
replicasCount: 2
settings:
http_port: _removed_
tcp_port: _removed_
mysql_port: _removed_
postgresql_port: _removed_
interserver_http_port: _removed_
tcp_port_secure: 9440
https_port: 8443
files:
openssl.xml: |
<yandex>
<openSSL>
<server>
<certificateFile>/etc/clickhouse-server/secrets.d/server.crt/clickhouse-certs/server.crt</certificateFile>
<privateKeyFile>/etc/clickhouse-server/secrets.d/server.key/clickhouse-certs/server.key</privateKeyFile>
<dhParamsFile>/etc/clickhouse-server/secrets.d/dhparam.pem/clickhouse-certs/dhparam.pem</dhParamsFile>
<verificationMode>none</verificationMode>
<loadDefaultCAFile>true</loadDefaultCAFile>
<cacheSessions>true</cacheSessions>
<disableProtocols>sslv2,sslv3</disableProtocols>
<preferServerCiphers>true</preferServerCiphers>
</server>
</openSSL>
</yandex>
server.crt:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.crt
server.key:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.key
dhparam.pem:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: dhparam.pem
templates:
podTemplates:
- name: fips
spec:
containers:
- name: clickhouse
image: altinity/clickhouse-server:25.3.8.30001.altinityfips
imagePullPolicy: IfNotPresent
77 changes: 77 additions & 0 deletions tests/e2e/manifests/chi/test-030003.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030003
spec:
security:
clickhouse:
tls:
rootCASecretRef:
name: clickhouse-certs
key: ca.crt
useTemplates:
- name: test-030003-backup-template
configuration:
clusters:
- name: default
secure: "yes"
insecure: "no"
layout:
shardsCount: 1
replicasCount: 2
zookeeper:
nodes:
- host: chk-test-030003-keeper-0-0
port: 2281
secure: "yes"
settings:
http_port: _removed_
tcp_port: _removed_
interserver_http_port: _removed_
mysql_port: _removed_
postgresql_port: _removed_
https_port: 8443
tcp_port_secure: 9440
interserver_https_port: 9010
files:
openssl.xml: |
<yandex>
<openSSL>
<server>
<certificateFile>/etc/clickhouse-server/secrets.d/server.crt/clickhouse-certs/server.crt</certificateFile>
<privateKeyFile>/etc/clickhouse-server/secrets.d/server.key/clickhouse-certs/server.key</privateKeyFile>
<dhParamsFile>/etc/clickhouse-server/secrets.d/dhparam.pem/clickhouse-certs/dhparam.pem</dhParamsFile>
<!-- Server-auth TLS only: clients validate this certificate; the server does not require client certificates (not mTLS). -->
<verificationMode>none</verificationMode>
<disableProtocols>sslv2,sslv3,tlsv1,tlsv1_1</disableProtocols>
<cipherSuites>TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384</cipherSuites>
</server>
<client>
<caConfig>/etc/clickhouse-server/secrets.d/ca.crt/clickhouse-certs/ca.crt</caConfig>
<loadDefaultCAFile>false</loadDefaultCAFile>
<verificationMode>strict</verificationMode>
<disableProtocols>sslv2,sslv3,tlsv1,tlsv1_1</disableProtocols>
<cipherSuites>TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384</cipherSuites>
</client>
</openSSL>
</yandex>
server.crt:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.crt
server.key:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: server.key
dhparam.pem:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: dhparam.pem
ca.crt:
valueFrom:
secretKeyRef:
name: clickhouse-certs
key: ca.crt
17 changes: 17 additions & 0 deletions tests/e2e/manifests/chi/test-030007-chi-bypass-rejected.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030007-chi-bypass
spec:
# Spec-level security explicitly relaxes verify; under FIPS enforced the
# normalizer rejectFIPSBypass must abort before any StatefulSet is created.
security:
clickhouse:
tls:
verify: None
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
15 changes: 15 additions & 0 deletions tests/e2e/manifests/chi/test-030007-invalid-minversion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030007-invalid-minversion
spec:
security:
clickhouse:
tls:
minVersion: "9.9"
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
15 changes: 15 additions & 0 deletions tests/e2e/manifests/chi/test-030007-zk-verify-none.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030007-zk-verify-none
spec:
security:
zookeeper:
tls:
verify: None
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
24 changes: 24 additions & 0 deletions tests/e2e/manifests/chi/test-030008-case-insensitive.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030008-case-insensitive
spec:
defaults:
templates:
podTemplate: case-fips
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
templates:
podTemplates:
# Image tag uses uppercase "FIPS" — case-insensitive match SHALL
# still detect this as a FIPS image.
# Image is unpullable; we only verify admission acceptance.
- name: case-fips
spec:
containers:
- name: clickhouse
image: example.com/clickhouse-server:25.3.FIPS
23 changes: 23 additions & 0 deletions tests/e2e/manifests/chi/test-030008-digest-only.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030008-digest-only
spec:
defaults:
templates:
podTemplate: digest
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
templates:
podTemplates:
# Digest-only image reference has no tag at all.
# SHALL NOT be detected as FIPS at admission.
- name: digest
spec:
containers:
- name: clickhouse
image: altinity/clickhouse-server@sha256:0000000000000000000000000000000000000000000000000000000000000000
23 changes: 23 additions & 0 deletions tests/e2e/manifests/chi/test-030008-fips-suffix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030008-fips-suffix
spec:
defaults:
templates:
podTemplate: fips-suffix
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
templates:
podTemplates:
# Image tag contains "fips" substring — SHALL be detected as FIPS.
# Image is unpullable; we only verify admission acceptance.
- name: fips-suffix
spec:
containers:
- name: clickhouse
image: example.com/clickhouse-server:25.3.8.30001.fips
23 changes: 23 additions & 0 deletions tests/e2e/manifests/chi/test-030008-registry-path.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030008-registry-path
spec:
defaults:
templates:
podTemplate: registry-fips
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
templates:
podTemplates:
# Registry hostname contains "fips" but the image tag does not.
# SHALL NOT satisfy FIPS tag detection.
- name: registry-fips
spec:
containers:
- name: clickhouse
image: fips.example.com/clickhouse-server:25.3.8.30001.altinitystable
25 changes: 25 additions & 0 deletions tests/e2e/manifests/chi/test-030008-runtime-decoy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: "clickhouse.altinity.com/v1"
kind: "ClickHouseInstallation"
metadata:
name: test-030008-runtime-decoy
spec:
defaults:
templates:
podTemplate: decoy
configuration:
clusters:
- name: c1
layout:
shardsCount: 1
replicasCount: 1
templates:
podTemplates:
# Tag contains "fips" (admission passes) but image is the stable binary
# (runtime SELECT version() lacks "fips"). Create the alias before the test:
# docker tag altinity/clickhouse-server:25.8.16.10002.altinitystable \
# altinity/clickhouse-server:25.8.16.10002.altinityfips-decoy
- name: decoy
spec:
containers:
- name: clickhouse
image: altinity/clickhouse-server:25.8.16.10002.altinityfips-decoy
Loading
Loading
0