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 password as docker secrets #22

Open m0rtalis opened 3 years ago

m0rtalis commented 3 years ago

Hi, would like to include the mangement api key as docker secret into the container instead of having to expose the password in the environments section of my docker-compose file.

I would imaging using an environments variable like OPENVPNMONITOR_SITES_<INDEX>_PASSWORD_FILE=/run/secrets/mngmt-key to point to the secret.

Since conf.d does not support multiple backends we would need to iterate the environment variables as shown here and call a function like this to expose the correct env-var before calling confd in entrypoint.sh. Also the key should be ignored in confd/templates/openvpn-monitor.conf.tmpl#L25 (or it needs a name not starting with OPENVPNMONITOR_SITES).

https://github.com/ruimarinho/docker-openvpn-monitor/blob/889b78496b58bd3a1484987445da055600c68ec9/confd/templates/openvpn-monitor.conf.tmpl#L24-L26

I can create a PR for this if you want to implement it as suggested.

ruimarinho commented 3 years ago

That would be great, @m0rtalis!

mrquincle commented 3 months ago

How to actually write the password in the environment section? What's the syntax?