Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: build a script for Windows server #21

Closed
MrSaeid007 opened this issue Jul 25, 2023 · 2 comments
Closed

Feature Request: build a script for Windows server #21

MrSaeid007 opened this issue Jul 25, 2023 · 2 comments

Comments

@MrSaeid007
Copy link

MrSaeid007 commented Jul 25, 2023

Hi.

Can you guys build a simple web UI for Windows server users too to set up OpenVPN in the Windows server?

Thanks.

@MrSaeid007
Copy link
Author

This step may help.

#!/bin/bash

Define the URLs for the OpenVPN installer and the Easy-RSA ZIP archive
openvpnInstallerUrl="https://openvpn.net/community-downloads/"
easyRsaZipUrl="https://github.com/OpenVPN/easy-rsa-old/archive/refs/tags/v2.3.3.zip"

Set up temporary directories for the installer and Easy-RSA
tmpDir=$(mktemp -d)
openvpnInstallerPath="$tmpDir/openvpn-install.exe"
easyRsaZipPath="$tmpDir/easy-rsa.zip"
easyRsaDir="$tmpDir/easy-rsa"

Download the OpenVPN installer and Easy-RSA ZIP archive
curl -L -o "$openvpnInstallerPath" "$openvpnInstallerUrl"
curl -L -o "$easyRsaZipPath" "$easyRsaZipUrl"

Install OpenVPN silently with default options
cmd.exe /C "$openvpnInstallerPath /S"

Extract the Easy-RSA ZIP archive
unzip -q "$easyRsaZipPath" -d "$tmpDir"

Move the Easy-RSA directory to the OpenVPN installation folder
mv "$tmpDir/easy-rsa-old-2.3.3" "/c/Program Files/OpenVPN/easy-rsa"

Navigate to the Easy-RSA directory
cd "/c/Program Files/OpenVPN/easy-rsa"

Run the initialization script to set environment variables
cmd.exe /C "vars.bat"

Clean any existing keys
cmd.exe /C "clean-all"

Build the Certificate Authority (CA)
cmd.exe /C "build-ca"

Generate the server key and certificate
cmd.exe /C "build-key-server your_server_name"

Generate Diffie-Hellman parameters (used for key exchange)
cmd.exe /C "build-dh"

Replace 'C:\path\to\server.ovpn' with the actual path to your server configuration file
serverConfigPath="C:\path\to\server.ovpn"

Copy the server configuration file to the config directory
cp "$serverConfigPath" "/c/Program Files/OpenVPN/config/"

Start the OpenVPN service
cmd.exe /C "openvpn-gui --command connect 'your_server_name'"

@theonemule
Copy link
Owner

This would require almost a full rewrite. The UI is based on shell scripting, so I am not sure how I would accomplish that. Use a Linux VM as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants