Skip to content

Commit 2e9482f

Browse files
committed
Add DEBUG/TRACE logs for LDAP bind (#36028)
Introduces a debug log message when a bind fails and a trace message when a bind succeeds. It may seem strange to only debug a bind failure, but failures of this nature are relatively common in some realm configurations (e.g. LDAP realm with multiple user templates, or additional realms configured after an LDAP realm).
1 parent 1bf861f commit 2e9482f

File tree

1 file changed

+4
-0
lines changed
  • x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support

1 file changed

+4
-0
lines changed

x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/authc/ldap/support/LdapUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ public static void maybeForkThenBindAndRevert(LDAPConnectionPool ldapPool, BindR
134134
@SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.")
135135
protected void doRun() throws Exception {
136136
privilegedConnect(() -> ldapPool.bindAndRevertAuthentication(bind.duplicate()));
137+
LOGGER.trace("LDAP bind [{}] succeeded for [{}]", bind, ldapPool);
137138
runnable.run();
138139
}
139140

140141
@Override
141142
public void onFailure(Exception e) {
143+
LOGGER.debug("LDAP bind [{}] failed for [{}] - [{}]", bind, ldapPool, e.toString());
142144
runnable.onFailure(e);
143145
}
144146

@@ -179,11 +181,13 @@ public static void maybeForkThenBind(LDAPConnection ldap, BindRequest bind, Thre
179181
@SuppressForbidden(reason = "Bind allowed if forking of the LDAP Connection Reader Thread.")
180182
protected void doRun() throws Exception {
181183
privilegedConnect(() -> ldap.bind(bind.duplicate()));
184+
LOGGER.trace("LDAP bind [{}] succeeded for [{}]", bind, ldap);
182185
runnable.run();
183186
}
184187

185188
@Override
186189
public void onFailure(Exception e) {
190+
LOGGER.debug("LDAP bind [{}] failed for [{}] - [{}]", bind, ldap, e.toString());
187191
runnable.onFailure(e);
188192
}
189193

0 commit comments

Comments
 (0)