-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support for identities without userPrincipalName #44
Comments
I'm automating this user creation with Ansible and using the |
Hi! We made a change to this very recently. Can you please take a look and let us know what version of this plugin you're on? Is it from the recently released beta, or is it something built off master? If master, what version or commit? Thanks! |
Hi @tyrannosaurus-becks - I was building from master at the time using |
Hi @mbrancato , thanks for the elaboration. So, good news, when this is released as part of Vault 1.4 GA, the Kerberos auth method will be included in the agent. It's definitely included in the beta, which is currently out. More to your point, I have two questions -
|
sorry @tyrannosaurus-becks - where are you wanting me to set I thought you might be suggesting setting If it is helpful, my POC is here: My current fix is to manually add a UPN to the account at creation here: https://github.com/mbrancato/vagrant-vault-kerberos/blob/2db52d31f6ec7818ee85cc466788f280ea641445/main.yml#L65 Also, will the vault agent support Windows hosts and AD similar to winkerberos in python? |
Hi same for me, I run an OpenLDAP server. The |
Thanks for the background, both of you! I've marked this as an enhancement for now. |
One thing to be mindful of - people may be using LDAP schemas where there's no equivalent of |
Yup, this affects me too where my userPrincipalName attribute is set to email address for integration with email provider. The changes in #47 solves the problem for me. |
I have a couple questions for the group. I'm looking at #47 and specifically that it allows one to bypass this check if the LDAP upnDomain is unset:
My concern is, we added that line for security to prevent a Kerberos identity from a different domain being used to log in to a particular LDAP environment. My questions are:
Thanks! |
In response to your questions: Option 1Keep the check but make it flexible for LDAP directories with different layouts: Looking at the attributes on my LDAP users, there is no single attribute that has a value If just the attribute checked were configurable, we could look at extending the AD schema with an additional attribute which replicates There are various attributes which contain the required information in other forms, so could be used to replicate the check, but would require additional logic in the plugin to construct the correct values to match against.
I think the closest match is Alternative solution
This would allow the following cases:
Option 2Optionally disabling the check: If I understand correctly:
I can completely understand not wanting to disable this check by default to prevent administrators of multi-domain forests to make themselves less secure through inaction of not setting the Option 1 would be more secure and flexible. Option 2 would definitely be the easier way to go. Either one would work for us. Regards, |
Hi @tyrannosaurus-becks - when opening this, I didn't want to try and specify a solution as I'm not sure of all the LDAP helper interactions. Obviously changes to that have wider effects inside Vault and other plugins like LDAP auth. Without regard to breaking changes in other use-cases, it sounds to me like the "option 1 - alternative solution" above is most aligned with what I was pointing out in the code below. If there was a flexible way to change how this filter is created, I do think there could be some "defaults" that help prevent breaking changes in other components. vault-plugin-auth-kerberos/vendor/github.com/hashicorp/vault/sdk/helper/ldaputil/client.go Lines 123 to 125 in 6de663e
I know the team inside HashiCorp probably has this planned out, but it would be good if there was some diagram of how the LDAP filter flow works. There have been some recent changes in the LDAP helper, and I know some breaking changes in the past. A flow of when a filter is applied and required fields might help make this more clear and help support the most LDAP implementations in a secure manner. Obviously, I think the checks for a single result are very important, so any filter changes would still probably need to call this out more explicitly in the docs for how to configure this. Edit: I know I mention a flow - but maybe a truth table is a better way to represent when and what filters are applied and maybe other information. |
To be painfully specific, the Kerberos identity from a different realm is not logging into a particular LDAP server --- the caller's identity is never used to log into LDAP, only Vault binds to LDAP to look up directory information. It's a tiny distinction, but I wanted to be super clear. In order for
We assume that [email protected] cannot get a kerberos ticket which identifies them as [email protected]. If they can, we cannot do anything about that, because as far as Kerberos is concerned, any bearer of a valid ticket for [email protected] is [email protected]. I think it's useful to do that check, if it makes sense to the Vault administrator, I just want to understand what exactly we're protecting against and how exactly that could be exploited, which I'm not yet seeing - but I'm definitely open to understanding what I'm not seeing. To be honest, I think a much simpler flow is:
This covers all use cases, allows the check if the Vault administrator wants it, and makes no assumptions at all about what's actually in the LDAP directory, how we want to find users there, or that you're even using an LDAP directory. |
Thank you, everyone, for that information and discussion. I'm going to see if we can get this incorporated into the linked PR. |
That sounds like a good approach, and I think I could probably implement it if I am given more details and if it doesn't get too complicated. Say some more about exactly how this would affect the existing configuration parameters. Would So if people do want the ldap userfilter, which ldap config options will become obsolete? The set of options that I got to work with our ldap (and with #47 applied) was very simple, setting only url, userdn, userattr, and token_policies. I expect that userdn and userattr would be replaced by userfilter. What else would become obsolete? upndomain? There will still need to be some way to select the token_policies so if we want to be able to completely leave out the ldap config then that would have to be associated with the base kerberos config. |
Yes @thomashashi - I think this generally solves the problems I was hitting. The userfilter that is enforced by the use of the LDAP helper. It seems like this solution would work, but may be a much bigger change. AFAIK, the reason that LDAP is integrated is because Kerberos, as you point out, only provides an identity. We need this with humans, but mapping might be available thru group aliases as well. |
The approach described by @thomashashi sounds good to me also, and would cover my use cases. We could setup a filter like
(Apologies for going off topic on a tangent, but helps clarify the direction we'd like kerberos auth to go in future, so a bit relevant here I think) Same here. I do understand why it would have been done this way initially as a quicker way to implement kerberos support without needing core vault code changes.
It would be more useful for us if kerberos were provided via additional authentication methods on top of the LDAP backend rather than an entirely separate auth backend with duplicate configuration and entity aliases. It complicates the identity external group mapping for us. I have users who might login via LDAP (e.g. vault webui, cli*) or via kerberos (production applications), and while the "identity" and group membership is sourced from the same place in both cases, because the external groups have to be sourced from one place we have to pick one of these two auth methods as the authoritative source. I have picked LDAP as the authoritative source but if a user logs in for the first time via kerberos, their group membership isn't sync'd into the identity system and they have no privileges. I therefore have to ask human users to login via LDAP at least once and then run a scheduled task that matches together the entity with the LDAP alias (with group memebrship) and the entity with the kerberos alias (without group membership), so that the next kerberos login has group membership. Our production users cannot login via LDAP (passwords are not known), so I'm having to duplicate policy mappings onto each production user manually rather than allowing this to match human users from LDAP group membership). It's all a bit messy.
|
I looked a little into this when I was doing some internal training for folks, and for personal use - it appears that it would be rather difficult to add this to the Vault CLI because the The Vault Kerberos auth method, however, doesn't care how the client does SPNEGO negotiation to get the blob is sends it, only that it has. It was pretty easy to take the exemplar Python script and make it read a ccache:
Replace the |
OK, that's useful to know, thanks! Perhaps for the cli we'll stick to a python script as an alternative to the cli login. I imagine kerberos login for webui should be more straightforward. |
Thought about this more and decided to approve and merge the linked PR. |
I've done some digging and it doesn't look like there is any way to lookup an authenticated object without a
userPrincipalName
attribute.This is because if the
upndomain
is set to blank, this rejects all authentication:vault-plugin-auth-kerberos/path_login.go
Lines 141 to 145 in b19d831
if the
upndomain
is not blank, and using abinddn
and password, this forces the search filter to useuserPrincipalName
:vault-plugin-auth-kerberos/vendor/github.com/hashicorp/vault/sdk/helper/ldaputil/client.go
Lines 123 to 125 in 6de663e
Is there some way to support authenticating service accounts, or similar? For example, I'm trying to authenticate an account without
userPrincipalName
:Here you can see a successful authentication, but failed lookup as the forced filter to
userPrincipalName
:The text was updated successfully, but these errors were encountered: