-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
2.2.10 broke SMB synced_folder in enterprise environments #11945
Comments
We are having this issue as well with version 2.2.10. It seems that Vagrant's initial credential check wants DOMAIN\user or user@domain, but when vagrant tries to mount the share on the guest OS (CentOS 6), the credentials that were provided earlier get mangled and authentication fails. Windows event log showed failed authentication as using domain SAMBA despite the username already including the domain. We've tried various arrangements, DOMAIN\user, user@domain, [email protected], user, etc. including quoting the username string. There doesn't seem to be a variant that satisfies both vagrant's initial credential check and the guest OS's needs for mounting the share. 2.2.9 allows us to enter credentials as simply the username. Vagrant does not seem to immediately validate those credentials, as I can enter known incorrect values. So that may be why it works in 2.2.9. My suspicion is that 2.2.10 added some preliminary validation of the credentials, and that validation doesn't match what the guest OS needs when trying to mount the share. |
I don't think the change proposed in #11989 will fix this issue (unless there are multiple issues here). I experimented with it a bit and passing As others have said, |
I'm experiencing this with 2.2.18. |
same here. 2.2.18 |
So on my end I was able to fix this issue by patching Vagrant's
To:
Note the only difference above is that we're constructing the This appears to make it so that when I enter my username in the form of More info for this specific API can be found here: Doc says the following for the above
Couple other things I noticed in testing my patch above:
Let me know if this works for other folks on this thread, thanks! PS: Without the above patch applied, when I entered my username in the form of |
I had the same issue, and I tested your workaround @onpubcom but this forces me to enable the VPN (so I did not tested entirely your solution). So I went to some files and dropped / reverted some lines of code: C:\HashiCorp\Vagrant\embedded\gems\2.2.18\gems\vagrant-2.2.18\plugins\hosts\windows\scripts\check_credentials.ps1 C:\HashiCorp\Vagrant\embedded\gems\2.2.18\gems\vagrant-2.2.18\templates\locales\synced_folder_smb.yml From soapy1@c2df342#diff-ba2e76f88b2d746bad0e0dfc36c7f3db9518524d1cb1bf51511822cb49f819f7 : C:\HashiCorp\Vagrant\embedded\gems\2.2.18\gems\vagrant-2.2.18\plugins\hosts\windows\plugin.rb
That last one (plus possible ones above which might not be needed) did the trick! |
Still facing this issue on 2.2.18 |
Also experiencing the same issue with domain credentials on 2.2.19. @onpubcom workaround is working for me but I'd appreciate a fix that works offline. |
Almost 2 years later this bug is still there and its essentially a blocker for windows guest VMs. |
@dlkj If you or anyone else in this thread knows of some way to check the cached/offline AD credential store via PowerShell, then it should be possible to do what you're requesting, but so far in my (admittedly brief) research I haven't found a way to do that. If anyone has any pointers on how to make my patch work offline, then I'd be happy to try and revise it and then submit it as a PR from there. |
@onpubcom Would that be helpful? |
I hit this issue as well in 2.2.19, and the workaround in #11945 (comment) turned out to be insufficient in my environment. I ended up with the following block:
The two changes are using The latter change (inspired by this blog post from 2015, so it's not new) wasn't needed when I ran the same script under PowerShell 7; so I suspect the default in .NET Core is different from .NET Framework. I also suspect this is needed because the default in .NET Framework was something like NTLM, which is now held to be insecure and has been disabled by my employer. I only tested this with a username in the form Edit: I tried with the other username form I think in a proper fix, the |
So my sense of this issue as it stands now is that it's not currently possible to use the Windows cached credentials store to validate existing credentials @hegyre @TBBle , even if we were to use the module described here https://techgenix.com/managing-cached-credentials/, correct me if I'm wrong though. I've browsed the various core PowerShell/.NET API docs, and I didn't see anywhere there either which offers checking of cached AD credentials. So a person really does need a network connection to their domain controllers in order to validate their login credentials when using my patch, it seems. I would argue this is still better than the currently still broken (last I checked) domain validation logic in the core Vagrant releases. How would you feel about merging my patch in to an upcoming release @hegyre ? I'd be happy to create a PR at some point soon if you agree with my assessment here, lmk. |
Hey @onpubcom , That worked great with 2.2.9, why we couldn't simply revert to what it was with 2.2.9 ? |
Fair enough @hegyre. Though I would argue that most people who have their machines connected to an AD are likely doing it because of their job or on a work computer, so in that case most folks would either be connected directly to their corporate network or VPN already when starting up their VMs via Vagrant, though I of course agree that this is the least desirable option if we can somehow still check local/cached credentials in a completely offline way. I think at some point I'll test 2.2.9 on my domain connected machine to see if the logic in that version still works as expected on newer versions of Windows etc. Is there an older revision hash for that powershell script file in this repo that we could also look at to compare what the logic looks like in 2.2.9 vs. the current powershell logic for this flow? If you don't have that handy somewhere, I can try to dig it up sometime soon since that could also give some clues as to have broke in 2.2.10 and newer releases. Will circle back sometime soon, thanks. |
If I remember well (when my colleague tested my workaround above), by just removing that in C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-2.3.7\plugins\hosts\windows should make it works again:
|
Is it possible to get this prioritised? It's straight-up broken, and seems an easy fix. I can maybe try to do a pull request at some point, although I'm not familiar with Ruby at all and I've never looked at Vagrant's internals. At least I can confirm onpubcom's workaround works for me (although I found the file at Currently I have no choice but to include instructions on how to modify your Vagrant installation (!) in the readme for running on Windows, which is... less than ideal. |
fixing the domain check to use If a user with a domain joined computer needs to use their domain credentials, then they absolutely need to ensure they are on a network which can contact the DC; this is a user, not a vagrant, problem. I am +1 to altering Vagrant: 2.4.1 |
Agreed, there's no way I found to check against any kind of cached AD credential from Powershell that I'm aware of (last I checked), so the patch I previously suggested is likely the only viable fix for this 🤷 |
As of today my machine is now connected to the domain but with Azure AD, so when I go to the computer management, it's still seen as "Workgroup" but I'm really AAD-joined. Dunno if this thing plays a role here. Anyway if you need some testers I'm avail. |
I don't believe this plugin supports AAD at all, so that is another ticket all together. |
Vagrant version
2.2.10
Host operating system
Windows 10
Guest operating system
Linux
Expected behavior
When using an authenticated SMB synced_folder Vagrant up continues after entering the correct credentials when prompted
Actual behavior
Vagrant up fails as authentication always fails
Steps to reproduce
References
c2df342
I suspect by passing machine, local authentication is being requested which we don't have. In 2.2.9 AD credentials succeed.
In 2.2.10 we ctrl-c the prompt and ssh into the machine manually mounting the local /vagrant share works with AD creds.
I don't currently have a dev env to test removing machine from that call.
The text was updated successfully, but these errors were encountered: