ruimarinho / docker-openvpn-monitor

The trusted multi-platform web-based OpenVPN Monitor docker image.
MIT License
101 stars 27 forks source link

Add support for digest authentication #12

Closed fablarosa closed 4 years ago

fablarosa commented 4 years ago

The openvpn-monitor mini-site is visible by everyone right now and this poses serious privacy and security issues in large companies like mine (I work for a university).
Other similar projects like auspexeu/openvpn-status support http basic authentication.
Could you please add this feature or point me the right direction so that I can eventually try myself and contribute to this project?

ruimarinho commented 4 years ago

It's quite simple to add basic auth via a server like nginx. If you want something out of the box:

docker run -d --name web ruimarinho/openvpn-monitor
docker run -d -p 80:80 --link web:web --name auth beevelop/nginx-basic-auth

Then you can login with username foo and password bar. I don't know if this would be the best image to run but it's an example of how you can do it. Hope this helps.

fablarosa commented 4 years ago

Ok thanks I'll give it a try. I'm relatively new to containers so I was doing it the old way, installing apache2 to use it as a reverse proxy with digest auth, but a nginx container-based solution is better.

emoxam commented 1 year ago

What we should use ? docker run -d -p 80:80 --link openvpn-monitor:openvpn-monitor--name auth beevelop/nginx-basic-auth this one ?

emoxam commented 1 year ago

Or this one ?

docker run -d \
           -e HTPASSWD='remote:$apr1$7dGgNNuG$VfPfwHBIdn4BJb3f5hgG1/' \
           -e FORWARD_PORT=5555 \
           --link openvpn-monitor:openvpn-monitor -p 80:80 \
           --name auth \
           beevelop/nginx-basic-auth
fablarosa commented 1 year ago

This is how i did it, please notice that the password protected container is available on port 8000:

creds=$(htpasswd -n monitoruser)
# enter the password you want to use

docker run --name openvpn-monitor \
  --restart always \
  -d -p 127.0.0.1:80:80 \
  ruimarinho/openvpn-monitor

docker run --name web-auth \
  -e HTPASSWD="$creds" \
  --link openvpn-monitor:web \
  --restart always \
  -d -p 8000:80 \
  beevelop/nginx-basic-auth