Skip to content

Commit b7c1e4a

Browse files
authored
v5.0.16 (#118)
Minor updates * Adding basic HTTP auth support (`nginx-adduser`)
1 parent a03db3b commit b7c1e4a

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.15
1+
5.0.16
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
auth_basic "Please enter a username and password.";
2+
auth_basic_user_file htpasswd;

overlay/usr/bin/bf/nginx-adduser

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/command/with-contenv sh
2+
3+
set -euo pipefail
4+
export BF_E=`basename ${0}`
5+
6+
7+
#======================================================================================================================
8+
# Check variables.
9+
#======================================================================================================================
10+
11+
[[ -z "${1-}" ]] && bf-error "You must pass a username." "nginx-adduser"
12+
USER="${1}"
13+
14+
[[ -z "${2-}" ]] && bf-error "You must pass a password." "nginx-adduser"
15+
PASS="${2}"
16+
17+
18+
#======================================================================================================================
19+
# Add a user for basic HTTP auth.
20+
#======================================================================================================================
21+
22+
bf-echo "Adding user ${USER} with encrypted password..." "nginx-adduser"
23+
printf "${USER}:$(openssl passwd -apr1 ${PASS})\n" >> /etc/nginx/htpasswd
24+
bf-done

0 commit comments

Comments
 (0)