Easy to use openvpn server with a all-in-one configuration script
1.2K
This project let you create a OpenVPN server onto a machine (PC or even just a simple RaspberryPi), and connect to it from outside your network using your laptop or mobile phone giving you access to all resources into your local network with less than 11Mb.
You will need a machine to act as a VPN server inside your network, and the clients you wanna get connected to your network. Also you will need to generate the certificates and keys to get the clients been identified at the server.
This Docker image will provide you:
The first step is to generate all configuration files and keys, you can do it with the wizard 'openvpn_configure.sh'. I strongly recommend you to create this stuff at your laptop, because the generation of the keys takes lot of time at the RaspberryPi. So you can generate the configuration at your PC and later use that configuration files at the RaspberryPi.
The wizard will let you generate all configuration files easily, you just need to follow the instructions to provide:
You can launch the configuration wizard with the command below, you just need to provide a volume (mounted onto /mnt) with the path where the files will be saved:
docker run -it --name configuration --rm -v /path_to_folder/where_save/config:/mnt eidansoft/openvpn openvpn_configure.sh
The wizard will configure the following files:
openvpn_client.conf file will set the domain and the port you want
to use for your server.ca_conf.properties file will set the values for the CA, like your
city, company name, mail, etc. Also here is the size of the keys to be used.
If you don't provide a value, then the default one will be used, 4096.And also it will call the scripts to generate all keys:
Initialize the OpenVPN server certificates, keys and configurations.
openvpn_server_init.sh <SERVER_NAME>
Initialize the OpenVPN CA certificates and keys.
openvpn_ca_init.sh <SERVER_NAME>
Initialize the OpenVPN Client certificates, keys and configuration files.
openvpn_client_init.sh <CLIENT_NAME>
The last step of the wizard is to generate the Client keys and configuration files, for this step you only need to provide a name to identify it. And you can create as many clients as you need.
Once the wizard finished you have all needed files generated and saved at the volume you set before. To be specific, you will have four folders:
So in summary, you only need to copy to your RaspberryPi the files_openvpn folder.
You can do this easely with scp, for example:
$ scp -r /path/to/files_openvpn pi@raspberryIP:/home/pi
Once you have the files_openvpn folder at your VPN Server machine, you are ready
to start the VPN service. You can start it directly with below command:
sudo docker run -d --name openvpn --privileged -v /PATH/TO/files_openvpn:/mnt -p 1194:1194/udp --restart unless-stopped eidansoft/openvpn
If you prefer to start the service with a docker-compose is also possible:
version: '3.5'
vpn:
container_name: vpn
image: eidansoft/openvpn
privileged: true
restart: unless-stopped
ports:
- "1194:1194/udp"
volumes:
- "/PATH/TO/files_openvpn/:/mnt/files_openvpn/"
The logs are available with:
sudo docker logs openvpn
sudo docker rm -f openvpn
You can create as much clients as you need (if you have the configuration already created), just call the client generator script passing it the name to identify your new client.
docker run -it --name configuration --rm -v /PATH/TO/ALL/CONFIG_FOLDERS:/mnt eidansoft/openvpn openvpn_client_init.sh <CLIENT_NAME>
I have suffered some issues when the VPN Server is running on a RaspberryPi connected through WiFi. The problem got fixed when you use TCP instead UDP. So if you wanna run the VPN Server into a machine connected by WiFi, choose TCP at the configurations steps.
Content type
Image
Digest
Size
5.6 MB
Last updated
over 6 years ago
docker pull eidansoft/openvpn