diff options
| author | David Lönnhager <david.l@mullvad.net> | 2020-03-06 17:17:29 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2020-03-16 12:54:27 +0100 |
| commit | 329e52f9cceb64ec2591383b56ec7dcfba11cdac (patch) | |
| tree | 3f311e7ae7c181b417ca6be5cca418c9f362f738 | |
| parent | 1c834ab5bd0b04bcebb41d69b4e8c708fda1ebe6 (diff) | |
| download | mullvadvpn-329e52f9cceb64ec2591383b56ec7dcfba11cdac.tar.xz mullvadvpn-329e52f9cceb64ec2591383b56ec7dcfba11cdac.zip | |
Ask whether to revert firewall rules if the installation fails on Windows
| -rw-r--r-- | dist-assets/windows/installer.nsh | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/dist-assets/windows/installer.nsh b/dist-assets/windows/installer.nsh index 45404e98fd..0e5d1e6646 100644 --- a/dist-assets/windows/installer.nsh +++ b/dist-assets/windows/installer.nsh @@ -40,22 +40,7 @@ # electron-builder uses a GUID here rather than the application name. !define INSTALL_REGISTRY_KEY "Software\${PRODUCT_NAME}" -# -# BreakInstallation -# -# Aborting the customization step does not undo previous steps taken -# by the installer (copy files, create shortcut, etc) -# -# Therefore we have to break the installed application to -# prevent users from running a half-installed product -# -!macro BreakInstallation - - Delete "$INSTDIR\mullvad vpn.exe" - -!macroend - -!define BreakInstallation '!insertmacro "BreakInstallation"' +!define BLOCK_OUTBOUND_IPV4_FILTER_GUID "{a81c5411-0fd0-43a9-a9be-313f299de64f}" # # ExtractTapDriver @@ -649,8 +634,7 @@ ${If} $R0 != 0 MessageBox MB_OK "Fatal error during driver installation: $R0" - ${BreakInstallation} - Abort + Goto customInstall_abort_installation ${EndIf} ${ExtractWintun} @@ -658,21 +642,54 @@ ${If} $R0 != 0 MessageBox MB_OK "$R0" - ${BreakInstallation} - Abort + Goto customInstall_abort_installation ${EndIf} ${InstallService} ${If} $R0 != 0 MessageBox MB_OK "$R0" - ${BreakInstallation} - Abort + Goto customInstall_abort_installation ${EndIf} ${AddCLIToEnvironPath} ${InstallTrayIcon} + Goto customInstall_skip_abort + + customInstall_abort_installation: + + # Aborting the customization step does not undo previous steps taken + # by the installer (copy files, create shortcut, etc) + # + # Therefore we have to break the installed application to + # prevent users from running a half-installed product + # + Delete "$INSTDIR\mullvad vpn.exe" + + nsExec::ExecToStack '"$SYSDIR\netsh.exe" wfp show security FILTER ${BLOCK_OUTBOUND_IPV4_FILTER_GUID}' + Pop $0 + Pop $1 + + ${If} $0 == 0 + MessageBox MB_ICONEXCLAMATION|MB_YESNO "Do you wish to unblock your internet access? Doing so will leave you with an unsecure connection." IDNO customInstall_abortInstallation_skip_firewall_revert + + SetOutPath "$TEMP" + File "${BUILD_RESOURCES_DIR}\mullvad-setup.exe" + File "${BUILD_RESOURCES_DIR}\..\windows\winfw\bin\x64-Release\winfw.dll" + nsExec::ExecToStack '"$TEMP\mullvad-setup.exe" reset-firewall' + Pop $0 + Pop $1 + + log::Log "Resetting firewall: $0 $1" + ${EndIf} + + customInstall_abortInstallation_skip_firewall_revert: + + Abort + + customInstall_skip_abort: + Pop $R0 !macroend @@ -712,6 +729,7 @@ # Save the target tunnel state if we're upgrading SetOutPath "$TEMP" File "${BUILD_RESOURCES_DIR}\mullvad-setup.exe" + File "${BUILD_RESOURCES_DIR}\..\windows\winfw\bin\x64-Release\winfw.dll" nsExec::ExecToStack '"$TEMP\mullvad-setup.exe" prepare-restart' Pop $0 Pop $1 |
