Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
windows-vm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pem
windows-vm
Commits
7f208845
Commit
7f208845
authored
Apr 23, 2025
by
César Galvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: generate client.conf file for wireguard
parent
11270155
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
WireguardInstall.ps1
src/scripts/ps/WireguardInstall.ps1
+16
-1
No files found.
src/scripts/ps/WireguardInstall.ps1
View file @
7f208845
...
@@ -19,7 +19,8 @@ Start-Sleep -Seconds 10
...
@@ -19,7 +19,8 @@ Start-Sleep -Seconds 10
$wgPath
=
"C:\Program Files\WireGuard"
$wgPath
=
"C:\Program Files\WireGuard"
$configPath
=
"
$wgPath
\Configurations"
$configPath
=
"
$wgPath
\Configurations"
$serverConfigFile
=
"
$configPath
\server.conf"
$serverConfigFile
=
"
$configPath
\server.conf"
$outputPath
=
"C:\vagrant\files\wireguard"
$outputPath
=
"C:\vagrant\files\WireGuard"
$clientConfigFile
=
"
$outputPath
\client.conf"
# Create configuration and output folders if it doesn't exist
# Create configuration and output folders if it doesn't exist
New-Item
-ItemType Directory -Force -Path
$configPath
New-Item
-ItemType Directory -Force -Path
$configPath
...
@@ -56,6 +57,19 @@ PublicKey = $clientPublicKey
...
@@ -56,6 +57,19 @@ PublicKey = $clientPublicKey
AllowedIPs = 10.10.0.2/32
AllowedIPs = 10.10.0.2/32
"
@ |
Out-File
$serverConfigFile
-Encoding ascii
"
@ |
Out-File
$serverConfigFile
-Encoding ascii
# Create the WireGuard client configuration
@
"
[Interface]
PrivateKey =
$clientPrivateKey
Address = 10.10.0.2/24
[Peer]
PublicKey =
$serverPublicKey
Endpoint = windows-vpn.local:51820
AllowedIPs = 192.168.11.0/24
PersistentKeepalive = 25
"
@ |
Out-File
$clientConfigFile
-Encoding ascii
# Install the tunnel as a Windows service
# Install the tunnel as a Windows service
&
"
$wgPath
\wireguard.exe"
/installtunnelservice
$serverConfigFile
&
"
$wgPath
\wireguard.exe"
/installtunnelservice
$serverConfigFile
...
@@ -66,6 +80,7 @@ New-NetFirewallRule -DisplayName "WireGuard VPN" -Direction Inbound -Action Allo
...
@@ -66,6 +80,7 @@ New-NetFirewallRule -DisplayName "WireGuard VPN" -Direction Inbound -Action Allo
# Output server info
# Output server info
Write-Host
"WireGuard server has been configured and started."
Write-Host
"WireGuard server has been configured and started."
Write-Host
"Keys saved to:
$outputPath
\generated-keys.json"
Write-Host
"Keys saved to:
$outputPath
\generated-keys.json"
Write-Host
"Client config saved to:
$outputPath
\client.conf"
# Add shortcuts
# Add shortcuts
## Get the desktop path for the current user
## Get the desktop path for the current user
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment