feat(centreon): support TLS verification and mTLS client certificates#6633
Open
aditya-786 wants to merge 1 commit into
Open
feat(centreon): support TLS verification and mTLS client certificates#6633aditya-786 wants to merge 1 commit into
aditya-786 wants to merge 1 commit into
Conversation
The Centreon provider made its API calls with the requests default of verify=True and no way to configure TLS, so an on-prem Centreon behind a self-signed or internal-CA certificate could not be connected, and mutual TLS was not possible. Add verify, ca_certificate, client_certificate, and client_key auth-config fields (the connection form renders them from the provider metadata) and thread them through every request: verify=False skips verification, a CA certificate verifies the server, and a client certificate plus key enables mutual TLS. The PEM-content fields are written to temporary files for the duration of each request and removed afterwards. refs keephq#3340
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are these changes needed?
The Centreon provider issued all of its API calls with the
requestsdefault ofverify=Trueand no way to configure TLS. Centreon is typically self-hosted, so an instance behind a self-signed or internal-CA certificate could not be connected at all (the calls fail with an SSL verification error), and there was no way to present a client certificate for mutual TLS.This adds the Grafana-datasource-style TLS controls requested in #3340 to the Centreon provider: skip-verify, a CA certificate to verify the server, and a client certificate plus key for mTLS. It is one incremental, per-provider step toward the umbrella issue (the same pattern as the merged Cilium mTLS and jiraonprem verify changes), so it references rather than closes #3340.
What changed
CentreonProviderAuthConfig:verify(switch, default true),ca_certificate,client_certificate, andclient_key(file). The connection form renders them automatically from the provider metadata, so there is no frontend change.requests.getcall:verify=falseskips TLS verification (for self-signed certs without a CA).verify=<ca path>).cert=(cert, key)).requestsneeds file paths).verifystays true and nocertis sent.Example connection:
Checks
tests/providers/centreon_provider/test_centreon_tls.py(7 tests): verify defaults to on,verify=falseskips verification, a CA cert is passed as a file path with the right contents,verify=falsetakes precedence over a CA cert, a client cert + key enables mTLS, a client cert without a key is ignored, and the temporary cert files are cleaned up after the request. All pass locally; ruff clean; the autogenerated provider snippet was regenerated.