Repository navigation
Let LDAP users change their password with PUT /passwd - #115
Open
toolonghere wants to merge 1 commit into
Open
toolonghere wants to merge 1 commit into
toolonghere wants to merge 1 commit into
Conversation
Before this change, PUT /passwd rejected all LDAP imported users. Add options.ldapPasswordChange (default: false). When it is set to true, the API binds as the user with the current password and changes the password on that connection: - the Password Modify extended operation (RFC 3062) for OpenLDAP and other servers - unicodePwd for the ActiveDirectory template The service account can have read-only access. The user must have the changePassword privilege and an active account. If the connection is not encrypted with a verified certificate, the API does not send a password. Add options.passwordPolicy for a new password that the user sets with PUT /passwd, for local and LDAP users. The defaults do not set limits. References: grommunio#109
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: enhancement
This pull request contains the code for the design in #109. It closes #109.
PUT /passwd, for example from grommunio-web.PUT /passwdoperates as before.The change
options.ldapPasswordChange(default:false). When it is set totrue, the API binds as the user with the current password. It changes the password on that connection.ActiveDirectorytemplate:unicodePwd.changePasswordprivilege and an active account. gromox uses the same 2 conditions for a password change (exch/mysql_adaptor/mysql_adaptor.cpp).ldaps://or STARTTLS with a verified certificate, for all servers in the list. If not, the API does not send a password, and the response is 503. If the connection stops, the API does not start it again.options.passwordPolicy:minLength,minCharClasses,forbidUsernameandblocklist(a file, 1 password on each line). It applies only toPUT /passwd, not to a password that an administrator sets.conf.d/README.mdgives the options. It also gives a recommendation for OpenLDAP: limit password writes by the user to the hosts that operate the Admin API (by self peername.ip=<address> write).Responses for an LDAP user
user) or 403 (signed in), the same as for local userschangePasswordprivilege, account not active, or the directory rejects the write (result 50)grommunio/grommunio-web#200 (open) lets grommunio-web show the cause for 400 and 403.
Not in this change
authUser()does not change.PUT /passwdfor local users does not examine thechangePasswordprivilege. I did not change this. I can send 1 more pull request if you want the same condition for local users.Tests
tests/test_permissions*.py:tests/test_passwordpolicy.py(7 tests) andtests/test_ldap_password.py(13 tests). The LDAP tests use mock connections and do not use a server. Without ldap3, they are skipped.tests/test_login.py:PUT /passwdwithldapPasswordChangeand a directory that is not available gives the generic 503.PUT /passwdwithuser, as grommunio-web does:changePassword/ account not activeforbidUsernameoff / onldapPasswordChangeoffI did not do a test of the signed-in path for an LDAP user. My test system has no LDAP administrator.
I installed a previous version of this change on my server on 30 September. It uses OpenLDAP 2.6.
I prepared this change with an AI assistant (Claude). I examined the code and each changed line, and I did the tests on a test system. Antigravity (Google's AI assistant) did an inspection of it.