Bug #77693
opencephadm doesn't validate spec-provided TLS certificates during service apply
0%
Description
Service specs that provide user certificates through inline TLS fields may bypass the same certificate validation used by the certmgr CLI path.
For example, certificates provided through:
- RGW `rgw_frontend_ssl_certificate`
- service spec `ssl_cert` / `ssl_key` with `certificate_source: inline`
are parsed and later stored/applied, but they are not consistently validated at spec-apply time using `cert_mgr.check_certificate_state()`. This means invalid or expired certificates may be accepted through service specs even though similar input is rejected when uploaded through `ceph orch certmgr cert-key set`.
Expected behavior:
Service-spec-provided certificates should be validated before the spec is stored/applied. Invalid or expired certificates should fail `ceph orch apply -i` with a clear `OrchestratorError`.
Suggested fix:
Add apply-time validation in the cephadm service spec apply path, close to the existing certificate source checks. The validation should reuse `cert_mgr.check_certificate_state()` for user-provided inline certificates and service-scoped reference certificates.
`parse_tls_pem_bundle()` should remain focused on PEM parsing and structural validation only.
Affected paths:
- `certificate_source: inline`
- RGW legacy `rgw_frontend_ssl_certificate`
- service-scoped `certificate_source: reference` entries already present in certmgr
Validation should happen before persisting the service spec.
Tests to add:
- expired inline `ssl_cert` / `ssl_key` is rejected during service apply
- expired RGW `rgw_frontend_ssl_certificate` bundle is rejected during service apply
- valid fullchain PEM remains accepted
- reference-mode service-scoped invalid/expired cert is rejected during service apply
No data to display