Skip to content
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

Add Configurable LDAP Max Page Size #19032

Merged
merged 9 commits into from
Apr 20, 2023
Merged

Add Configurable LDAP Max Page Size #19032

merged 9 commits into from
Apr 20, 2023

Conversation

ltcarbonell
Copy link
Contributor

@ltcarbonell ltcarbonell commented Feb 7, 2023

Resolves #18875

#17640 introduced paging into LDAP authentication. This is resulting in an issue where directories that do not permit paging are erroring out (see #18875). This change allows for a configurable option to see this manually (or disable it completely by setting the value to 0)

Copy link
Contributor

@austingebauer austingebauer 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 taking this on, @ltcarbonell! Just had a question to start.

@@ -400,7 +400,7 @@ func (c *Client) performLdapFilterGroupsSearchPaging(cfg *ConfigEntry, conn Pagi
cfg.GroupAttr,
},
SizeLimit: math.MaxInt32,
}, math.MaxInt32)
}, uint32(cfg.MaximumPageSize))
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering if you were able to test that setting this to 0 works with an LDAP server that does not permit paging? Just want to make sure that the reporter's issue is solved by setting this to 0.

Slightly related to that, do you know under which pre-condition we'd enter the branch at client.go#L525? I tried to find where a connection would satisfy PagingConnection or Connection, but it's not super clear. I wonder if we're always landing on a PagingConnection and can delete the other code path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wondering if you were able to test that setting this to 0 works with an LDAP server that does not permit paging? Just want to make sure that the reporter's issue is solved by setting this to 0.

I am having some trouble setting up a dev LDAP instance that doesn't support paging to actually confirm this, but I will keep chugging along at it.

Slightly related to that, do you know under which pre-condition we'd enter the branch at client.go#L525? I tried to find where a connection would satisfy PagingConnection or Connection, but it's not super clear. I wonder if we're always landing on a PagingConnection and can delete the other code path.

My thinking with this was since this is a function that is part of the SDK, some other process outside of the core Vault code could be passing in a Connection into GetLdapGroups and wouldn't necessarily have updated to using a PagingConnection. But you are correct, in terms of the Vault codebase, we would never actually reach that path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@austingebauer was able to confirm (with the help of @nordicmachine here) that this resolves the issue they were experiencing when paging was disabled by the LDAP server.

Copy link
Contributor

@austingebauer austingebauer left a comment

Choose a reason for hiding this comment

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

LGTM otherwise!

ltcarbonell and others added 2 commits April 20, 2023 13:45
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
@ltcarbonell ltcarbonell enabled auto-merge (squash) April 20, 2023 20:38
@ltcarbonell ltcarbonell merged commit 7f2deb1 into main Apr 20, 2023
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
…20281)

* Add Configurable LDAP Max Page Size (#19032)

* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* remove

---------

Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
…20283)

* Add Configurable LDAP Max Page Size (#19032)

* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* remove

---------

Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
@ltcarbonell ltcarbonell deleted the GH-18875 branch April 20, 2023 22:21
ltcarbonell added a commit that referenced this pull request Apr 20, 2023
…20282)

* Add Configurable LDAP Max Page Size (#19032)

* Add config flag for LDAP max page size

* Add changelog

* move changelog to correct file

* cleanup

* Default to non-paged searching for with -1

* Update website/content/api-docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update website/content/docs/auth/ldap.mdx

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* Update tests

---------

Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>

* remove

---------

Co-authored-by: Luis (LT) Carbonell <lt.carbonell@hashicorp.com>
Co-authored-by: Austin Gebauer <34121980+austingebauer@users.noreply.github.com>
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.

LDAP search failed: LDAP Result Code 50 "Insufficient Access Rights"
2 participants