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

Settings > management address Error #52

Closed HonamSong closed 1 year ago

HonamSong commented 1 year ago

Hi! hnhf

image

If you change the Management Address in the Settings field, an error occurs as shown below. There is an address that can be connected normally.

image
bnhf commented 1 year ago

@HonamSong

Getting the Management Interface (MI) setup is something that can trip people up. The first thing you need to do is get the OpenVPN directive for enabling the MI into your server.conf file.

The easiest way to do that is to use Configuration - OpenVPN Config in the WebUI. You need to run through this once in full to get the database setup with your specific values. Many of the default values will be correct, but be sure to update the ones that aren't. Changes are made behind-the-scenes to the way the log file is configured here too.

For a typical installation the Management directive should be set to 172.17.0.1 2080 (note the colon is not used here). This is the address of the default docker gateway, and is the most secure way to communicate between the docker-based WebUI, and a host-based installation of OpenVPN.

Once that's done, and OpenVPN has been restarted or the host server rebooted, you can then update Configuration - Settings with 172.17.0.1:2080, to communicate with OpenVPN via that same default docker gateway.

bnhf commented 1 year ago

@HonamSong

Also, thanks for pointing out the panic.go when using a hostname.domain in this field. Docker can be unreliable resolving hostnames for the host network, which is probably why I rarely test with them -- but we certainly want field data to be gracefully handled. So, I'll put some proper error handling in there.

See my previous comment for how to get things going using the default Docker gateway IP as the address for the Management Interface.

HonamSong commented 1 year ago

@HonamSong

Getting the Management Interface (MI) setup is something that can trip people up. The first thing you need to do is get the OpenVPN directive for enabling the MI into your server.conf file.

The easiest way to do that is to use Configuration - OpenVPN Config in the WebUI. You need to run through this once in full to get the database setup with your specific values. Many of the default values will be correct, but be sure to update the ones that aren't. Changes are made behind-the-scenes to the way the log file is configured here too.

For a typical installation the Management directive should be set to 172.17.0.1 2080 (note the colon is not used here). This is the address of the default docker gateway, and is the most secure way to communicate between the docker-based WebUI, and a host-based installation of OpenVPN.

Once that's done, and OpenVPN has been restarted or the host server rebooted, you can then update Configuration - Settings with 172.17.0.1:2080, to communicate with OpenVPN via that same default docker gateway.

@bnhf Thank you for your confirmation.

But, My problem is below.

  1. Appears normally if the client is not connected.

    image
  2. But, 500Error Return when client connects

    image

And, pivpn-tap-web-ui process log is below.

image
  1. If the client disconnects, the screen will display normally within a few seconds.

    My configuration server.conf => 172.17.0.1 2080 and MI setup config => 172.17.0.1:2080

Do you understand my problem? Is there something I'm missing?

bnhf commented 1 year ago

@HonamSong

The answer is right in your screenshot of the Status page. OpenVPN 2.5.x or higher is required for this WebUI, and you are using 2.4.7:

screenshot-github com-2023 02 27-18_51_11

There are several ways to upgrade OpenVPN if the repository used by your distro installs 2.4.7. You may be able to do it through backports, or check the OpenVPN website for information on your options. 2.5.x includes many enhancements and is well worth installing. 2.6.x is out now too, though I haven't had a chance to test it.

HonamSong commented 1 year ago

@bnhf OK! Thank you so mach! I`ll try Change the version and test.

HonamSong commented 1 year ago

@bnhf After changing the version it displays fine. Thank you so much for your help.