Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jadolg/vpn2go
Easy setup and API management for OpenVPN server
https://github.com/jadolg/vpn2go
docker-openvpn hacktoberfest openvpn openvpn-server
Last synced: about 2 months ago
JSON representation
Easy setup and API management for OpenVPN server
- Host: GitHub
- URL: https://github.com/jadolg/vpn2go
- Owner: jadolg
- Created: 2020-05-03T16:09:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-20T15:09:46.000Z (about 1 year ago)
- Last Synced: 2024-05-16T11:17:02.401Z (4 months ago)
- Topics: docker-openvpn, hacktoberfest, openvpn, openvpn-server
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 17
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- cuban-opensource - vpn2go
README
# Easy to deploy and manage OpenVPN server
OpenVPN server with an API for user management.
Using this amazing project https://github.com/kylemanna/docker-openvpn## Objective
Using the docker-openvpn is simple and fun, but with time I wanted to automate my user management process and link it to other systems.
The goal of this project is creating a basic configuration for docker-openvpn and an web API to manage the users.## Requirements
- [Docker](https://www.docker.com/)
- [Make](https://www.gnu.org/software/make/manual/html_node/Introduction.html)
- [git](https://git-scm.com/)## How to deploy
1. Clone the project and cd into it
2. Execute `make build` to build the docker images
3. Edit the .env file and adapt the security related variables to your environment with safe values
- SERVICE_USER
- SERVICE_PASSWORD
4. Export the customization variables to your environment
- SERVER_ADDRESS
- CA
5. Customize your server with these extra variables (optional)
- PROTOCOL (default:udp)
- VPN_PORT (default:1194)
- SERVER_SUBNET (default:192.168.253.0/24)
- DNS_SERVER (default:1.1.1.1)
- CLIENT_TO_CLIENT (default:no) Set this to yes if you want the clients to communicate amongst themselves.
- COMPRESSION (default:yes)
6. Execute `make configure` to generate the base OpenVPN configuration
7. Execute `make run` to start the services
8. Open ports 5000/tcp and 1194/udp in your firewall## How to use the API
### List all created certificates
`curl -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000`
output: a list of certificates
### Create a new certificate
`curl -X POST -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000 -d '{"user":"username"}'`
output: a text configuration for openvpn
### Create a new certificate with a fixed ip address
`curl -X POST -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000 -d '{"user":"username", "ip":"192.168.253.5"}'`
output: a text configuration for openvpn
*note:* duplicates for ip address are not being handled. Use this at your own risk.
### Create a new certificate with a specific duration in days (default is 1460)
`curl -X POST -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000 -d '{"user":"username", "duration":"5"}'`
output: a text configuration for openvpn
### Get user configuration
`curl -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000/username`
output: a text configuration for openvpn
### Revoke a certificate
`curl -X DELETE -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000/username`
output: ok
### Get current status log
`curl -u SERVICE_USER:SERVICE_PASSWORD SERVER_ADDRESS:5000/status`
output: an openvpn status log