diff --git a/VERSION b/VERSION index df697be..14bfa85 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.0.15 \ No newline at end of file +5.0.16 \ No newline at end of file diff --git a/overlay/etc/nginx/helpers/nginx-auth.conf b/overlay/etc/nginx/helpers/nginx-auth.conf new file mode 100644 index 0000000..30e195a --- /dev/null +++ b/overlay/etc/nginx/helpers/nginx-auth.conf @@ -0,0 +1,2 @@ +auth_basic "Please enter a username and password."; +auth_basic_user_file htpasswd; \ No newline at end of file diff --git a/overlay/usr/bin/bf/nginx-adduser b/overlay/usr/bin/bf/nginx-adduser new file mode 100644 index 0000000..ba9319f --- /dev/null +++ b/overlay/usr/bin/bf/nginx-adduser @@ -0,0 +1,24 @@ +#!/command/with-contenv sh + +set -euo pipefail +export BF_E=`basename ${0}` + + +#====================================================================================================================== +# Check variables. +#====================================================================================================================== + +[[ -z "${1-}" ]] && bf-error "You must pass a username." "nginx-adduser" +USER="${1}" + +[[ -z "${2-}" ]] && bf-error "You must pass a password." "nginx-adduser" +PASS="${2}" + + +#====================================================================================================================== +# Add a user for basic HTTP auth. +#====================================================================================================================== + +bf-echo "Adding user ${USER} with encrypted password..." "nginx-adduser" +printf "${USER}:$(openssl passwd -apr1 ${PASS})\n" >> /etc/nginx/htpasswd +bf-done