Basic Authentication
The basic authentication module lets you protect WUD access using the HTTP Basic authentication standard.
Variables
WUD_AUTH_BASIC_{auth_name}_HASH
Requiredstring
htpasswd-compliant password hash (see htpasswd documentation).
WUD_AUTH_BASIC_{auth_name}_USER
Requiredstring
Username for the authorized user.
Password hashes typically contain
$ characters; make sure to escape or quote them appropriately:- Use double
$$in Docker Compose files (see variable substitution):WUD_AUTH_BASIC_JOHN_HASH: $$apr1$$aefKbZEa$$ZSA5Y3zv9vDQOxr283NGx/ - Use single quotes in shell commands:
WUD_AUTH_BASIC_JOHN_HASH='$apr1$aefKbZEa$ZSA5Y3zv9vDQOxr283NGx/' - Or escape
\$with backslashes in double-quoted strings:WUD_AUTH_BASIC_JOHN_HASH="\$apr1\$aefKbZEa\$ZSA5Y3zv9vDQOxr283NGx/"
Known limitation: Passwords containing colon characters (
:) are not supported due to a limitation in the underlying passport-http library. Authentication will fail if your password contains a colon. Use passwords without colons until this is resolved.Examples
- Docker Compose
- Docker
services:
whatsupdocker:
image: getwud/wud
...
environment:
- WUD_AUTH_BASIC_JOHN_USER=john
- WUD_AUTH_BASIC_JOHN_HASH=$$apr1$$8zDVtSAY$$62WBh9DspNbUKMZXYRsjS/
- WUD_AUTH_BASIC_JANE_USER=jane
- WUD_AUTH_BASIC_JANE_HASH=$$apr1$$5iyu65pm$$m/6I35fjUT7.1CMnS2w9d1
- WUD_AUTH_BASIC_BOB_USER=bob
- WUD_AUTH_BASIC_BOB_HASH=$$apr1$$aefKbZEa$$ZSA5Y3zv9vDQOxr283NGx/
docker run \
-e WUD_AUTH_BASIC_JOHN_USER="john" \
-e WUD_AUTH_BASIC_JOHN_HASH='$apr1$8zDVtSAY$62WBh9DspNbUKMZXYRsjS/' \
-e WUD_AUTH_BASIC_JANE_USER="jane" \
-e WUD_AUTH_BASIC_JANE_HASH='$apr1$5iyu65pm$m/6I35fjUT7.1CMnS2w9d1' \
-e WUD_AUTH_BASIC_BOB_USER="bob" \
-e WUD_AUTH_BASIC_BOB_HASH='$apr1$aefKbZEa$ZSA5Y3zv9vDQOxr283NGx/' \
...
getwud/wud
How to generate a password hash
Using the htpasswd command
htpasswd -nib john doe
# Output: john:$apr1$8zDVtSAY$62WBh9DspNbUKMZXYRsjS/
Using an online generator
You can use an online htpasswd generator like wtools.io.