Skip to content

Commit 024a5fb

Browse files
committed
Implement mTLS support.
1 parent 624b99e commit 024a5fb

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

changelogs/fragments/mtls.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
minor_changes:
2+
- All modules - Enable mTLS support for all modules.
3+
This is not a Checkmk feature, but one of Ansible and the respective web server.
4+
This collection only provides the means to use mTLS, we neither document how to implement it,
5+
nor will we provide support on top of enabling the basic functionality.

plugins/doc_fragments/common.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ class ModuleDocFragment(object):
4343
description: Authentication cookie for the Checkmk session.
4444
required: false
4545
type: str
46+
client_cert:
47+
description:
48+
- Path to the client certificate file for authentication with the web server hosting Checkmk.
49+
This is not a Checkmk feature, but one of Ansible and the respective web server.
50+
required: false
51+
type: path
52+
client_key:
53+
description:
54+
- Path to the client certificate key file for authentication with the web server hosting Checkmk.
55+
This is not a Checkmk feature, but one of Ansible and the respective web server.
56+
required: false
57+
type: path
4658
validate_certs:
4759
description:
4860
- Whether to validate the SSL certificate of the Checkmk server.

plugins/module_utils/api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def __init__(self, module, logger=None):
4646
automation_secret = self.params.get("automation_secret")
4747
auth_cookie = self.params.get("auth_cookie")
4848

49+
# Enable mTLS
50+
self.client_cert = self.params.get("client_cert")
51+
self.client_key = self.params.get("client_key")
52+
4953
if api_auth_type == "bearer":
5054
# Bearer Authentication
5155
if not automation_user or not automation_secret:

plugins/module_utils/utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ def base_argument_spec():
5252
no_log=True,
5353
fallback=(env_fallback, ["CHECKMK_VAR_API_AUTH_COOKIE"]),
5454
),
55+
client_cert=dict(
56+
type="path",
57+
required=False,
58+
default=None,
59+
fallback=(env_fallback, ["CHECKMK_VAR_CLIENT_CERT"]),
60+
),
61+
client_key=dict(
62+
type="path",
63+
required=False,
64+
default=None,
65+
fallback=(env_fallback, ["CHECKMK_VAR_CLIENT_KEY"]),
66+
),
5567
)
5668

5769

0 commit comments

Comments
 (0)