docker-tools
docker-tools copied to clipboard
Fix NUT Issues 74, 75: Allow forgoing Docker secrets and fix permissions of custom configs
Fixes issue #74 by checking to ensure that "/run/secrets/$SECRET" is readable before attempting to do so; if it isn't, then assume that someone (unwisely) put the actual secret in the SECRET environment variable. It's possible that they didn't: they might be using custom configuration files. If this is the case, no-harm is done with this assumption.
Fixes issue #75 by explicitly setting each copied file's owner, group, and permissions to the same as the original file being replaced. The original issue is caused because entrypoint.sh is run by root, causing the copied upsd.users file to be owned by root:root; this isn't readable by upsd when it drops permissions to run as the nut user.