Module: check_mk
Branch: master
Commit: a478d4c3dea327cc7415c89f3ddf2f9bc9772245
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a478d4c3dea327…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 21 12:09:16 2012 +0100
ldap: Improved ldap configuration a bit
---
web/plugins/userdb/ldap.py | 24 +++++++++++++++++-------
web/plugins/wato/check_mk_configuration.py | 9 ++++-----
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 5f40e38..fce0856 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -294,14 +294,19 @@ def ldap_attribute_plugins_elements():
for key, plugin in items:
if 'parameters' not in plugin:
param = []
+ elements.append((key, FixedValue(
+ title = plugin['title'],
+ help = plugin['help'],
+ value = None,
+ totext = 'no_param_txt' in plugin and plugin['no_param_txt'] \
+ or _('This synchronization plugin has no parameters.'),
+ )))
else:
- param = plugin['parameters']
-
- elements.append((key, Dictionary(
- title = plugin['title'],
- help = plugin['help'],
- elements = param,
- )))
+ elements.append((key, Dictionary(
+ title = plugin['title'],
+ help = plugin['help'],
+ elements = plugin['parameters'],
+ )))
return elements
# Returns a list of all needed LDAP attributes of all enabled plugins
@@ -335,6 +340,7 @@ ldap_attribute_plugins['email'] = {
'convert': ldap_convert_mail,
# User-Attributes to be written by this plugin and will be locked in WATO
'lock_attributes': [ 'email' ],
+ 'no_param_txt': _('Synchronize the "mail" attribute of LDAP users into Check_MK.'),
}
ldap_attribute_plugins['alias'] = {
@@ -443,6 +449,7 @@ ldap_attribute_plugins['groups_to_contactgroups'] = {
'contactgroup must match the common name of the LDAP group.'),
'convert': ldap_convert_groups_to_contactgroups,
'lock_attributes': ['contactgroups'],
+ 'no_param_txt': _('Add user to all contactgroups where the common name matches the group name.'),
}
def ldap_convert_groups_to_roles(params, user_id, ldap_user, user):
@@ -592,8 +599,11 @@ def ldap_page():
last_sync_time = 0
if last_sync_time + config.ldap_cache_livetime > time.time():
+ html.log('no sync needed (%d > %d)' % (last_sync_time + config.ldap_cache_livetime, time.time()))
return # No action needed, cache is recent enough
+ html.log('sync needed (%d <= %d)' % (last_sync_time + config.ldap_cache_livetime, time.time()))
+
# ok, cache is too old. Act!
ldap_sync(False, None)
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index a9daf3d..9e070c6 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -318,12 +318,11 @@ register_configvar(group,
value = True,
totext = _("Encrypt the network connection using SSL."),
)),
- ("version", Integer(
+ ("version", DropdownChoice(
title = _("LDAP Version"),
help = _("Select the LDAP version the LDAP server is serving. Most modern "
"servers use LDAP version 3."),
- minvalue = 1,
- maxvalue = 3,
+ choices = [ (2, "2"), (3, "3") ],
default_value = 3,
)),
("type", DropdownChoice(
@@ -398,11 +397,11 @@ register_configvar(group,
default_value = lambda: userdb.ldap_filter('users', False),
)),
("user_id", TextAscii(
- title = _("User-ID"),
+ title = _("User-ID Attrubute"),
help = _("The attribute used to identify the individual users. It must have "
"unique values to make an user identifyable by the value of this "
"attribute."),
- default_value = lambda: userdb.ldap_attr('user_id', False),
+ default_value = lambda: userdb.ldap_attr('user_id'),
)),
],
optional_keys = ['scope', 'filter', 'user_id'],
Module: check_mk
Branch: master
Commit: 59424f2de521fd34511f374328a6e975110d3e1b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=59424f2de521fd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Nov 21 14:34:49 2012 +0100
Updated changelog
---
ChangeLog | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f04e693..07a633f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
1.2.1i4:
+ Multisite:
+ * Implemented LDAP integration of Multisite. You can now authenticate your
+ users using the form based authentication with LDAP. It is also possible
+ to synchronize some attributes like mail addresses, names and roles from
+ LDAP into multisite.
+ * Modularized the authentication and user management code in WATO
+ * Restructured cookie auth cookies (all auth cookies will be invalid
+ after update -> all users have to login again)
+ * Modularized login and cookie validation
1.2.1i3:
Core:
@@ -21,16 +30,6 @@
* logwatch: Fixed confusion with ignore/ok states of log messages
* AIX Agent: now possible to specify -d flag. Please test :)
- Multisite:
- * Implemented LDAP integration of Multisite. You can now authenticate your
- users using the form based authentication with LDAP. It is also possible
- to synchronize some attributes like mail addresses, names and roles from
- LDAP into multisite.
- * Modularized the authentication and user management code in WATO
- * Restructured cookie auth cookies (all auth cookies will be invalid
- after update -> all users have to login again)
- * Modularized login and cookie validation
-
1.2.1i2:
Core:
* Improved validation of inventory data reported by checks
Module: check_mk
Branch: master
Commit: f9169bfb7fd177c5276e00eef34b5a06d7e43453
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f9169bfb7fd177…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 16 15:54:45 2012 +0100
ldap: Moved user_id to userspec config option
---
web/plugins/userdb/ldap.py | 13 ++++++++-----
web/plugins/wato/check_mk_configuration.py | 16 ++++++++--------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 00cb989..7379205 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -218,14 +218,17 @@ def ldap_replace_macros(tmpl):
return dn
+def ldap_user_id_attr():
+ return config.ldap_userspec.get('user_id', ldap_attr('user_id', False))
+
def ldap_get_user_dn(username):
# Check wether or not the user exists in the directory
# It's only ok when exactly one entry is found.
# Returns the DN in this case.
result = ldap_search(
ldap_replace_macros(config.ldap_userspec['dn']),
- '(%s=%s)' % (ldap_attr('user_id'), ldap.filter.escape_filter_chars(username)),
- [ldap_attr('user_id')],
+ '(%s=%s)' % (ldap_user_id_attr(), ldap.filter.escape_filter_chars(username)),
+ [ldap_user_id_attr()],
)
if result:
@@ -233,7 +236,7 @@ def ldap_get_user_dn(username):
def ldap_get_users(add_filter = None):
columns = [
- ldap_attr('user_id'), # needed in all cases as uniq id
+ ldap_user_id_attr(), # needed in all cases as uniq id
] + ldap_needed_attributes()
filt = ldap_filter('users')
@@ -243,7 +246,7 @@ def ldap_get_users(add_filter = None):
result = {}
for dn, ldap_user in ldap_search(ldap_replace_macros(config.ldap_userspec['dn']),
filt, columns = columns):
- user_id = ldap_user[ldap_attr('user_id')][0]
+ user_id = ldap_user[ldap_user_id_attr()][0]
result[user_id] = ldap_user
return result
@@ -433,7 +436,7 @@ def ldap_sync(add_to_changelog, only_username):
filt = None
if only_username:
- filt = '(%s=%s)' % (ldap_attr('user_id'), only_username)
+ filt = '(%s=%s)' % (ldap_user_id_attr(), only_username)
import wato
users = wato.load_users()
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 7d68aa9..f53f97f 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -397,8 +397,15 @@ register_configvar(group,
size = 80,
default_value = lambda: userdb.ldap_filter('users', False),
)),
+ ("user_id", TextAscii(
+ title = _("User-ID"),
+ help = _("The attribute used to identify the individual users. It must have "
+ "unique values to make an user identifyable by the value of this "
+ "attribute."),
+ default_value = lambda: userdb.ldap_attr('user_id', False),
+ )),
],
- optional_keys = ['scope', 'filter'],
+ optional_keys = ['scope', 'filter', 'user_id'],
),
domain = "multisite",
)
@@ -478,13 +485,6 @@ register_configvar(group,
"communication with the LDAP server. It controls which attributes are "
"e.g. used for the unique username or similar."),
elements = [
- ("user_id", TextAscii(
- title = _("User-ID"),
- help = _("The attribute used to identify the individual users. It must have "
- "unique values to make an user identifyable by the value of this "
- "attribute."),
- default_value = lambda: userdb.ldap_attr('user_id', False),
- )),
("pw_changed", TextAscii(
title = _("Relogon Indicator"),
help = _("When the value of this attribute changes for a user account, all "
Module: check_mk
Branch: master
Commit: 000f06ac00149dceddae9c01555c205071003580
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=000f06ac00149d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Nov 15 12:26:02 2012 +0100
Updated changelog
---
ChangeLog | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1361666..70ee673 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,11 @@
* New button for generating test events directly via WATO
Multisite:
+ * Implemented LDAP integration of Multisite. You can now authenticate your
+ users using the form based authentication with LDAP. It is also possible
+ to synchronize some attributes like mail addresses, names and roles from
+ LDAP into multisite.
+ * Modularized the authentication and user management code in WATO
* Restructured cookie auth cookies (all auth cookies will be invalid
after update -> all users have to login again)
* Modularized login and cookie validation