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
1a34c9e6
Commit
1a34c9e6
authored
Apr 09, 2025
by
César Galvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: added script for wireguard install and setup
parent
e0e33dc4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
3 deletions
+74
-3
Vagrantfile
Vagrantfile
+2
-0
ChocolateyInstallPackages.ps1
src/scripts/ps/ChocolateyInstallPackages.ps1
+2
-3
WireguardSetup.ps1
src/scripts/ps/WireguardSetup.ps1
+70
-0
No files found.
Vagrantfile
View file @
1a34c9e6
...
...
@@ -36,6 +36,8 @@ Vagrant.configure("2") do |config|
config
.
vm
.
provision
"shell"
,
path:
"src/scripts/ps/ChocolateyInstall.ps1"
## Install Chocolatey packages
config
.
vm
.
provision
"shell"
,
path:
"src/scripts/ps/ChocolateyInstallPackages.ps1"
## Wireguard Install and setup
config
.
vm
.
provision
"shell"
,
path:
"src/scripts/ps/WireguardSetup.ps1"
## Change timezone
config
.
vm
.
provision
"shell"
,
inline:
<<-
SHELL
Write-Output "=== Change timezone ==="
...
...
src/scripts/ps/ChocolateyInstallPackages.ps1
View file @
1a34c9e6
choco install forticlientvpn --yes
choco install squid --yes
\ No newline at end of file
choco install forticlientvpn --yes
\ No newline at end of file
src/scripts/ps/WireguardSetup.ps1
0 → 100644
View file @
1a34c9e6
# Wireguard setup
# install-wireguard.ps1
# Define download URL for WireGuard official MSI installer
$wgInstallerUrl
=
"https://download.wireguard.com/windows-client/wireguard-installer.exe"
$installerPath
=
"
$env
:TEMP\wireguard-installer.exe"
# Download the installer
Write-Host
"Downloading WireGuard from official site..."
Invoke-WebRequest
-Uri
$wgInstallerUrl
-OutFile
$installerPath
# Run the installer silently
Write-Host
"Installing WireGuard..."
Start-Process
-FilePath
$installerPath
-ArgumentList
"/install /quiet"
-Wait
# Wait for the installation to complete
Start-Sleep
-Seconds 10
# Set paths
$wgPath
=
"C:\Program Files\WireGuard"
$configPath
=
"
$wgPath
\Configurations"
$serverConfigFile
=
"
$configPath
\server.conf"
$outputPath
=
"C:\vagrant\files\wireguard\Configurations"
# Create configuration and outpot folders if it doesn't exist
New-Item
-ItemType Directory -Force -Path
$configPath
New-Item
-ItemType Directory -Force -Path
$outputPath
# Generate server key pair
$serverPrivateKey
=
&
"
$wgPath
\wg.exe"
genkey
$serverPublicKey
=
$serverPrivateKey
| &
"
$wgPath
\wg.exe"
pubkey
# Generate client key pair (you can extract and use this later)
$clientPrivateKey
=
&
"
$wgPath
\wg.exe"
genkey
$clientPublicKey
=
$clientPrivateKey
| &
"
$wgPath
\wg.exe"
pubkey
# Save the keys for later (optional)
$keysOutput
=
@
"
{
"
Server Private Key
": "
$serverPrivateKey
",
"
Server Public Key
": "
$serverPublicKey
",
"
Client Private Key
": "
$clientPrivateKey
",
"
Client Public Key
": "
$clientPublicKey
"
}
"
@
$keysOutput
|
Out-File
"
$outputPath
\generated-keys.json"
# Create the WireGuard server configuration
@
"
[Interface]
PrivateKey =
$serverPrivateKey
Address = 10.10.0.1/24
ListenPort = 51820
[Peer]
PublicKey =
$clientPublicKey
AllowedIPs = 10.10.0.2/32
"
@ |
Out-File
$serverConfigFile
-Encoding ascii
# Install the tunnel as a Windows service
&
"
$wgPath
\wireguard.exe"
/installtunnelservice
$serverConfigFile
# Optionally open the UDP port in Windows Firewall
New-NetFirewallRule
-DisplayName
"WireGuard VPN"
-Direction Inbound -Action Allow
`
-Protocol UDP -LocalPort 51820
# Output server info
Write-Host
"WireGuard server has been configured and started."
Write-Host
"Keys saved to:
$outputPath
\generated-keys.json"
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