Skip to content

Commit

Permalink
Self-update: Migrate to Go
Browse files Browse the repository at this point in the history
While OAuth, eduVPN discovery and API are being migrated to Go
(eduvpn-common), self-update is remaining feature that kept using
antique .NET/Windows HTTPS client. This prevents eduVPN server
infrastructure from enforcing TLS 1.3 and other 202x security features
not included on old Windows platforms.

Signed-off-by: Simon Rozman <[email protected]>
  • Loading branch information
rozmansi committed Apr 27, 2023
1 parent 6eefb9f commit ae05477
Show file tree
Hide file tree
Showing 36 changed files with 1,836 additions and 609 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## [Unreleased](https://github.com/Amebis/eduVPN/compare/3.4...HEAD)

- eduvpn-common integration
- Self-update migrated to Go
- OpenVPN updated to 2.5.9-20230427
- openvpn 2.5.9 ea4ce681d9008f277706f4d90f2648ae043cbb2e
- libsodium updated to 1.0.18-20230427
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ BuildDeps :: \
BuildLibsodium \
BuildOpenVPN \
BuildWireGuard \
BuildeduVPNCommon
BuildeduVPNCommon \
BuildeduVPNWindows

BuildWireGuard ::
cd "wireguard-windows\embeddable-dll-service"
Expand Down
34 changes: 34 additions & 0 deletions MakefileCfgPlat.mak
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Publish :: \
"bin\$(CFG)\$(PLAT)\eduOAuth.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduOpenVPN.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduvpn_common.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduvpn_windows.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduVPN.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduVPN.Views.vtanalysis" \
"bin\$(CFG)\$(PLAT)\eduWireGuard.vtanalysis"
Expand All @@ -100,6 +101,8 @@ Publish :: \

"bin\$(CFG)\$(PLAT)\eduvpn_common.vtanalysis" : "bin\$(CFG)\$(PLAT)\eduvpn_common.dll"

"bin\$(CFG)\$(PLAT)\eduvpn_windows.vtanalysis" : "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"

"bin\$(CFG)\$(PLAT)\eduVPN.vtanalysis" : "bin\$(CFG)\$(PLAT)\eduVPN.dll"

"bin\$(CFG)\$(PLAT)\eduVPN.Resources.vtanalysis" : "bin\$(CFG)\$(PLAT)\eduVPN.Resources.dll"
Expand Down Expand Up @@ -129,6 +132,7 @@ Clean ::
-if exist "bin\$(CFG)\$(PLAT)\eduOAuth.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduOAuth.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduOpenVPN.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduOpenVPN.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_common.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_common.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_windows.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_windows.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduVPN.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduVPN.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduVPN.Views.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduVPN.Views.vtanalysis"
-if exist "bin\$(CFG)\$(PLAT)\eduWireGuard.vtanalysis" del /f /q "bin\$(CFG)\$(PLAT)\eduWireGuard.vtanalysis"
Expand Down Expand Up @@ -238,6 +242,36 @@ CleaneduVPNCommon ::
-if exist "eduvpn-common\exports\resources_$(GOARCH).syso" del /f /q "eduvpn-common\exports\resources_$(GOARCH).syso"
!ENDIF

BuildeduVPNWindows \
BuildeduVPNWindows-$(CFG)-$(PLAT) :: \
"bin\llvm-mingw-20220906-msvcrt-x86_64\bin\gcc.exe" \
"eduvpn-windows\resources_$(GOARCH).syso" \
"bin\$(CFG)\$(PLAT)" \
"bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"

"bin\$(CFG)\$(PLAT)\eduvpn_windows.dll" ::
cd "eduvpn-windows"
set GOARCH=$(GOARCH)
set GOARM=7
set CGO_ENABLED=1
set CGO_CFLAGS=$(CGO_CFLAGS)
set CGO_LDFLAGS=$(CGO_LDFLAGS)
set CC=$(CC)
go.exe build $(CFG_GOFLAGS) -o "..\bin\$(CFG)\$(PLAT)\eduvpn_windows.dll" -buildmode=c-shared .
cd "$(MAKEDIR)"

CleaneduVPNWindows ::
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_windows.dll"
-if exist "bin\$(CFG)\$(PLAT)\eduvpn_windows.h" del /f /q "bin\$(CFG)\$(PLAT)\eduvpn_windows.h"

!IF "$(CFG)" == "$(SETUP_CFG)"
"eduvpn-windows\resources_$(GOARCH).syso" : "eduvpn-windows\resources.rc"
$(WINDRES) -DVERSION_ARRAY=$(VERSION:.=,) -DVERSION=$(VERSION) -i $** -o $@ -O coff -c 65001

CleaneduVPNWindows ::
-if exist "eduvpn-windows\resources_$(GOARCH).syso" del /f /q "eduvpn-windows\resources_$(GOARCH).syso"
!ENDIF

Build-$(CFG)-$(PLAT) ::
bin\nuget.exe restore $(NUGET_FLAGS)

