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

auth/ldap: add username_as_alias configurable #14324

Merged
merged 1 commit into from Mar 15, 2022

Conversation

jasonodonnell
Copy link
Contributor

@jasonodonnell jasonodonnell commented Mar 1, 2022

This adds a new config parameter to the LDAP util SDK username_as_alias. A change in #11000 resulted in alias names changing, which has broken a number of users in 1.9+. Using this parameter, an operator can change alias names back.

For example, if LDAP auth was configured with no binddn or bindpass, in 1.8.8 the alias name would be:

[~] vault read identity/alias/id/66c3a58f-9a72-26cf-f5a9-438528398eb3
Key                          Value
---                          -----
...
mount_accessor               auth_ldap_6af4105c
mount_path                   auth/ldap/
mount_type                   ldap
name                         bob
namespace_id                 root

However, in 1.9.3, the same config would result in alias names like this:

[~] vault read identity/alias/id/67656061-c8d2-8379-a7a5-dfa2c89659c9
Key                          Value
---                          -----
...
mount_accessor               auth_ldap_01e39e22
mount_path                   auth/ldap/
mount_type                   ldap
name                         cn=bob,CN=Users,DC=corp,DC=example,DC=net
namespace_id                 root

@jasonodonnell jasonodonnell requested a review from a team March 1, 2022 19:16
@jasonodonnell jasonodonnell added this to the 1.9.5 milestone Mar 1, 2022
@vercel vercel bot temporarily deployed to Preview – vault-storybook March 1, 2022 19:21 Inactive
@vercel vercel bot temporarily deployed to Preview – vault March 1, 2022 19:21 Inactive
@vercel vercel bot temporarily deployed to Preview – vault March 1, 2022 19:23 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook March 1, 2022 19:23 Inactive
@jasonodonnell
Copy link
Contributor Author

Known issue PR opened here: #14325.

sdk/helper/ldaputil/config.go Show resolved Hide resolved
builtin/credential/ldap/path_login.go Outdated Show resolved Hide resolved
@calvn
Copy link
Member

calvn commented Mar 14, 2022

Should the label be all the way back to 1.8.10?

remilapeyre added a commit to remilapeyre/vault that referenced this pull request May 19, 2022
There is a bug that was introduced in the LDAP authentication method by hashicorp#11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in hashicorp#14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.
remilapeyre added a commit to remilapeyre/vault that referenced this pull request May 19, 2022
There is a bug that was introduced in the LDAP authentication method by hashicorp#11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in hashicorp#14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.
calvn added a commit that referenced this pull request May 20, 2022
* Fix handling of username_as_alias during LDAP authentication

There is a bug that was introduced in the LDAP authentication method by #11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in #14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.

* Add changelog

* Add tests

* Format code

* Update builtin/credential/ldap/backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Format and fix declaration

* Reword changelog

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
calvn pushed a commit that referenced this pull request May 20, 2022
* Fix handling of username_as_alias during LDAP authentication

There is a bug that was introduced in the LDAP authentication method by #11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in #14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.

* Add changelog

* Add tests

* Format code

* Update builtin/credential/ldap/backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Format and fix declaration

* Reword changelog

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
# Conflicts:
#	builtin/credential/ldap/backend_test.go
calvn pushed a commit that referenced this pull request May 20, 2022
…#15556)

* Fix handling of username_as_alias during LDAP authentication

There is a bug that was introduced in the LDAP authentication method by #11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in #14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.

* Add changelog

* Add tests

* Format code

* Update builtin/credential/ldap/backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Format and fix declaration

* Reword changelog

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
# Conflicts:
#	builtin/credential/ldap/backend_test.go

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
Gabrielopesantos pushed a commit to Gabrielopesantos/vault that referenced this pull request Jun 6, 2022
…rp#15525)

* Fix handling of username_as_alias during LDAP authentication

There is a bug that was introduced in the LDAP authentication method by hashicorp#11000.
It was thought to be backward compatible but has broken a number of users. Later
a new parameter `username_as_alias` was introduced in hashicorp#14324
to make it possible for operators to restore the previous behavior.
The way it is currently working is not completely backward compatible thought
because when username_as_alias is set, a call to GetUserAliasAttributeValue() will
first be made, then this value is completely discarded in pathLogin() and replaced
by the username as expected.

This is an issue because it makes useless calls to the LDAP server and will break
backward compatibility if one of the constraints in GetUserAliasAttributeValue()
is not respected, even though the resulting value will be discarded anyway.

In order to maintain backward compatibility here we have to only call
GetUserAliasAttributeValue() if necessary.

Since this change of behavior was introduced in 1.9, this fix will need to be
backported to the 1.9, 1.10 and 1.11 branches.

* Add changelog

* Add tests

* Format code

* Update builtin/credential/ldap/backend.go

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>

* Format and fix declaration

* Reword changelog

Co-authored-by: Calvin Leung Huang <1883212+calvn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants