• Stars
    star
    228
  • Rank 175,267 (Top 4 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A setup script and simple web UI for setting up an OpenVPN Server

Simple OpenVPN Server

OpenVPN is a one of the most popular VPN platforms for a lot of good reasons. It's free, open source, and there are clients for just about every platform imaginable. For these reasons, OpenVPN is the choice for organizations and individuals alike.

There are dedicated appliances for OpenVPN that work well for enterprises, but for smaller organizations and individuals, these are overkill. This little project grew out of a desire to create a simple, web based UI for managing OpenVPN while as well as creating a fully automated installer of the the software on a rather lower-powered Linux host, such as an entry level VM on Azure, a Virtual Private Server (VPS) or even a container.

A special thanks goes out to the folks behind openvpn-install for their wonderful project, which serves as an interactive installer on the command line. Much of the heavy lifting for the installer here is from the script there.

The scripts assumes that there is NOT an instance of OpenVPN already installed on the machine and that port 443 is not in use by another web server for HTTPS. Likewise, this script was built for current Debian/Ubuntu distros.

Installing OpenVPN

Optionally, you can do a completely automated deployment to Azure and skip past the installation to Managing Clients.

Otherwise, use the installer:

  1. Pull up a terminal or SSH into the target server.

  2. Logon as root

    sudo -i
    
  3. Download the installer script.

    wget https://raw.githubusercontent.com/theonemule/simple-openvpn-server/master/openvpn.sh
    
  4. Make the script executable

    chmod +x openvpn.sh
    
  5. Run the script.

    ./openvpn.sh [options]
    

    Example:

    ./openvpn.sh --adminpassword=mypassword --host=myvpn.example.com
    

    There are number of options the script will accept

    adminpassword -- This is the admin password for the website for managing clients. The default is password.

    dns1 -- The first dns server assigned to the clients. The default is 8.8.8.8.

    dns2 -- The first dns server assigned to the clients. The default is 8.8.4.4.

    vpnport -- The port to be used by OpenVPN. 1194 may be blocked by some firewalls, so this is customizable. The default port is 1194.

    protocol -- The protocol to be used by OpenVPN. This accepts udp or tcp. The default is udp.

    protocol -- The email to be used by NGINX for Let's Encrypt.

    host -- The host name of the server. The script attempts to detect the external IP of your server if the host is not specified. It is highly recommended that you use a host name if your sever is not using a static IP address. You can get a free dynamic DNS account and use a dynamic DNS updater that keeps the DNS records for your server up to date in the event that your IPa address changes.

  6. Let the installer finish. This may take a few minutes, as the intaller generates a few keys to set up a certificate authority (CA) that is used to assign certificates to the clients.

  7. If the server you are installing this on is behind a firewall, be sure that you forward the external ports from the firewall to the ports on the server for the VPN. Optionally, if you want to be able to manage the VPN from outside the firewall, forward a port to 443 on the VPN Server.

Managing Profiles

  1. Once the script is complete, point your browser to https://[your host or IP]/, where your host or IP is the host name or IP addressed for the VPN. You may get an error about the site not being secure even though you are using https. This is because the site is using a self-esigned certificate. Simply ignore the warning.

  2. Logon to the admin site. Use admin for the username and the password used for the adminpassword option when the installer was run. If you did not supply one, use password.

    Logon

  3. Once logged on, enter a name for the client and click Add.

    Add a client

  4. Once added, you can click Revoke to revoke access or Download to download the client profile.

    Revoke or Download

Connecting to the Server

Once the profile is downloaded you need to configure a client:

  • Windows: use OpenVPN GUI. After installing the app, copy the .ovon to the C:\Program Files\OpenVPN\config folder. Launch the GUI from your Start menu, then right click the icon in the Tool Tray, then click Connect. Disconnect by right clicking and selecting Disconnect.

  • MacOS (OS X): use Tunnelblick. Download and install Tunnelblick. After downloading, double-click on the downloaded .ovpn file and import the configuration either for yourself or all users. Once imported, click the Tunnleblick icon on the menu bar and click Connect. Disconnect by clicking the Tunnelblick icon and selecting Disconnect.

  • Android: use OpenVPN Connect for Android. Download and install the app. Next, go to the admin site and create and/or download a profile. In the app, select Import from the menu, then select Import, then select Import Profile from SD card. Find the profile in your Downloads folder and import the profile. Once downloaded, click Connect. To disconnect, open the app again and select Disconnect.

  • iOS: use OpenVPN Connect for iOS. Install the app, then browse to the admin site in Safari. Create and/or download a profile. After the profile is downloaded, select Open in Open VPN. Install the profile, then select Connect to connect to the VPN. To disconnect, open the app again and select Disconnect.

That's it! Your VPN is up and running.

More Repositories

1

docker-waf

An NGINX and ModSecurity based Web Application Firewall for Docker
Dockerfile
257
star
2

no-ip

A shell script that works as Dynamic Update Client (DUC) for noip.com
Shell
119
star
3

dos-game

A Dockerfile for running Docker based DosBox games streamed to a browser client.
JavaScript
77
star
4

docker-dynamic-dns

A tiny Docker based dynamic DNS client for Duck DNS, NO-IP, and DynDNS
Shell
41
star
5

dockercon-demos

C#
39
star
6

nginx-rtmp

A containerize NGINX server with the RTMP plugin to allow live streams to multiple providers such as Twitch, Facebook, or YouTube simultaneously from a single source.
Shell
38
star
7

aks-demos

Azure Kubernetes Services (AKS) Demos
JavaScript
28
star
8

retroarch-docker

A Docker container for hosting RetroArch playable in a browser through NoVNC.
JavaScript
26
star
9

docker-opengl-turbovnc

A dockerfile for OpenGL with TurboVNC -- Readme forthcoming.
24
star
10

gphoto-webui

A PHP Web UI for gphoto2
JavaScript
23
star
11

docker-proxy-server

Docker Proxy Server With Content Filter Built on Squid and SquidGuard
Shell
16
star
12

x86box-docker

A container image for running x86box in a Docker container and streaming the results back to the browser.
JavaScript
14
star
13

qemu-docker

Run VMs in a Docker Container and Connect To Them With a Browser!
JavaScript
12
star
14

azure-blog-storage-ftp-server

An virtual machine based front end to supply SFTP services for Azure Blob Storage
HCL
12
star
15

fahclient-azure-vm

Installs a VM to run the Folding@Home client on a Linux VM on Azure
Shell
11
star
16

blobcaster

Blobcaster: Using Azure Blob Storage to Host a Podcast
HTML
11
star
17

tagging-samples

Sample Azure Policies to enforce tagging on resources.
6
star
18

azure-function-captcha

An Azure Function implementing a CAPTCHA with logging and email.
HTML
6
star
19

jekyll-paypal-cart

An eCommerce Site Using Jekyll and PayPal.
JavaScript
5
star
20

nextcloud-azure

Automated deployments scripts for Nextcloud on Azure using Blob Storage
Shell
5
star
21

macos-docker

Run a MacOS (OSX) Virtual Machine in a Docker Container
Shell
4
star
22

llmworkshop

A repo for cpde and slides for the LLM workshop.
HTML
3
star
23

psrd

A remote desktop client/server app implemented in PowerShell
PowerShell
2
star
24

azure-iot-architecture

JavaScript
2
star
25

azure-gaming-pc

An ARM Template for creating a remote gaming PC on Azure!
2
star
26

JekyllManager

A Lightweight Manager for Jekyll-based websites
HTML
1
star
27

graph-api-sample

Sample Code for Cosmos DB Graph API https://youtu.be/98PtbE4f4B8
C#
1
star
28

jitsi-install

A Shell Script to setup Jitsi on Ubuntu 22.04 with an Azure ARM Template
Shell
1
star
29

ce2c

Python
1
star
30

dailydadjokes

The GitHub backend for Daily Dad Jokes 4U -- a personal learning exercise in GH Actions and GH Pages.
HTML
1
star
31

python-lab

Source code for a Python Lab with Visual Studio Code
HTML
1
star
32

web-pubsub-demo

A demo app for Azure Web Pub Sub
HTML
1
star
33

llm-workshop

Python
1
star
34

nl2sql

A quick demo on how to translate natural language to SQL queries using GPT.
Python
1
star