Module: check_mk
Branch: master
Commit: 157b74c4f412212de068f0897a903ab945f6ae10
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=157b74c4f41221…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Jan 9 10:18:07 2013 +0100
Added connect_timeout parameter to ldap connection settings
---
.bugs/875 | 9 +++++++++
web/plugins/userdb/ldap.py | 7 +++----
web/plugins/wato/check_mk_configuration.py | 6 ++++++
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.bugs/875 b/.bugs/875
new file mode 100644
index 0000000..59bef6b
--- /dev/null
+++ b/.bugs/875
@@ -0,0 +1,9 @@
+Title: Create ldap debugging page
+Component: multisite
+State: open
+Date: 2013-01-07 08:43:52
+Targetversion: future
+Class: feature
+
+It would be nice to have a dedicated ldap connection debugging page which displays
+the configured ldap settings and maybe shows all objects reported by ldap.
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 5d7b6fa..fb441f2 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -37,12 +37,9 @@ import time, copy
import site, sys
try:
sys.path.extend(site.getsitepackages())
-except: # Workaround, python 2.6 ( debian squeeze )
+except: # Workaround, python 2.6 ( debian squeeze )
sys.path.extend(["/usr/local/lib/python2.6/dist-packages"])
sys.path.extend(["/usr/lib/python2.6/dist-packages"])
- pass
-
-
try:
# docs:
http://www.python-ldap.org/doc/html/index.html
@@ -136,6 +133,8 @@ def ldap_connect():
try:
ldap_connection = ldap.ldapobject.ReconnectLDAPObject(ldap_uri())
ldap_connection.protocol_version = config.ldap_connection['version']
+ ldap_connection.network_timeout =
config.ldap_connection.get('connect_timeout', 2.0)
+
ldap_default_bind()
# on success, store the connection options the connection has been made with
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index f546681..e736468 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -316,6 +316,12 @@ register_configvar(group,
value = True,
totext = _("Encrypt the network connection using SSL."),
)),
+ ("connect_timeout", Float(
+ title = _("LDAP Connect Timeout (sec)"),
+ help = _("Timeout for the initial connection to the LDAP server in
seconds."),
+ minvalue = 1.0,
+ default_value = 2.0,
+ )),
("version", DropdownChoice(
title = _("LDAP Version"),
help = _("Select the LDAP version the LDAP server is serving. Most
modern "