From da1069917cb40d32f65afad5689b6c9fbc4c2e85 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:55:31 +0200 Subject: [PATCH 1/2] feat(grafana_datasource): add tls_servername argument --- plugins/modules/grafana_datasource.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/modules/grafana_datasource.py b/plugins/modules/grafana_datasource.py index b011e5db..3e8d4895 100644 --- a/plugins/modules/grafana_datasource.py +++ b/plugins/modules/grafana_datasource.py @@ -98,6 +98,10 @@ requests. type: bool default: false + tls_servername: + description: + - A Servername is used to verify the hostname on the returned certificate + type: str tls_client_cert: description: - The client TLS certificate. @@ -620,12 +624,10 @@ def get_datasource_payload(data, org_id=None): json_data["tlsAuth"] = True if data.get("tls_ca_cert"): secure_json_data["tlsCACert"] = data["tls_ca_cert"] - secure_json_data["tlsClientCert"] = data["tls_client_cert"] - secure_json_data["tlsClientKey"] = data["tls_client_key"] json_data["tlsAuthWithCACert"] = True - else: - secure_json_data["tlsClientCert"] = data["tls_client_cert"] - secure_json_data["tlsClientKey"] = data["tls_client_key"] + json_data["serverName"] = data["tls_servername"] + secure_json_data["tlsClientCert"] = data["tls_client_cert"] + secure_json_data["tlsClientKey"] = data["tls_client_key"] else: json_data["tlsAuth"] = False json_data["tlsAuthWithCACert"] = False @@ -821,6 +823,7 @@ def setup_module_object(): basic_auth_user=dict(type="str"), basic_auth_password=dict(type="str", no_log=True), with_credentials=dict(default=False, type="bool"), + tls_servername=dict(type="str"), tls_client_cert=dict(type="str", no_log=True), tls_client_key=dict(type="str", no_log=True), tls_ca_cert=dict(type="str", no_log=True), From bc4a74d78d530c76fc6fcc44eefbcda7c131a72c Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:57:50 +0200 Subject: [PATCH 2/2] docs: changelog fragment --- changelogs/fragments/395-datasource-tls-servername.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/395-datasource-tls-servername.yml diff --git a/changelogs/fragments/395-datasource-tls-servername.yml b/changelogs/fragments/395-datasource-tls-servername.yml new file mode 100644 index 00000000..c786274f --- /dev/null +++ b/changelogs/fragments/395-datasource-tls-servername.yml @@ -0,0 +1,3 @@ +--- +minor_changes: + - Add argument `tls_servername` for `grafana_datasource`