Administrate OpenVPN user and connections with Web UI in single server.
- OpenVPN auto-setup
- User management dashboard
OpenVPN server have provide management terminal and callback scripts when client event occured. In this project, use below commands and callbacks.
- kill cn: Force disconnect user
- auth-user-pass-verify: User auth
- client-connect: connection log
- client-disconnect: disconnection log
Tested only Ubuntu 18.04, so it can be broken other version of Linux.
- Stable Linux distribution which support IPv4 forwarding like Ubuntu or Debian.
- Two open ports which can accessed by Internet IP. One port for OpenVPN, the other for WebUI.
- Not configured OpenVPN
- Python3
- NodeJS(>= 8.x)
-
Make sure requirements were installed
# apt install git python3 python3-pip openvpn npm
-
Clone the project
$ git clone https://github.com/StdCarrot/iamovpn.git $ cd iamovpn
-
Setup config
$ cp config.json.dist config.json
You must change
secret
andopenvpn.host
.If you want to set custom route, append subnet information like below to
openvpn.routes
:{ "network": "172.16.0.0", "netmask": "255.255.255.0" }
If you set
openvpn.redirect_gateway
asfalse
, Internet traffic will not pass through VPN. -
(Optional) Prepare database
Create user and database and make db connection url and set itdb_url
in config.json.
See also: https://docs.sqlalchemy.org/en/13/faq/connections.html -
(Optional) Init virtualenv
# apt install virtualenv $ virtualenv -p python3 env $ source env/bin/activate
-
Install python libraries
$ pip3 install -r requirements.txt
-
Install IAMOVPN with root permission In this process, you may enter information to generate RSA keys.
# python3 iamovpn install --config <path/to/config.json>
If you use virtualenv, follow this:
# <path/to/env>/bin/python3 iamovpn install --config <path/to/config.json>
-
(Optional) Build reverse proxy with nginx or apache2. And all tsl layer for https.
See also: https://certbot.eff.org/instructionsIf you build reverse proxy, MUST check /etc/openvpn/scripts/util.py.
You may modifyapi_host
's port information. -
Start server.
# systemctl restart openvpn@server $ python3 iamovpn run standalone --config <path/to/config.json>
You can use gunicorn or uWSGI to serving and also register as service.
-
Open Web UI In browser, go
http://<yout host ip>/
Login default account:- ID: admin
- Password: need2change
MUST change password as soon as possible.
IAMOVPN api server MUST BE RUN while using vpn.
User authorization and connection logging uses apis.
- Force disconnect client
- Server utilization view
- Docker compose