You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having TFS 2018 using NTLM authentication and Git for Windows using Git Credential Manager, authentication for Git works out of the box without any user interaction using Kerberos. GCM stores the credentials with only username. As soon as Git LFS is used an error is thrown Your user name must be of the form DOMAIN\\user. It is currently foo. The only solution is to manually change the credential entry to a domain\user format, which is required to be done by every user.
It would be nice if Git LFS would support Kerberos.
Sounds great, if someone is willing to work on it and own maintenance of it. It sounds like LFS' existing NTLM support is nearly enough, so hopefully it won't take a lot of work. I'd be happy to give a quick tour of NTLM support in this code base, if anyone wants to give it a shot.
I think the easiest solution would be to switch http request library to something with Kerberos support. I believe git uses libcurl and pass in an empty password, maybe a similar approach can be used here?
@pascalberger this was just brought to my (GCM maintainer) attention, sorry for being 8 months late to the party. 😞
There are a few technical hurtles here to think about:
Can Git for Windows handle usernames in the {domain}\{username} format, and if not then we need work around the issue of Git and Git-Lfs wanting different data from the same table and using the same key.
Is it possible for Git-Lfs to use a library, like libcurl, that supports Kerberos already?
Generally, libcurl relies on zero length strings being passed in for username and password to determine if it ought to be relying on NTLM authentication or not. The GCM does this by actually storing zero-length strings for the credential values. My guess is that this is what is hampering Git-Lfs -- does anyone actually know how Git-Lfs underlying networking stack handles (or doesn't) NTLM and/or Kerberos?
After a bit of additional investigation, it appears that @pascalberger might not being using NTLM to support for "current user", and might be reliant on basic authentication. If true and the protocol is HTTP, then domain credentials are being sent in the clear and I very much recommended against it.
That said, you can add git-config setting to users to force basic authentication for the server with git config --global credential.{domain}.authority basic or via use of an environment variable (easier if you have tightly controlled dev/build environments) GCM_AUTHORITY=basic. Mind you, the environment variable is a total override so use it judiciously.
@whoisj No, we're using quite a default TFS setup. The Team Foundation Server site in IIS has only Anonymous Authentication and Windows Authentication enabled. Therefore I assume it uses NTLM.
Git relies on libcurl for its underlying network implementation. As I understand things, libcurl only engages in NTLM is a pair of empty strings for credentials are used. Otherwise, it performs the standard basic authentication - which when performed via HTTP sends credentials in the clear (well base64 encoded, but that's not any kind of security).
So you mean as long as user / password is entered in the credential manager basic authentication is used, even though basic authentication is not installed on the TFS server?
The issue is that the credentials are added automatic (by GCM I assume) on every operation. So how is NTLM authentication supposed to work in this case?
Btw, we use HTTPS, so security is not the big issue here. The issue is that every user needs to manually change credentials in credential manager to get LFS working with TFS.
So how is NTLM authentication supposed to work in this case?
Btw, we use HTTPS, so security is not the big issue here. The issue is that every user needs to manually change credentials in credential manager to get LFS working with TFS.
What is likely happening (since it's HTTPS) is that the GCM is being stupid (on purpose) and sending the basic authentication credentials along. Libcurl is then being smart because your TFS server likely advertises NTLM in preference to basic authentication; thus NTLM is working. Remember, it is the libcurl <=> TFS interchange that really matters here. Then when the NTLM authentication fails for Git-Lfs, what ever it uses under the hood sends the credentials along using basic authentication; TFS is able to verify them against the AD controller and thus everything "just works (tm)".
The real complexity here is that we have three separate networking stacks all hoping to work together of slightly divergent sets of standards: Microsoft Secure Channel (GCM/TFS), libcurl (GIT), and whatever-Go-supports (Git-LFS). Each set has its own set of implemented standards, and its owns twist on getting the newer standards to squeeze/fit into their preexisting set of supported features.
So the issue is not with git-lfs but with GCM which should write domain\username to the credential manager? Or what is the supposed scenario to get this working with standard configured TFS server on HTTPS and out of the box Git for Windows / git-lfs installation without requiring manual configuration?
@pascalberger the issue is that GCM, Git, and Git-Lfs all speak slightly different languages. 😞
The GCM absolutely should not write {domain}\{username} to the secrets vault. That information should never need to be cached there. The real failure is that Git-Lfs is built atop of a network stack which cannot/will not utilize Secure Channel. The Git for Windows maintainer went to the effort of integrating support for it into libcurl and enabling support in Git for Windows. Ideally Git-Lfs maintainers could/would do the same.
Shy of that, the best answer is to find a way to use access tokens or similar. Effective proxies for identity credentials that if leaked/stolen only grant limited access.
@whoisj I don't think PATs are improving user experience in this case. While users need now to change credentials in the credential store, with PATs they would need to manually create the PAT and add it to the credential store (except there's a way that GCM can handle the creation and management of PATs for on-prem TFS as it does for VSTS?)
The solution would be to use SSPI on windows to authenticate via NTLM. This would allow git-lfs to authenticate through NTLM by using the default credentials of the current logged in user in the case GCM returns empty credentials.
@technoweenie I've taken a look into the implementation of NTLM and will submit a PR which would introduce SSPI for NTLM authentication on windows. I'm relatively new to Go, so any help to bring this into a state that could be merged in would be really appreciated 😄.
Activity
technoweenie commentedon May 18, 2017
Sounds great, if someone is willing to work on it and own maintenance of it. It sounds like LFS' existing NTLM support is nearly enough, so hopefully it won't take a lot of work. I'd be happy to give a quick tour of NTLM support in this code base, if anyone wants to give it a shot.
Daniel-Svensson commentedon Aug 9, 2017
I think the easiest solution would be to switch http request library to something with Kerberos support. I believe git uses libcurl and pass in an empty password, maybe a similar approach can be used here?
[-]Support Kerberos (TFS 2017)[/-][+]Support Kerberos (TFS 2018)[/+]whoisj commentedon Jan 29, 2018
@pascalberger this was just brought to my (GCM maintainer) attention, sorry for being 8 months late to the party. 😞
There are a few technical hurtles here to think about:
{domain}\{username}format, and if not then we need work around the issue of Git and Git-Lfs wanting different data from the same table and using the same key.whoisj commentedon Jan 29, 2018
After a bit of additional investigation, it appears that @pascalberger might not being using NTLM to support for "current user", and might be reliant on basic authentication. If true and the protocol is HTTP, then domain credentials are being sent in the clear and I very much recommended against it.
That said, you can add git-config setting to users to force basic authentication for the server with
git config --global credential.{domain}.authority basicor via use of an environment variable (easier if you have tightly controlled dev/build environments)GCM_AUTHORITY=basic. Mind you, the environment variable is a total override so use it judiciously.pascalberger commentedon Jan 29, 2018
@whoisj No, we're using quite a default TFS setup. The
Team Foundation Serversite in IIS has only Anonymous Authentication and Windows Authentication enabled. Therefore I assume it uses NTLM.whoisj commentedon Jan 29, 2018
Git relies on libcurl for its underlying network implementation. As I understand things, libcurl only engages in NTLM is a pair of empty strings for credentials are used. Otherwise, it performs the standard basic authentication - which when performed via HTTP sends credentials in the clear (well base64 encoded, but that's not any kind of security).
pascalberger commentedon Jan 29, 2018
So you mean as long as user / password is entered in the credential manager basic authentication is used, even though basic authentication is not installed on the TFS server?
The issue is that the credentials are added automatic (by GCM I assume) on every operation. So how is NTLM authentication supposed to work in this case?
Btw, we use HTTPS, so security is not the big issue here. The issue is that every user needs to manually change credentials in credential manager to get LFS working with TFS.
whoisj commentedon Jan 29, 2018
What is likely happening (since it's HTTPS) is that the GCM is being stupid (on purpose) and sending the basic authentication credentials along. Libcurl is then being smart because your TFS server likely advertises NTLM in preference to basic authentication; thus NTLM is working. Remember, it is the libcurl <=> TFS interchange that really matters here. Then when the NTLM authentication fails for Git-Lfs, what ever it uses under the hood sends the credentials along using basic authentication; TFS is able to verify them against the AD controller and thus everything "just works (tm)".
The real complexity here is that we have three separate networking stacks all hoping to work together of slightly divergent sets of standards: Microsoft Secure Channel (GCM/TFS), libcurl (GIT), and whatever-Go-supports (Git-LFS). Each set has its own set of implemented standards, and its owns twist on getting the newer standards to squeeze/fit into their preexisting set of supported features.
pascalberger commentedon Jan 29, 2018
So the issue is not with git-lfs but with GCM which should write
domain\usernameto the credential manager? Or what is the supposed scenario to get this working with standard configured TFS server on HTTPS and out of the box Git for Windows / git-lfs installation without requiring manual configuration?whoisj commentedon Jan 30, 2018
@pascalberger the issue is that GCM, Git, and Git-Lfs all speak slightly different languages. 😞
The GCM absolutely should not write
{domain}\{username}to the secrets vault. That information should never need to be cached there. The real failure is that Git-Lfs is built atop of a network stack which cannot/will not utilize Secure Channel. The Git for Windows maintainer went to the effort of integrating support for it into libcurl and enabling support in Git for Windows. Ideally Git-Lfs maintainers could/would do the same.Shy of that, the best answer is to find a way to use access tokens or similar. Effective proxies for identity credentials that if leaked/stolen only grant limited access.
@pascalberger you mention using TFS as your host. Why not use and rely on personal access tokens?
pascalberger commentedon Jan 30, 2018
@whoisj I don't think PATs are improving user experience in this case. While users need now to change credentials in the credential store, with PATs they would need to manually create the PAT and add it to the credential store (except there's a way that GCM can handle the creation and management of PATs for on-prem TFS as it does for VSTS?)
whoisj commentedon Jan 30, 2018
Not today 😞 . In theory the infrastructure is there to do this, however there's good way to detect TFS vs another host automagically.
I'll make it a point to sync (again) with the TFS on-premise auth group to see if there's anything that can be done.
stffabi commentedon Feb 16, 2018
The solution would be to use SSPI on windows to authenticate via NTLM. This would allow git-lfs to authenticate through NTLM by using the default credentials of the current logged in user in the case GCM returns empty credentials.
@technoweenie I've taken a look into the implementation of NTLM and will submit a PR which would introduce SSPI for NTLM authentication on windows. I'm relatively new to Go, so any help to bring this into a state that could be merged in would be really appreciated 😄.