Просмотр исходного кода

Added certificate checking option

Michael Honkoop 3 месяцев назад
Родитель
Сommit
f92af0ca97

+ 22 - 3
plugins/edirectory_monitor/rulesets/special_agent_edirectory_monitor.py

@@ -1,6 +1,12 @@
 #!/usr/bin/env python3
 
-from cmk.rulesets.v1 import Label, Help, Title
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+
+# (c) Michael Honkoop <mhonkoop@comsolve.nl>
+
+# License: GNU General Public License v2
+
+from cmk.rulesets.v1 import Help, Label, Title
 from cmk.rulesets.v1.form_specs import (
     DictElement,
     Dictionary,
@@ -8,6 +14,8 @@ from cmk.rulesets.v1.form_specs import (
     Password,
     String,
     validators,
+    BooleanChoice,
+    DefaultValue,
 )
 from cmk.rulesets.v1.rule_specs import SpecialAgent, Topic
 
@@ -15,13 +23,14 @@ def _parameter_form() -> Dictionary:
     return Dictionary(
         help_text=Help(
             "This rule selects the Agent eDirectory Monitor instead of the normal Checkmk Agent "
-            "which collects information through a LDAP(S) call to cn=Monitor"
+            "which collects information through a LDAP call to cn=Monitor"
         ),
         elements={
             "user": DictElement(
                 required=True,
                 parameter_form=String(
-                    title=Title("DN of Username to use for Monitoring"),
+                    title=Title("DN of Username for Monitoring"),
+                    custom_validate=(validators.LengthInRange(min_value=1),),
                 ),
             ),
             "password": DictElement(
@@ -32,6 +41,16 @@ def _parameter_form() -> Dictionary:
                     migrate=migrate_to_password,
                 ),
             ),
+            "check_tls": DictElement[bool](
+                parameter_form=BooleanChoice(
+                    title=Title("Certificate Validation"),
+                    help_text=Help(
+                        "Checking this option will Enable Certificate Validation."
+                    ),
+                    label=Label("Enable Certificate Validation"),
+                ),
+                required=False,
+            ),
         },
     )