Skip to content

Commit

Permalink
Add pref to enable LDAP debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cardigliano committed Oct 25, 2024
1 parent c787bf9 commit edd48b7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/ntop_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@
#define PREF_LDAP_USER_GROUP NTOPNG_PREFS_PREFIX ".ldap.user_group"
#define PREF_LDAP_ADMIN_GROUP NTOPNG_PREFS_PREFIX ".ldap.admin_group"
#define PREF_LDAP_FOLLOW_REFERRALS NTOPNG_PREFS_PREFIX ".ldap.follow_referrals"
#define PREF_LDAP_DEBUG NTOPNG_PREFS_PREFIX ".ldap.debug"
#define PREF_LDAP_DEBUG NTOPNG_PREFS_PREFIX ".ldap_debug"
#ifdef HAVE_LDAP
#define MAX_LDAP_LEN \
256 /* Keep it in sync with lua preferences file prefs.lua */
Expand Down
2 changes: 2 additions & 0 deletions scripts/locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7084,6 +7084,8 @@ local lang = {
["toggle_ldap_anonymous_bind_title"] = "LDAP Anonymous Binding",
["toggle_ldap_auth"] = "Toggle LDAP Authentication",
["toggle_ldap_auth_descr"] = "Toggle gui authentication via LDAP.",
["toggle_ldap_debug_description"] = "Toggle the debugging of LDAP authentication. Extra information are printed out to the ntopng logs.",
["toggle_ldap_debug_title"] = "LDAP Debug",
["toggle_ldap_referrals_description"] = "Specifies if the client should automatically follow referrals returned by LDAP servers.",
["toggle_ldap_referrals_title"] = "Follow Referrals",
["toggle_local_auth"] = "Toggle Local Authentication",
Expand Down
10 changes: 9 additions & 1 deletion scripts/lua/admin/prefs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ if auth.has_capability(auth.capabilities.preferences) then

local elementToSwitch = { "row_multiple_ldap_account_type", "row_toggle_ldap_anonymous_bind", "server",
"bind_dn", "bind_pwd", "ldap_server_address", "search_path", "user_group",
"admin_group", "row_toggle_ldap_referrals" }
"admin_group", "row_toggle_ldap_referrals", "row_toggle_ldap_debug" }

prefsToggleButton(subpage_active, {
field = auth_toggles.ldap,
Expand Down Expand Up @@ -942,6 +942,14 @@ if auth.has_capability(auth.capabilities.preferences) then
reverse_switch = true,
hidden = not showElements
})

prefsToggleButton(subpage_active, {
field = "toggle_ldap_debug",
default = "0",
pref = "ldap_debug",
hidden = not showElements
})

end

-- #####################
Expand Down
1 change: 1 addition & 0 deletions scripts/lua/modules/http_lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,7 @@ local known_parameters = {
["toggle_radius_auth"] = validateBool,
["toggle_http_auth"] = validateBool,
["toggle_ldap_referrals"] = validateBool,
["toggle_ldap_debug"] = validateBool,
["toggle_webhook_notification"] = validateBool,
["toggle_elasticsearch_notification"] = validateBool,
["toggle_auth_session_midnight_expiration"] = validateBool,
Expand Down
4 changes: 4 additions & 0 deletions scripts/lua/modules/prefs_menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,10 @@ local menu_subpages = {{
description = i18n("prefs.toggle_ldap_referrals_description"),
hidden = (not hasLdap)
},
toggle_ldap_debug = {
title = i18n("prefs.toggle_ldap_debug_title"),
description = i18n("prefs.toggle_ldap_debug_description")
},
radius_server = {
title = i18n("prefs.radius_server_title"),
description = i18n("prefs.radius_server_description", {
Expand Down

0 comments on commit edd48b7

Please sign in to comment.