Closed fablarosa closed 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.
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.
What we should use ? docker run -d -p 80:80 --link openvpn-monitor:openvpn-monitor--name auth beevelop/nginx-basic-auth this one ?
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
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
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?