Fix LDAP component to use dedicated user instead of operator user#1026
Draft
Fix LDAP component to use dedicated user instead of operator user#1026
Conversation
- Add LDAP_USER constant for dedicated LDAP sync user - Add LDAP_PASSWORD_KEY for password management - Include LDAP_USER in SYSTEM_USERS list for proper system user handling This establishes the foundation for issue #966 fix by defining the dedicated LDAP user instead of reusing the operator user for LDAP synchronization.
- Import LDAP_USER and LDAP_PASSWORD_KEY constants - Add LDAP password generation in leader election event - Create dedicated LDAP user with CREATEROLE privilege in primary startup - Update LDAP sync configuration to use dedicated user instead of operator Fixes #966 by implementing a dedicated LDAP user with minimal privileges (CREATEROLE) for PostgreSQL role synchronization, improving security by avoiding use of the superuser operator account for LDAP operations.
- Add LDAP password retrieval and rotation to test_password_rotation.py - Test both password generation and verification for LDAP user - Ensure LDAP user is included in comprehensive password testing suite Fixes part of #966
- Extend test_on_get_password to include LDAP user password retrieval - Extend test_on_set_password to include LDAP user password setting - Ensure comprehensive coverage of LDAP user in password management actions - Update test data to include ldap-password for testing scenarios Fixes part of #966
- Add LDAP user to internal users list in explanation/users.md - Document LDAP user's CREATEROLE privilege and purpose - Update PostgreSQL roles dump example to include ldap user - Extend set-password action documentation to include ldap user - Add clarification on all available system users in manage-passwords.md Provides complete documentation for LDAP user implementation to help users understand its role in LDAP synchronization and management. Fixes part of #966
Contributor
|
A couple of thoughts about these changes, in case the PR was not created for demo purposes:
I think separating concerns in terms of which system user is in charge of running the LDAP sync service is a great idea. We just need to make sure we are comfortable with it owning the deleted-users resources, and provide it enough privileges. |
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.
Issue
Fixes #966
The LDAP component currently uses the operator user to connect to PostgreSQL, which violates the principle of least privilege. Each component should have its own dedicated user with minimal necessary permissions.
Solution
This PR implements a dedicated LDAP user for PostgreSQL connections used by the LDAP synchronization service:
Key Changes:
Add LDAP user constants and system configuration:
LDAP_USER = "ldap"andLDAP_PASSWORD_KEY = "ldap-password"constantsImplement LDAP user creation with minimal privileges:
_start_primarymethod withCREATEROLEprivilege onlyUpdate LDAP sync to use dedicated user:
_setup_ldap_syncto use LDAP_USER and LDAP_PASSWORD_KEYComprehensive test coverage:
Complete documentation updates:
Security Benefits:
CREATEROLEprivilege needed for LDAP syncBackward Compatibility:
Checklist