Skip to content

Fall back if there are no system Windows credentials when using NTLM - #3881

Closed
bk2204 wants to merge 1 commit into
git-lfs:masterfrom
bk2204:ntlm-fallback-windowns
Closed

bk2204 wants to merge 1 commit into
git-lfs:masterfrom
bk2204:ntlm-fallback-windowns

Conversation

@bk2204

@bk2204 bk2204 commented Oct 25, 2019

Copy link
Copy Markdown
Member

On Windows, we attempt to use the system credentials when authenticating using NTLM if they exist. However, in some cases, the system is not appropriately configured and we get an error, which causes the push attempt to abort.

If we get such an error, fall back to prompting for credentials like we did before 2.8.0.

This is a shot in the dark. It may or may not work, but this is the best attempt I can give things without having a Windows system with AD set up.

@IS-GYG

IS-GYG commented Oct 25, 2019

Copy link
Copy Markdown

Is there anyway for git lfs to access the same windows credentials store as git. Usually git (via GCM) stores the right credentials in the windows credentials store (usually under: git:https://[email protected]).
Prompting will be great for dev (on a side note prior to 2.8.0 git lfs had a hard time getting GCM to show the prompt when using NTLM), but might be an issue for un-attendant environment like build machines.

Unless prompt also means getting the credentials from git?

@AJH16

AJH16 commented Oct 25, 2019

Copy link
Copy Markdown
Contributor

If I'm understanding this issue correctly, it might also be able to proactively prevent this by altering the ntlmSupportsSSPI value in the ntlm_auth_windows file if we can determine that the account isn't valid for SSPI before making the request. I'm not sure what exactly the case is that this is occurring for though, so I'm not sure if we can tell before we try or not.

@bk2204

bk2204 commented Oct 28, 2019

Copy link
Copy Markdown
Member Author

"Prompt" in this case means get the credentials using the credential helper.

@IS-GYG

IS-GYG commented Oct 28, 2019

Copy link
Copy Markdown

Hi Guys, while going through the git config file (the config file inside the .git folder), to get a better understanding of the git lfs settings that was set, I noticed that there were two git entries for our Azure Devops endpoint.

[lfs "https://domain-name/tfs/collection/ProjectName/_git/ProjectName.git/info/lfs"]
	access = ntlm
[lfs "https://domain-name/tfs/collection/ProjectName/_git/ProjectName/info/lfs/objects/"]
	access = basic

The first entry was the main one before 2.9.0 (we were using 2.8.0). After I started using 2.9.0 the second entry was added. That seems to be the one that git lfs in 2.9.0 is using, because the access of the first one doesn't seem to affect the authentication type, but the second one does.

As described in this issues #3875 , the work around was to turn off HTTP/2 and enable Basic Authentication (but this work around only works with 2.9.0, doesn't seem to work with 2.8.0).

Don't know if the above information will help shed some light on the underlining issue.

@bk2204 bk2204 added this to the v2.9.1 milestone Oct 30, 2019
On Windows, we attempt to use the system credentials when authenticating
using NTLM if they exist.  However, in some cases, the system is not
appropriately configured and we get an error, which causes the push
attempt to abort.

If we get such an error, fall back to prompting for credentials like we
did before 2.8.0.
@bk2204

bk2204 commented Oct 30, 2019

Copy link
Copy Markdown
Member Author
[lfs "https://domain-name/tfs/collection/ProjectName/_git/ProjectName.git/info/lfs"]
	access = ntlm
[lfs "https://domain-name/tfs/collection/ProjectName/_git/ProjectName/info/lfs/objects/"]
	access = basic

These entries are used to record the authentication type we used last so we can pick the right one the next time. Since you switched from NTLM to Basic, we added a new entry. I'm not sure why the remote URL is slightly different, but it should be fine either way.

@bk2204
bk2204 force-pushed the ntlm-fallback-windowns branch from a61c3c5 to ad4c884 Compare October 30, 2019 19:55
@bk2204

bk2204 commented Oct 30, 2019

Copy link
Copy Markdown
Member Author

Okay, I've rebased this on the latest master.

@YawJatah, could you try this version with http.version set to HTTP/1.1 and using NTLM? If I'm correct, this version should fix both problems. If you need binaries, you can go to the CI check run page (when it completes) and download the windows-latest artifact, which should have binaries for you.

@IS-GYG

IS-GYG commented Oct 30, 2019

Copy link
Copy Markdown

Okay, I've rebased this on the latest master.

@YawJatah, could you try this version with http.version set to HTTP/1.1 and using NTLM? If I'm correct, this version should fix both problems. If you need binaries, you can go to the CI check run page (when it completes) and download the windows-latest artifact, which should have binaries for you.

@bk2204 , will try it out tonight. Just to confirm, http.version, is already set, or we have to manually set that in the git config (the config file under the .git folder)? Also for the server should we turn HTTP/2 back on and disable Basic authentication (So only leaving Negotiate enabled)?

@bk2204

bk2204 commented Oct 30, 2019

Copy link
Copy Markdown
Member Author

@bk2204 , will try it out tonight. Just to confirm, http.version, is already set, or we have to manually set that in the git config (the config file under the .git folder)? Also for the server should we turn HTTP/2 back on and disable Basic authentication (So only leaving Negotiate enabled)?

You'll need to set http.version manually, either in .git/config or in the per-user configuration (~/.gitconfig). That should make it work when you turn HTTP/2 on. And yes, please disable Basic, leaving only NTLM and Negotiate enabled. If things are fixed, it should continue to work with those settings enabled.

@IS-GYG

IS-GYG commented Nov 3, 2019

Copy link
Copy Markdown

@bk2204 I was able to finally test out the latest build. There is still an issue with ntlm. I can only get git lfs to work with basic authentication (I now have HTTP/2 turned on on the server side and atleast that works).
The only way I am able to update my repo is by doing

GIT_LFS_SKIP_SMUDGE=1 GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 GCM_TRACE=1 git pull --verbose

then

updating the config file entry for git fls

[lfs "https://repo-url.com/tfs/collection/project/_git/project.git/info/lfs"]
access = basic

[lfs "https://repo-url.com/tfs/collection/project/_git/project.git/info/lfs/objects/"]
access = basic

then

running

GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 GCM_TRACE=1 git lfs fetch origin --all

GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 GCM_TRACE=1 git lfs checkout

it seems that for Azure Devops git lfs doesn't work properly on the first url. The second url is added automatically after I set the first url to basic.

@bk2204

bk2204 commented Nov 4, 2019

Copy link
Copy Markdown
Member Author

Okay, then I'm not sure how to fix NTLM. I'm happy to accept a patch to do so, but without test infrastructure, I'm unable to reproduce this problem.

I'm going to close this PR, since it doesn't work.

@bk2204 bk2204 closed this Nov 4, 2019
@IS-GYG

IS-GYG commented Nov 5, 2019

Copy link
Copy Markdown

@bk2204 , if we setup a test Azure DevOps server for you, will that be helpfull in testing and validating this issue (there is no config to be don on the client side, plus you will be connecting directly to the actually enviroment that seems problematic)?

@bk2204

bk2204 commented Nov 5, 2019

Copy link
Copy Markdown
Member Author

Yes, if I can have a test account with NTLM, that would be helpful in tracking this down. I have a Windows 10 Pro VM I can use for testing.

@IS-GYG

IS-GYG commented Nov 5, 2019

Copy link
Copy Markdown

@bk2204 Sounds good, will setup a test server and pm you when it is ready. Thanks

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.

3 participants