Expand Down
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ image: Visual Studio 2022
before_build:
- git submodule update -q --init --recursive
- cmd: |
if /i %platform% equ x86 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" /ls
if /i %platform% equ x64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" /ls
if /i %platform% equ ARM64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" /ls
if /i %platform% equ ARM64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86 && nmake "BuildLibsodium-%configuration%-x86" "BuildeduVPNCommon-%configuration%-x86" /ls
if /i %platform% equ x86 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" "BuildeduVPNWindows-%configuration%-%platform%" /ls
if /i %platform% equ x64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" "BuildeduVPNWindows-%configuration%-%platform%" /ls
if /i %platform% equ ARM64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64 && nmake "BuildLibsodium-%configuration%-%platform%" "BuildOpenVPN-%configuration%-%platform%" BuildWireGuard "BuildeduVPNCommon-%configuration%-%platform%" "BuildeduVPNWindows-%configuration%-%platform%" /ls
if /i %platform% equ ARM64 "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64_x86 && nmake "BuildLibsodium-%configuration%-x86" "BuildeduVPNCommon-%configuration%-x86" "BuildeduVPNWindows-%configuration%-x86" /ls
- nuget restore -Verbosity quiet
configuration:
- Debug
Expand Down
8 changes: 4 additions & 4 deletions eduVPN.Views/Pages/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
Margin="7"
HorizontalAlignment="Center"
Style="{StaticResource LinkButtonStyle}"
Command="{Binding Wizard.ShowChangelog}"
Command="{Binding Wizard.SelfUpdatePromptPage.ShowChangelog}"
Content="{x:Static res:Strings.AboutPageChangelogTitle}"/>

<Button
Expand All @@ -71,11 +71,11 @@
Width="200" Height="Auto"
Padding="3"
Style="{StaticResource DiscreteButtonStyle}"
AutomationProperties.Name="{Binding Wizard.AvailableVersion, StringFormat={x:Static res:Strings.AboutPageUpdateTitle}, Converter={StaticResource RemoveAccessKeyConverter}}"
Command="{Binding Wizard.StartUpdate}">
AutomationProperties.Name="{Binding Wizard.SelfUpdatePromptPage.AvailableVersion, StringFormat={x:Static res:Strings.AboutPageUpdateTitle}, Converter={StaticResource RemoveAccessKeyConverter}}"
Command="{Binding Wizard.SelfUpdatePromptPage.StartUpdate}">
<AccessText
TextAlignment="Center"
Text="{Binding Wizard.AvailableVersion, StringFormat={x:Static res:Strings.AboutPageUpdateTitle}}"/>
Text="{Binding Wizard.SelfUpdatePromptPage.AvailableVersion, StringFormat={x:Static res:Strings.AboutPageUpdateTitle}}"/>
</Button>
</Grid>
</Page>
4 changes: 2 additions & 2 deletions eduVPN.Views/Pages/SelfUpdatePromptPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Margin="22,7"
HorizontalAlignment="Center"
Style="{StaticResource LinkButtonStyle}"
Command="{Binding Wizard.ShowChangelog}"
Command="{Binding ShowChangelog}"
Content="{x:Static res:Strings.SelfUpdatePromptPageChangelogTitle}"/>

<Button
Expand All @@ -53,7 +53,7 @@
Padding="3"
IsDefault="True"
AutomationProperties.Name="{Binding Source={x:Static res:Strings.SelfUpdatePromptPageUpdateTitle}, Converter={StaticResource RemoveAccessKeyConverter}}"
Command="{Binding Wizard.StartUpdate}">
Command="{Binding StartUpdate}">
<AccessText
TextAlignment="Center"
Text="{x:Static res:Strings.SelfUpdatePromptPageUpdateTitle}"/>
Expand Down
56 changes: 0 additions & 56 deletions eduVPN/Models/DownloadedFileCorruptException.cs

This file was deleted.

64 changes: 0 additions & 64 deletions eduVPN/Models/InstallerFileUnavailableException.cs

This file was deleted.

27 changes: 0 additions & 27 deletions eduVPN/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions eduVPN/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,6 @@
<data name="ErrorInteractiveService" xml:space="preserve">
<value>Interactive Service failure.</value>
</data>
<data name="ErrorDownloadedFileCorrupt" xml:space="preserve">
<value>Downloaded file {0} is corrupt.</value>
<comment>{0}=URI</comment>
</data>
<data name="ErrorDownloading" xml:space="preserve">
<value>Downloading from web failed. Please check your internet connection.</value>
</data>
Expand All @@ -186,9 +182,6 @@
<data name="OpenVPNStateTypeTcpConnecting" xml:space="preserve">
<value>Connecting to TCP server...</value>
</data>
<data name="ErrorInstallerFileUnavailable" xml:space="preserve">
<value>Installer file not available. Updating aborted.</value>
</data>
<data name="ErrorDownloadingSignature" xml:space="preserve">
<value>Downloading web resource signature failed.</value>
</data>
Expand All @@ -213,9 +206,6 @@
<data name="ErrorInvalidHostname" xml:space="preserve">
<value>Invalid hostname: hostnames contain letters, numbers, hyphens and dots.</value>
</data>
<data name="ErrorSelfUpdateDetection" xml:space="preserve">
<value>Detecting self-update failed.</value>
</data>
<data name="ErrorHttpRedirectToUnsafeUri" xml:space="preserve">
<value>HTTP server redirected to an unsafe URI.</value>
</data>
Expand Down
Loading

0 comments on commit ae05477

Please sign in to comment.