Skip to content

Commit a05d053

Browse files
committed
Adds web UI password field to Dockerfile - master (1 of 2)
Adds a commented-out "auth_token" field to the default configuration file set up by the Dockerfile. This follows on from discussion at [PR310](#310 (comment)). The basic idea is that the web UI should work out-of-the-box but it should also be easy for anyone who wants to add basic security to the web interface to do that (or disable the web UI entirely). Documentation updated to reflect these changes.
1 parent 4d28aa6 commit a05d053

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.templates/zigbee2mqtt/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ FROM koenkk/zigbee2mqtt
66
# 2. enable the web front end on port 8080
77
RUN sed -i.bak \
88
-e 's/mqtt:\/\/localhost/mqtt:\/\/mosquitto/' \
9-
-e '$s/$/\n\nfrontend:\n port: 8080\n/' \
9+
-e '$s/$/\n\nfrontend:\n port: 8080\n# auth_token: PASSWORD\n/' \
1010
/app/configuration.yaml
1111

1212
# EOF

docs/Containers/Zigbee2MQTT.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,47 @@ $ docker exec -it zigbee2mqtt ash
203203
204204
When you want to leave the container, either type `exit` and press return, or press Control-D.
205205

206+
## Setting a password for the web interface
207+
208+
By default, the web interface is unprotected. If you want to set a password:
209+
210+
1. Use `sudo` to edit the active configuration file at the path:
211+
212+
```
213+
~/IOTstack/volumes/zigbee2mqtt/data/configuration.yaml
214+
```
215+
216+
2. Find the following text:
217+
218+
```
219+
frontend:
220+
port: 8080
221+
# auth_token: PASSWORD
222+
```
223+
224+
3. Uncomment the `auth_token` line and replace "PASSWORD" with the password of your choice. For example, to set the password to "mypassword":
225+
226+
```
227+
auth_token: mypassword
228+
```
229+
230+
Note:
231+
232+
* although the name `auth_token` suggests something more complex, it really is no more than a simple *en-clear* password. If this concerns you, consider disabling the web front-end entirely, like this:
233+
234+
```
235+
#frontend:
236+
# port: 8080
237+
# auth_token: PASSWORD
238+
```
239+
240+
4. Save the file and restart the container:
241+
242+
```
243+
$ cd ~/IOTstack
244+
$ docker-compose restart zigbee2mqtt
245+
```
246+
206247
## Container maintenance
207248

208249
Because the Zigbee2MQTT container is built from a Dockerfile, a normal `pull` command will not automatically download any updates released on DockerHub.

0 commit comments

Comments
 (0)