Module: check_mk
Branch: master
Commit: 895d84a591434ff0d30348f1c05ca7916c7d4da2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=895d84a591434f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Nov 18 13:30:37 2013 +0100
FIX LDAP: Various small improvements for handling the LDAP user connector
---
.werks/213 | 8 ++++++++
ChangeLog | 1 +
web/htdocs/userdb.py | 8 ++++----
web/htdocs/wato.py | 16 ++++++++++++----
web/plugins/userdb/ldap.py | 16 ++++++++++++++--
web/plugins/wato/check_mk_configuration.py | 8 +++++++-
6 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/.werks/213 b/.werks/213
new file mode 100644
index 0000000..212b10b
--- /dev/null
+++ b/.werks/213
@@ -0,0 +1,8 @@
+Title: LDAP: Various small improvements for handling the LDAP user connector
+Level: 1
+Component: wato
+Version: 1.2.3i7
+Date: 1384777799
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index fc6279f..0573e06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* 0212 FIX: Fixed loading of sites with configured tcp socket in WATO
* 0095 FIX: Fixed problem with portnumber in Wato Distributed Monitoring dialog
* 0096 FIX: Fixed exception in wato
+ * 0213 FIX: LDAP: Various small improvements for handling the LDAP user connector
Notifications:
* 0005 Added notification script for sending SMS via
mobilant.com...
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index 794e64a..d69d733 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -664,12 +664,12 @@ def hook_sync(connector_id = None, add_to_changelog = False,
only_username = Non
if config.debug:
import traceback
html.show_error(
- "<h3>" + _("Error executing sync hook")
+ "</h3>"
+ "<h3>" + _("Error during sync") +
"</h3>"
"<pre>%s</pre>" % (traceback.format_exc())
)
else:
html.show_error(
- "<h3>" + _("Error executing sync hook")
+ "</h3>"
+ "<h3>" + _("Error during sync") +
"</h3>"
"<pre>%s</pre>" % (e)
)
no_errors = False
@@ -678,7 +678,7 @@ def hook_sync(connector_id = None, add_to_changelog = False,
only_username = Non
raise
import traceback
html.show_error(
- "<h3>" + _("Error executing sync hook") +
"</h3>"
+ "<h3>" + _("Error during sync") +
"</h3>"
"<pre>%s</pre>" % (traceback.format_exc())
)
no_errors = False
@@ -697,7 +697,7 @@ def hook_save(users):
if config.debug:
import traceback
html.show_error(
- "<h3>" + _("Error executing save hook") +
"</h3>"
+ "<h3>" + _("Error during saving") +
"</h3>"
"<pre>%s</pre>" % (traceback.format_exc())
)
else:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index f8ae000..a25d868 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5847,10 +5847,15 @@ def mode_ldap_config(phase):
html.write('<h2>' + _('Diagnostics') + '</h2>')
if not html.var('_test'):
- html.message(_('You can verify the single parts of your ldap configuration
using this '
+ html.message('<p>%s</p><p>%s</p>' %
+ (_('You can verify the single parts of your ldap configuration
using this '
'dialog. Simply make your configuration in the form on the
left side and '
'hit the "Save & Test" button to execute the
tests. After '
- 'the page reload, you should see the results of the test
here.'))
+ 'the page reload, you should see the results of the test
here.'),
+ _('If you need help during configuration or experience problems,
please refer '
+ 'to the Multisite <a target="_blank" '
+
'href="http://mathias-kettner.de/checkmk_multisite_ldap_integration.html">'
+ 'LDAP Documentation</a>.')))
else:
def test_connect(address):
conn, msg = userdb.ldap_connect_server(address)
@@ -8742,8 +8747,11 @@ def mode_users(phase):
elif c == False:
return ""
elif html.var('_sync'):
- if userdb.hook_sync(add_to_changelog = True):
- return None, _('The user synchronization completed
successfully.')
+ try:
+ if userdb.hook_sync(add_to_changelog = True, raise_exc = True):
+ return None, _('The user synchronization completed
successfully.')
+ except Exception, e:
+ raise MKUserError(None, str(e))
return None
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index d419730..23f899d 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -949,9 +949,21 @@ def ldap_sync(add_to_changelog, only_username):
wato.log_pending(wato.SYNCRESTART, None, "edit-users",
_("LDAP Connector: Created user %s" % user_id))
else:
+ details = []
+ if added:
+ details.append(_('Added: %s') % ', '.join(added))
+ if removed:
+ details.append(_('Removed: %s') % ', '.join(removed))
+ if changed:
+ if 'ldap_pw_last_changed' in changed and 'serial' in
changed:
+ details.append(_('Password Changed'))
+ changed.remove('ldap_pw_last_changed')
+ changed.remove('serial')
+ if changed:
+ details.append(('Changed: %s') % ', '.join(changed))
+
wato.log_pending(wato.SYNCRESTART, None, "edit-users",
- _("LDAP Connector: Modified user %s (Added: %s, Removed: %s,
Changed: %s)" %
- (user_id, ', '.join(added), ', '.join(removed),
', '.join(changed))))
+ _("LDAP Connector: Modified user %s (%s)") % (user_id, ',
'.join(details)))
duration = time.time() - start_time
ldap_log('SYNC FINISHED - Duration: %0.3f sec' % duration)
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 92a6170..a4e2ec0 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -530,7 +530,13 @@ register_configvar(group,
)),
("use_ssl", FixedValue(
title = _("Use SSL"),
- help = _("Connect to the LDAP server with a SSL encrypted
connection."),
+ help = _("Connect to the LDAP server with a SSL encrypted
connection. You might need "
+ "to configure the OpenLDAP installation on your
monitoring server to accept "
+ "the certificates of the LDAP server. This is normally
done via system wide "
+ "configuration of the CA certificate which signed the
certificate of the LDAP "
+ "server. Please refer to the <a
target=\"_blank\" "
+
"href=\"http://mathias-kettner.de/checkmk_multisite_ldap_integration.html\">"
+ "documentation</a> for details."),
value = True,
totext = _("Encrypt the network connection using SSL."),
)),