Skip to content

Modify ldap init to support multiple ldap hosts #100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2022

Conversation

ktyogurt
Copy link
Contributor

This PR adds the feature to support multiple LDAP hosts. And this PR also add corresponding unit test.
ldap.initialize() can accept the multiple uris as stated in https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap.html#ldap.initialize

The uri parameter may be a comma- or whitespace-separated list of URIs containing only the schema, the host, and the port fields. Note that when using multiple URIs you cannot determine to which URI your client gets connected.

Then, we can configure for the multiple hosts as
backend_kwargs = {..., "host": "identity1.example.com,identity2.example.com,identity3.example.com,..."}
I have confirmed that this works properly with our three LDAP servers and the unit tests are successful.

@ktyogurt ktyogurt changed the title Modyfy ldap init to support multiple ldap hosts Modify ldap init to support multiple ldap hosts Jan 11, 2022
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good addition 👍
Looks great. Just a couple of minor additions.

Could you please add it to the Readme? Having a description that host can allow multiple comma-separated entries would be helpful.
Same for the https://docs.stackstorm.com/authentication.html#ldap

Additionally, looks like we don't track the Changelog in this repo.
Could you add the Changelog for this PR to the https://github.com/StackStorm/st2/blob/master/CHANGELOG.rst ?
This way users will know about the new feature.

@arm4b arm4b requested a review from m4dcoder January 11, 2022 22:21
@arm4b
Copy link
Member

arm4b commented Jan 11, 2022

FYI @m4dcoder @amanda11 if you have any comments.

@ktyogurt
Copy link
Contributor Author

Could you please add it to the Readme? Having a description that host can allow multiple comma-separated entries would be helpful. Same for the https://docs.stackstorm.com/authentication.html#ldap

Additionally, looks like we don't track the Changelog in this repo. Could you add the Changelog for this PR to the https://github.com/StackStorm/st2/blob/master/CHANGELOG.rst ? This way users will know about the new feature.

Sure. I added a description to the Readme and sent a PR to add changelog.

@@ -24,7 +24,7 @@ sudo dnf install python2-devel python3-devel openldap-devel
| base_ou | yes | | Base OU to search for user and group entries |
| group_dns | yes | | Which groups user must be member of to be granted access (group names are considered case-insensitive) |
| group_dns_check | no | `and` | What kind of check to perform when validating user group membership (`and` / `or`). When `and` behavior is used, user needs to be part of all the specified groups and when `or` behavior is used, user needs to be part of at least one or more of the specified groups. |
| host | yes | | Hostname of the LDAP server |
| host | yes | | Hostname of the LDAP server. Multiple comma-separated entries are allowed. |
Copy link
Member

@arm4b arm4b Jan 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sent a PR for document update.

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@arm4b arm4b merged commit 1199e9d into StackStorm:master Jan 13, 2022
@ktyogurt ktyogurt deleted the modyfy_ldap_init branch January 14, 2022 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants