8
6
Fork
You've already forked windows
1

Option to install Wireguard as Service #270

Open
opened 2025年06月25日 10:33:49 +02:00 by mortwein · 3 comments

Is there a possibility to make an option in the Windows Client to install the Wireguard as Service so it will be connected at boot time and it would be possible to disconnect from the VPN after login (not like the wireguard service as allways on vpn).

This would be a simple possibility to achieve pre-logon on Windows devices and to disconnect the clients from VPN if they are On-Site.

Is there a possibility to make an option in the Windows Client to install the Wireguard as Service so it will be connected at boot time and it would be possible to disconnect from the VPN after login (not like the wireguard service as allways on vpn). This would be a simple possibility to achieve pre-logon on Windows devices and to disconnect the clients from VPN if they are On-Site.
Context: https://lists.geant.org/sympa/arc/eduvpn-deploy/2025-06/msg00007.html
Collaborator
Copy link

This is the main reason I am not using eduVPN client myself. 😳

I said many times:

VPNs connect computers, not users.

But, the eduVPN team didn't listen to me when we started this project. Jason of the WireGuard did. Hence, the architecture of eduVPN client does not allow this, but the Windows WireGuard client does.
Your option is to go to your eduVPN server portal, get a WireGuard config file, and use stock WireGuard client on your Windows.

This would also solve #195, but would require a complete eduVPN Client for Windows redesign. Like "starting a new product" kind of redesign.

This is the main reason I am not using eduVPN client myself. 😳 I said many times: > VPNs connect computers, not users. But, the eduVPN team didn't listen to me when we started this project. Jason of the WireGuard did. Hence, the architecture of eduVPN client does not allow this, but the Windows WireGuard client does. Your option is to go to your eduVPN server portal, get a WireGuard config file, and use stock WireGuard client on your Windows. This would also solve #195, but would require a complete eduVPN Client for Windows redesign. Like "starting a new product" kind of redesign.

For our purpose, we need to have a connection on boot to log into Microsoft AD oder ZENWorks and after login the VPN Should be disconnected and the regular EduVPN Clinet should be used. So we though about using a special profile in eduvpn for connecting to AD/ZEN. This profile will be used to generate a wireguard config via AdminAPI.

For starting and stopping the wireguard service windows Scheduled Tasks could be used. I created a POC using "Inno Setup" for installing Wireguard, the profile and the service and tasks. The Profile has to be shipped with the installer.

 [Setup]
AppName=EduVPN-Pre-Logon
AppVersion=1.5
WizardStyle=modern
DefaultDirName={autopf}\EduVPN-Pre-Logon
DefaultGroupName=EduVPN-Pre-Logon
OutputDir=userdocs:Inno Setup Examples Output
PrivilegesRequired=admin
[Files]
Source: "{tmp}\wireguard-installer.exe"; DestDir: "{app}"; Flags: external;
Source: "{src}\profile\evpn.conf"; DestDir: "{app}"; Flags: external
;[Icons]
;Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"
[Run]
Filename: "{app}\wireguard-installer.exe"; Flags: waituntilterminated
Filename: "C:\Program Files\WireGuard\wireguard.exe"; Parameters: "/uninstallmanagerservice"; Flags: waituntilterminated runascurrentuser
Filename: "C:\Program Files\WireGuard\wireguard.exe"; Parameters: "/installtunnelservice ""{app}\evpn.conf"""; Flags: runascurrentuser
Filename: "schtasks"; \
 Parameters: "/Create /SC ONSTART /TN ""StartVPN"" /TR ""sc start WireGuardTunnel$evpn"" /RL HIGHEST"
Filename: "schtasks"; \
 Parameters: "/Create /SC ONLOGON /TN ""StopVPN"" /TR ""sc stop WireGuardTunnel$evpn"" /RL HIGHEST"
[Code]
var
 DownloadPage: TDownloadWizardPage;
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
 if Progress = ProgressMax then
 Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
 Result := True;
end;
procedure InitializeWizard;
begin
 DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
 DownloadPage.ShowBaseNameInsteadOfUrl := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
 if CurPageID = wpReady then begin
 DownloadPage.Clear;
 // Use AddEx to specify a username and password
 DownloadPage.Add('https://download.wireguard.com/windows-client/wireguard-installer.exe?dontcount=1', 'wireguard-installer.exe', '');
 DownloadPage.Show;
 try
 try
 DownloadPage.Download; // This downloads the files to {tmp}
 Result := True;
 except
 if DownloadPage.AbortedByUser then
 Log('Aborted by user.')
 else
 SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
 Result := False;
 end;
 finally
 DownloadPage.Hide;
 end;
 end else
 Result := True;
end; 

There are some tests left. And we need a solution how to get the profile in a user friendl way from the API and ship it with a personalized installer.

For our purpose, we need to have a connection on boot to log into Microsoft AD oder ZENWorks and after login the VPN Should be disconnected and the regular EduVPN Clinet should be used. So we though about using a special profile in eduvpn for connecting to AD/ZEN. This profile will be used to generate a wireguard config via AdminAPI. For starting and stopping the wireguard service windows Scheduled Tasks could be used. I created a POC using "Inno Setup" for installing Wireguard, the profile and the service and tasks. The Profile has to be shipped with the installer. ``` [Setup] AppName=EduVPN-Pre-Logon AppVersion=1.5 WizardStyle=modern DefaultDirName={autopf}\EduVPN-Pre-Logon DefaultGroupName=EduVPN-Pre-Logon OutputDir=userdocs:Inno Setup Examples Output PrivilegesRequired=admin [Files] Source: "{tmp}\wireguard-installer.exe"; DestDir: "{app}"; Flags: external; Source: "{src}\profile\evpn.conf"; DestDir: "{app}"; Flags: external ;[Icons] ;Name: "{group}\My Program"; Filename: "{app}\MyProg.exe" [Run] Filename: "{app}\wireguard-installer.exe"; Flags: waituntilterminated Filename: "C:\Program Files\WireGuard\wireguard.exe"; Parameters: "/uninstallmanagerservice"; Flags: waituntilterminated runascurrentuser Filename: "C:\Program Files\WireGuard\wireguard.exe"; Parameters: "/installtunnelservice ""{app}\evpn.conf"""; Flags: runascurrentuser Filename: "schtasks"; \ Parameters: "/Create /SC ONSTART /TN ""StartVPN"" /TR ""sc start WireGuardTunnel$evpn"" /RL HIGHEST" Filename: "schtasks"; \ Parameters: "/Create /SC ONLOGON /TN ""StopVPN"" /TR ""sc stop WireGuardTunnel$evpn"" /RL HIGHEST" [Code] var DownloadPage: TDownloadWizardPage; function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean; begin if Progress = ProgressMax then Log(Format('Successfully downloaded file to {tmp}: %s', [FileName])); Result := True; end; procedure InitializeWizard; begin DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress); DownloadPage.ShowBaseNameInsteadOfUrl := True; end; function NextButtonClick(CurPageID: Integer): Boolean; begin if CurPageID = wpReady then begin DownloadPage.Clear; // Use AddEx to specify a username and password DownloadPage.Add('https://download.wireguard.com/windows-client/wireguard-installer.exe?dontcount=1', 'wireguard-installer.exe', ''); DownloadPage.Show; try try DownloadPage.Download; // This downloads the files to {tmp} Result := True; except if DownloadPage.AbortedByUser then Log('Aborted by user.') else SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK); Result := False; end; finally DownloadPage.Hide; end; end else Result := True; end; ``` There are some tests left. And we need a solution how to get the profile in a user friendl way from the API and ship it with a personalized installer.
Sign in to join this conversation.
No Branch/Tag specified
master
study/no-token-import
ver/3.x
govVPN
ver/3.3.0.x
ver/2.x
ver/1.x
4.6
4.5.99.8
4.5.99.7
4.5.99.6
4.5.99.5
4.5.99.4
4.5.99.3
4.5.99.2
4.5.99.1
4.5.99.0
4.5
4.4.99.4
4.4.99.3
4.4.99.2
4.4.99.1
4.4.99.0
4.4
4.3.99.1
4.3.99.0
4.3.2
4.3.1
4.3
4.2.8
4.2.7
4.2.6
4.2.5
4.2.4
4.2.3
4.2.2
4.2.1
4.2
4.1.7
4.1.6
4.1.5
4.1.4
4.1.3
4.1.2
4.1.1
4.1
4.0
3.255.23
3.255.22
3.255.21
3.255.20
3.255.19
3.7
3.6.2
3.6.1
3.255.18
3.255.17
3.255.16
3.255.15
3.6
3.255.14
3.5
3.255.13
3.4.3
3.255.12
3.255.11
3.255.10
3.255.9
3.255.8
3.255.7
3.255.6
3.255.5
3.255.4
3.255.3
3.255.2
3.4.2
3.4.1
3.255.1
3.255
3.4
3.3.8
3.3.7
3.3.6
3.3.5
3.3.4
3.3.0.1
3.3.3
3.3.2
3.3.1
3.3
3.2.2
3.2.1
3.2
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0
2.255.6
2.255.5
2.255.4
2.255.3
2.255.2
2.255.1
2.1.4
2.255.0
2.1.3
2.1.2
2.1.1
2.1
2.0.7
2.0.6
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0
1.255.11
1.255.10
1.255.9
1.0.39
1.255.8
1.255.7
1.255.6
1.255.5
1.0.38
1.255.4
1.0.37
1.255.3
1.255.2
1.255.1
1.255.0
1.0.36
1.0.34
1.0.35
1.0.33
1.0.32
1.0.31
1.0.30
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
audit/2017-12
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0-alpha8
1.0-alpha6
1.0-alpha5
1.0-alpha4a
1.0-alpha3
1.0-alpha2a
1.0-alpha1
1.0-alpha
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
eduVPN/windows#270
Reference in a new issue
eduVPN/windows
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?