bnhf / openvpn-admin-plus

Docker-based web interface (with golang backend) for monitoring and admin of an OpenVPN TAP/TUN server setup with PiVPN or other OpenVPN server installations. This project has been renamed from pivpn-tap-web-ui, to reflect its new broader scope.
MIT License
141 stars 23 forks source link

MAPPING ERROR #63

Closed FrancYescO closed 1 year ago

FrancYescO commented 1 year ago

After a fresh install of openvpn/PiVPN on ubuntu22 this is how the dashboard appears:

image

any suggestion to fix the clients count?

bnhf commented 1 year ago

@FrancYescO

any suggestion to fix the clients count?

You need to run through Configuration - OpenVPN Config once, to initialize the database, logging and the management interface.

You can use the server.conf created by PiVPN as a source document for this if you like, and copy and paste. Many of the directives will already be correct, but update the ones that need to be updated -- save the new config, and then restart OpenVPN or reboot your server.

After that, you can update Configuration - Settings with the Management Interface Address (as set in your just updated server.conf), and your Server Address External.

FrancYescO commented 1 year ago

Oh ok thanks now i see the path... pretty tricky and risky let me say: initially i was hoping that this webui will take care of in-place editing the server.conf file instead, correct me if i'm wrong, basicallly it will just generate an "hardcoded one" from 0 on first start, and on save will replace the one on the server (so there is a risk you will lose all the config, and you lose the possibility of manually edit server.conf...)

btw in my case the issue as you said was the management interface... Default is: openvpn:2080 in settings page and 172.17.0.1 2080 in openvpn settings page

maybe at least these should be unified on default config

bnhf commented 1 year ago

@FrancYescO

The server.conf file is replaced after you enter your desired directives, which can be taken from the server.conf file PiVPN creates or not. Several other needed directives are automatically added to setup the Management Interface and logging. Once you've done this once, the database and the server.conf file will be synchronized.

Manually editing the server.conf file once you begin using this WebUI would not be recommended or desirable. And yes, it's a good idea to keep a backup of your server.conf file whether you're using this interface or not.

The default of openvpn:2080 is used as you don't want to point to a non-existent management interface, so it's important to do the server.conf config first, and restart OpenVPN so that the interface actually exists first, before changing to the Docker gateway address.

bnhf commented 1 year ago

@FrancYescO

And, one other point I forgot to make, is that the initial config also sets several directives that are used in the creation of client configs. So, it's not just for changes to server.conf -- it has multiple purposes.

FrancYescO commented 1 year ago

before changing to the Docker gateway address

hmmm so maybe put host.docker.internal as default?

btw got it, unfortunately in my case i have to keep the "backward compatibility" of directly editing the server.conf, so this kind of inizialization is a little limitative