-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Silent install of "winget install git.git" is not working #797
Comments
Is SmartScreen enabled on the target machine? If it is disabled, the prompts appear under certain scenarios regardless of what flags are passed to winget (since it's Windows putting them up, not winget). #703 has some discussion of this issue, but the problem should have been fixed in the last release of winget (which you have)... |
So I checked SmartScreen settings on all systems. They were all turned off but a few of them had a warning link to the top right of the toggle button that I clicked which popup up a security dialog asking me to confirm. Once I did this I clearly confirmed So now I have all systems up to date but 1 computer still forces the popup. Here is an image of the security toggles and the shell output. As well I just tried turning off the toggles for Edge and the MS Store Apps but still have same issue. Thanks for you help. |
On that system, you need to check "Check apps and files" for the security warning to go away. If Windows checks the file against SmartScreen, it is sure enough that the file isn't malware so it doesn't have to ask you. Edit: it's worth noting that if you are doing this on several machines, these settings can be centrally configured through GPO/MDM: https://docs.microsoft.com/en-us/windows/security/threat-protection/microsoft-defender-smartscreen/microsoft-defender-smartscreen-available-settings#group-policy-settings |
Oh wow you are correct. However on the other two systems that checkbox is off. Any ideas what the difference might be? Will check next what happens when I normalize everything. As well thanks for the tip - yes this is scaling up to 15 new systems so I really appreciate the pointer. Thanks for making winget just found out about it a few days ago and Im really excited to tell our community about it. Edit: I guess you already mentioned the flags passed along to winget aren't necessarily in sync with the user interface. The solution therefore would be to turn them off and on? |
"Check apps and files" means that Windows sends a signature from the file to Microsoft to see if it is malicious before opening the file, and in 20H2 they broke this out from the other SmartScreen settings to make it more clear what is going on I think (although someone may know more about it than I do). The flags passed to winget don't control SmartScreen, it's a different application (and if passing silent to winget caused SmartScreen settings to change that would break a lot of stuff in corporate environments). The settings in the Defender control panel should be what is being applied (and will be greyed out if you use GPO instead). |
@jedieaston you seem to be familiar with Group Policy. Would you mind taking a look at some of the policies for the Windows Package Manager? #154 I think we're going to rename them to be more generic "App Installer" since that is what we ship in, so "Windows Package Manager" might become "App Installer" for the policy titles, but the descriptions are pretty close to what we're thinking. |
@jarrettgsmith we haven't determined the best path forward for remote execution. Many installers require UAC or have some sort of dialog box. I think remote scenarios may require some additional work in the manifest and the client. I don't know if anybody has created an Issue to address remote scenarios off the top of my head. |
Ok good to know. Hopefully this will catch on eventually.
|
If SmartScreen is disabled or otherwise unavailable on the system, yes. But you should enable SmartScreen, it's safer. |
@jedieaston: I already disabled SmartScreen, that alone didn't work around this problem... |
@agowa338 The problem is being created by SmartScreen being disabled. Either enable it (which is what you should do) or set the setting that you had in your screenshot. |
But when I had SmartScreen enabled I saw the same issue... |
Can you send a screenshot of your SmartScreen settings? |
Check the box that says "Check apps and files" and try it again. |
@jedieaston but then it'll communicate every executable to azure, or am I misunderstanding that feature? |
It communicates newly downloaded installer names, URLs, and hashes to Microsoft. If your executable names being anonymously sent to Microsoft is a breach in your security strategy, I'd reevaluate (why are your executable names a trade secret?). But if you disable SmartScreen, Windows doesn't know if a executable is trustworthy or not so it'll pop up that "Open File - Security Warning" box every time so you know its running a new executable from the internet (unless you go and turn it off, which if you don't have SmartScreen I probably wouldn't). If you are downloading stuff from your internal network, you can tell Windows to the "Trusted Sites" list in Internet Options so it doesn't show the warning (you can also do this via GPO). |
It's not a security thing, but a compliance one... And having the URL submitted for example could also reveal internal server names. Then if you're a software company, the installer name could exfiltrate information about upcoming products, services, or customers... And this could lead to compliance and NDA violations... Also to stay on topic, my expectation as a user of winget-cli would be that files it pulls are already "prechecked" and because of the contained sha256sum don't depend on SmartScreen and that winget-cli just removes the ZoneIdentifier (unblocks the file) if the sha256sum (InstallerSha256 from within the yaml file within the winget-pkgs repo) matches the expected one. |
In brief : Why did you choose to completly ignore internet setting and call "ApplyMotwIfApplicable" to zone 3 on every single download ? ([CORE] Started applying motw to C:... with zone: 3) / src/AppInstallerCommonCore/Downloader.cpp Some explanation regarding my use case. I just discover winget-cli a week ago and fall in love with the clear and simple yaml file description for each package. I start writing a small python script which update the git repo, extract yaml files based on a configurable list and then each installer which are put in a intranet website (as winget does not support UNC path for installer - which sadly make standalone installation impossible but note I did not try to point it to a local hard drive). All those manifest are then rewritten with the intranet URL and put in a internal share. Sadly I did not manager to implement a local winget repository but I may thanks to the REST API (which looks easier to learn than the msix). As winget does not allow post-install configuration like other package management I still need something on top of it to deploy configuration so I finally use an other tool which run winget install with -m and point it to my updated manifest which contain internal url. We have a very low bandwith and we strictly disable internet access (anything, even ntp is internal). I did not try to inspect network traffic neither I searched on internet in order to add exception for smartscreen traffic. When I first try it I change internet settings so my internal url is in Zone.Identifier 2 (internal website). I was thinking it is the solution but now I think this was due to coincidence as I also authenticate myself on our internet portal to run Windows Update without WSUS. Or maybe something else change with 20H2 update. As you may imagine I become crazy (why did this work some days ago) and start searching. I thinked this was due to my registry tweek to automate the internet setting configuration during initial winget install ... I remove those registry key and start testing different zone and I slowly learn ... Finally I'm a little disapointed because winget choose to set downloaded file to zone 3 just after downloading. Why did you choose to completly ignore internet setting and call "ApplyMotwIfApplicable" to zone 3 on every single download ? ([CORE] Started applying motw to C:... with zone: 3) From what I understand, if defender and smartscreen are enable they will check the file even from trusted zone or intranet zone so I see no benefit into setting the zone manually in your source code. What happens is that people are forced to use smartscreen or to disable a security feature on zone 3 (or even worse as you may find on internet). From my point of view, disabling security by default is a no way. You remove the ability for administrators to configure this feature and to allow a list of source (based on softwares manifest) or an internal mirror like I'm doing. Please, can you reconsider this feature and rely on Windows to set the good zone or even like I found in discussion, just unblock the file as it already passed sha256 validation and the corresponding file may already be checked during manifest import or whatever process you have. I will look for the corresponding commit message to further understand this choice, maybe you can point me to it. For today I'm done. Regards and thanks for this very nice project ! |
@fabienr when the installer is downloaded, it's coming from zone 3. After the hash is verified, it's modified to zone 2. |
Thanks @denelon, I was reading more comments and more code in the meanwhile. Looks like I will not sleep without a solution (no, realy this is my last comment today). I'm loocking further now. Thus I read the https://github.com/microsoft/winget-cli/releases/tag/v0.2.3162-preview.
I move my internal website to zone 2 (trusted) instead of 1 (internal) sorry if I'm confused with 1/2/3 ...
Wherase the file downloaded from winget (which I delete myself before runing install) have zone 3
So it looks like winget did not identify my website correcltly as the flag InstallerTrusted is not set ? I have to further read the source code to understand how the flag is set, should't it be set based on internet setting ? Then I do not understand what ApplyMotwUsingIAttachmentExecuteIfApplicable is doing but I guess it changed nothing to the zone as there is no further result for ApplyMotwIfApplicable neither for IZoneIdentifier. Should I do something to refresh / apply my internet settings ? Actually what is a trusted zone from winget point of view ? |
Just to clarify, I'm seeing the same security warning as others comments and I'm not able to silently install packages with winget. This is not related to any specific manifest but rather to the way I mirror the winget repository and internalise the deployment.
After reading more code, even if I'm not used to cpp. The source check is not checking the installer url but rather the source from which the manifest came from.
Actually there is no easy solution for my use case which is standalone offline deployment.
The second point may be the easiest one but this depends on your security policy (which I understand but still I think you prevent/ignore Administrator settings). I'm going to to workaround this issue with $env:SEE_MASK_NOZONECHECKS=1 to make progress until there is a proper solution. |
This shouldn't be too hard to add on in a REST source implementation, I was thinking about a similar use case but am waiting for a way to deploy the sample restsource so I can mess with it. The redistribution rights internally shouldn't be a problem, SCCM does it all of the time. You just can't (or shouldn't) make the mirror public without permission from the copyright holders. |
@denelon @jedieaston Thanks you both for your answers ... but did you understand why others have this smartscreen problem ? Which have already been fixed for the official use case.
If it's a real bug then this issue may have a higher priority. Maybe at least bring more documentation so you can fix it yourself if the problem came from your environnement. Can you try with "winget install --verbose-logs ..." and look what happens in the last log from ... \ AppData \ Local \ Packages \ Microsoft.DesktopAppInstaller_8wekyb3d8bbwe \ LocalState \ DiagOutputDir ?
When the security window pop up, keep it open and go check which zone your file have. When this happen you already pass all the security measure implemented by winget. One way to know the zone identifier is with a powersheel command "Get-Content your_file.type -Stream Zone.Identifier". The installer is located in ... \ AppData \ Local \ Packages \ Microsoft.DesktopAppInstaller_8wekyb3d8bbwe \ TempState \ WinGet.
Maybe someone can confirm this path is the acutal installer winget run ? It looks like all reports talk about normal online installation from trusted source. If they don't, I clearly want to know how to implement my own repository and change the source ^^ @denelon, I hope this will helps the engineering team, and the security team. If the intent is to have a silent install with a deterministic behaviour then, sadly, it looks like winget can't rely on the zone identifier as some GPO may change it (except if I misunderstand something). Maybe @agowa338 and @jarrettgsmith are in this case, can't tell you but I imagine this will happen if a GPO can change this behaviour. Otherwise may I suggest an entry in a future faq like "Why did I get a security warning while I wanted a silent install" ? Note I did not had this exact case but I'm sure a clear answer explaining the intended behaviour and how winget seculry install things by default may benefit users in many cases. Not sure if it's woth mentionning the workaround with a local env variable but if it prevent people from changing the zone 3 settings ... Regarding the workaround, thanks to @jedieaston and @svenmauch to mention it. I may have spent hours to discover SEE_MASK_NOZONECHECKS and the initial issue is closed. |
This is how I solve my use case with both Winget and Chocolatey software but really it would not have been possible to realize this software without Winget! Thanks a lot! As I did not test it from scratch again, you may find some problems but I think it should work. My address is in the source code license. The hard part is the internal website setup which must point to the installers directory. Except that, just follow the readme, it's very easy to setup. Hope this helps and maybe we can take some idea there and bring them into real cpp code. Until then, if some peoples are interested we can still open a repo for this small script. Sorry if for any reason I should not have sent it there. I just want to give back in case someone find it helpful. |
Having this same issue with Winget v1.0.11451 on build 21390. It worked fine previously, but now unless I have the env variable added, I get stuck with a Zone Identifier issue, says that my internet security settings have prevented the application from running and I've made no changes to any of those settings, nor has any program installed (I reset IE settings to make sure), or any GPOs as my machine is not managed and no policies are defined. Only just noticed when I tried to do a winget upgrade --all, and then when that failed, tried to do a single application. |
Two questions:
|
I did have Smartscreen enabled. As mentioned in my comment, my machine is not managed at all, no policies were defined. However I have taken the Windows 11 Dev Insider Channel update and the issue seems to have been alleviated, I just attempted |
Environment
Windows Package Manager v0.2.10191 Preview
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.18363.1440
Package: Microsoft.DesktopAppInstaller v1.11.10191.0
Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
Issue
I am trying to use
winget install
to install git remotely. When running through a remote session the install hangs because I suspect the installer is waiting for an interaction as it has not gone silent. When I run the silent mode on a local powershell with administrator I get the dialog pop. How can I guarantee silent mode for all potential apps?I have tried...
winget isntall git.git -h
winget isntall git.git --silent
winget isntall git.git /silent
winget isntall git.git /s
winget install --id Git.Git -e -h
winget install --id Git.Git -e --silent
The dropbox link shows my winget --info as well as the install command failing to run silently and popping up the installer dialog. I am using a powershell in Administrator mode. Eventually I want this to work over a remote session but Im surprised to run up against this immediately. I also tried Notepad++ with the same issue.
Screen Capture
https://www.dropbox.com/s/wwvl068kfvx98y1/winGetInstallSilentIssue.png?dl=0
Thank you,
Jarrett
The text was updated successfully, but these errors were encountered: