Skip to content
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

Avoid adding a new windows firewall exemption every time an application is updated #1052

Open
peters opened this issue Jun 7, 2017 · 14 comments

Comments

@peters
Copy link
Contributor

peters commented Jun 7, 2017

The problem is that every time an application is updated, the user has to add (accept) a new firewall exemption. This is probably fine for most users, but this application is running in a unattended mode (Corporate 💵 ).

I have two ideas on how we can get around this "limitation". Upon first install an exemption will have to be accepted by the user (Windows default prompt anyways):

1 - Host the CLR inside a stub executable and load the target application into memory. This would be a opt-in feature during releasify and only work for managed applications.

2 - Use .exe.config trickery rewriting the DLL load path (only works for managed dlls), modify environment "PATH" variable to include "app-X.X.X" (native dlls) and set current directory to "app-X.X.X" (I have yet to confirm this would work as expected, but I imagine so 🤞 )

@paulcbetts What are your thoughts on the matter? Am I´m overthinking this? Feedback appreciated 🍻

@anaisbetts
Copy link
Contributor

@peters Are you using the latest version of Squirrel.Windows and launching via the execution stubs? I want to confirm the current Best Practice approach doesn't work. If not, Plan 2 might work, or we can try:

3 - Explicitly add app-X.X.X to the LoadLibrary path, then call LoadLibrary on ThatExe.exe and call into the import with ordinal zero which is guaranteed to be their version of main(). That might Get Weird though because we're not launching them into a pristine environment, we're launching them into one where msvcrt is already initialized etc etc etc.

@peters
Copy link
Contributor Author

peters commented Jun 8, 2017

@paulcbetts Yes, I'm using the latest version. Tested on Windows 10 Pro/Enterprise (Anniversary / Creators Update). Firewall occur just after the CreateProcess call. I haven't tested any older Windows versions.

If not, Plan 2 might work

How about the following (Mix of plan 2 and 3):

  1. Copy %LOCALAPPDATA%\sample\app-X.X.X\sample.exe to %LOCALAPPDATA%\sample\sample.exe
  2. Copy %LOCALAPPDATA%\sample\app-X.X.X\sample.exe.config (If it exists) to %LOCALAPPDATA%\sample\sample.exe
  3. Create/Modify %LOCALAPPDATA%\sample\app-X.X.X\sample.exe.config with the following:
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="app-X.X.X;any;sections;copied;from;existing;exec;config" />
    </assemblyBinding>
  </runtime>
</configuration>
  1. LoadLibrary approach

Caveats:

What is the catch in all this? All your globals are initialized within the context of another thread, and >not the main one. If initializing global stuff must be in the main thread, then you can have your >WinMain call again your own callback and never return; and then return execution from that callback.

You also run the risk of calling WinMainCRTStartup() twice (the first was from your own executable) in >the same address space. Are there any side effects? Who knows

This is a lot of work though 😢

  1. Alternative approach to LoadLibrary: Signal the target executable by introducing a new CLI argument; squirrel-cwd=%LOCALAPPDATA%\app-X.X.X and require target application to change their current working directory.

@jonathanbp
Copy link

Any new developments on getting this fixed?

@anaisbetts
Copy link
Contributor

Nobody is working on this afaik, if you have any good ideas / insider info on how to convince the Firewall that our app is The Same App, we'd definitely take a PR to fix this bug

@jonoomph
Copy link

Just curious if there are any updates to this ticket? Any known workarounds for the Firewall prompt on every update? Thanks!

@rrhornback
Copy link

Any progress or updates to report?

@sandeep1995
Copy link

We are still stuck on this issue. @shiftkey Can you take a look at this please?

@sandeep1995
Copy link

Do we have a solution for this yet?

@SultanaJon
Copy link

Any update on this?

@Rambarani
Copy link

@peters I also facing this issue. did you able to fix this ?

@SultanaJon
Copy link

@Rambarani I don't this this is fixed. Microsoft Teams fixed this by creating a previous and current directory where their previously used version will live and their current (new) version will live. This allows them to add an allowed firewall exception to the exe in the current directory and allows their app to work when updated.

@caesay
Copy link

caesay commented May 20, 2022

This has been fixed in my Squirrel fork (tracked in clowd#24) by following a similar approach to how msft teams did it with their proprietary fork. This solved loads of issues, tray icon pinning, firewall rules, gpu affinity, taskbar pinned shortcuts, etc. It will be released in v3.0 (eta early June).

@Rambarani
Copy link

@Rambarani I don't this this is fixed. Microsoft Teams fixed this by creating a previous and current directory where their previously used version will live and their current (new) version will live. This allows them to add an allowed firewall exception to the exe in the current directory and allows their app to work when updated.

Thanks @SultanaJon

@Rambarani
Copy link

This has been fixed in my Squirrel fork (tracked in clowd#24) by following a similar approach to how msft teams did it with their proprietary fork. This solved loads of issues, tray icon pinning, firewall rules, gpu affinity, taskbar pinned shortcuts, etc. It will be released in v3.0 (eta early June).

Thanks @caesay

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

No branches or pull requests

9 participants