Validate TLS certificate files contain valid PEM data at startup #15071
+1,321
−951
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RabbitMQ currently accepts invalid TLS certificate files at startup without validation, only failing silently when clients attempt to connect. This occurs because Erlang's TLS implementation lazily loads certificates on first connection rather than at configuration time. Users may not discover misconfigured certificates until production traffic fails.
This change adds a
pem_filevalidator to the cuttlefish schema that reads certificate files and validates they contain valid PEM data usingpublic_key:pem_decode/1. The validator rejects empty files and files without valid PEM entries, causing RabbitMQ to fail at startup with a clear error message identifying the invalid file.The validator applies to all TLS certificate file mappings across 6 schema files:
cacertfile,certfile, andkeyfilefor main listeners, definitions import, syslog, HTTP auth backend, LDAP auth backend, and peer discovery (Consul, etcd, Kubernetes). DH parameter files continue using the existingfile_accessiblevalidator since they are not PEM-encoded certificates.Fixes #15065