Password has expired: SonarQube LDAP authentication failure
0 reputation · 12 Aug 2022, 09:27 UTC
0 reputation · 12 Aug 2022, 09:27 UTC
When an LDAP user’s password expires, SonarQube 9.x logs an explicit error message: "Password has expired". However, the application does not provide a built‑in mechanism to surface this condition to administrators or to enforce least‑privilege role cleanup after a credential change.
Identify a reliable method to detect expired credentials for both internal and LDAP users, and to ensure that role assignments remain minimal after such events.
SONAR_ADMIN for troubleshooting conflicts with least‑privilege principles.34775 reputation · 12 Aug 2022, 17:36 UTC
Use SonarQube’s audit log to catch LDAP password‑expiry events and run a periodic API‑based job to flag internal users whose passwords have aged beyond policy; then automatically remove any elevated roles (e.g., SONAR_ADMIN) from flagged accounts.
Password has expired when an LDAP bind fails due to an expired password.For LDAP users the directory is the source of truth; SonarQube only surfaces the bind failure. For internal users there is no built‑in expiration check, so age must be derived from an external timestamp (e.g., updatedAt or the passwordChangeRequired flag available from SonarQube 9.9+).
sonar.audit.enabled=true
sonar.audit.logfile=logs/sonar_audit.log
Password has expired.GET /api/users/search?ps=500 (paginate if needed) to retrieve all local users.passwordChangeRequired is present and true, treat as expired.updatedAt (or createdAt if no change) against your password‑age policy (e.g., 90 days).POST /api/permissions/remove_group_user
with body: loginKey=<userLogin>&groupName=SONAR_ADMIN
updatedAt to a date older than your policy (or set passwordChangeRequired=true via DB if <9.9), run the job, and ensure the user is flagged and any SONAR_ADMIN role is removed.To decide whether to rely on the passwordChangeRequired flag or fall back to updatedAt, please confirm your SonarQube version (is it 9.9 or newer?).
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.