Skip to content

Commit 2f66253

Browse files
committed
2023-10-09 Mosquitto entry-point script - old-menu branch - PR 2 of 2
The folder structure for a newly-created or self-repaired persistent store assumes ownership of id 1883 (which is "mosquitto" inside the container) and file/folder modes copied from the `iotstack_defaults` folder hierarchy. Investigations during SensorsIot#731 revealed that Mosquitto now wants the password file to be owned by root with a mode of 600. Although the mode requirement could be accommodated by changing the `iotstack_defaults` structure, the ownership requirement can't be met that way. This fix adds the necessary `chown` and `chmod` commands to the entry-point script. Signed-off-by: Phill Kelley <[email protected]>
1 parent 64c6270 commit 2f66253

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

.templates/mosquitto/docker-entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/ash
22
set -e
33

4+
PWFILE="/mosquitto/pwfile/pwfile"
5+
46
# Set permissions
57
user="$(id -u)"
68
if [ "$user" = '0' -a -d "/mosquitto" ]; then
@@ -9,8 +11,13 @@ if [ "$user" = '0' -a -d "/mosquitto" ]; then
911

1012
rsync -arpv --ignore-existing /${IOTSTACK_DEFAULTS_DIR}/ "/mosquitto"
1113

14+
# general ownership assuming mode as set in template
1215
chown -Rc mosquitto:mosquitto /mosquitto
1316

17+
# specific requirements for the password file
18+
chown -c root:root "$PWFILE"
19+
chmod -c 600 "$PWFILE"
20+
1421
echo "[IOTstack] end self-repair"
1522

1623
fi

0 commit comments

Comments
 (0)