Skip to content

Support Kerberos (TFS 2018) #2234

Closed
Closed

Description

@pascalberger

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.

See also: https://www.visualstudio.com/en-us/docs/git/manage-large-files#known-issues

Activity

  1. technoweenie commented on May 18, 2017

    @technoweenie
    Contributor

    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.

  2. Daniel-Svensson commented on Aug 9, 2017

    @Daniel-Svensson

    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?

  3. changed the title [-]Support Kerberos (TFS 2017)[/-] [+]Support Kerberos (TFS 2018)[/+] on Jan 22, 2018
  4. whoisj commented on Jan 29, 2018

    @whoisj

    @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:

    1. 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.
    2. Is it possible for Git-Lfs to use a library, like libcurl, that supports Kerberos already?
    3. 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?
  5. whoisj commented on Jan 29, 2018

    @whoisj

    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.

  6. pascalberger commented on Jan 29, 2018

    @pascalberger
    Author

    @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.

  7. whoisj commented on Jan 29, 2018

    @whoisj

    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).

  8. pascalberger commented on Jan 29, 2018

    @pascalberger
    Author

    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.

  9. whoisj commented on Jan 29, 2018

    @whoisj

    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.

  10. pascalberger commented on Jan 29, 2018

    @pascalberger
    Author

    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?

  11. whoisj commented on Jan 30, 2018

    @whoisj

    @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?

  12. pascalberger commented on Jan 30, 2018

    @pascalberger
    Author

    @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?)

  13. whoisj commented on Jan 30, 2018

    @whoisj

    (except there's a way that GCM can handle the creation and management of PATs for on-prem TFS as it does for VSTS?)

    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.

  14. stffabi commented on Feb 16, 2018

    @stffabi
    Contributor

    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 😄.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions