port, acl

- container listener port changed to 1883 and 8883
- acl file renamed to acl.conf
This commit is contained in:
2026-10-05 17:02:00 +03:30
parent 7772e489e0
commit bea370dca2
3 changed files with 19 additions and 12 deletions
+14 -11
View File
@@ -1,6 +1,9 @@
#!/bin/sh
set -e
# every file the script creates is private from the start
umask 077
CONFIG=/config
SHARE=/share/visquitto
PASSWD=/data/passwd
@@ -33,16 +36,16 @@ password_file $PASSWD
persistence true
persistence_location /data/mosquitto/
listener 1993
listener 1883
listener 9993
listener 8883
cafile $CERTDIR/ca.pem
certfile $CERTDIR/cert.pem
keyfile $CERTDIR/key.pem
tls_version tlsv1.2
EOF
cat > "$CONFIG/acl" <<EOF
cat > "$CONFIG/acl.conf" <<EOF
acl_file $CONFIG/accesscontrollist
EOF
@@ -55,8 +58,8 @@ if [ ! -f "$SHARE/mosquitto.conf" ]; then
echo "# Extra Mosquitto options, appended to the default config" > "$SHARE/mosquitto.conf"
fi
if [ ! -f "$SHARE/acl" ]; then
echo "acl_file /share/visquitto/accesscontrollist" > "$SHARE/acl"
if [ ! -f "$SHARE/acl.conf" ]; then
echo "acl_file /share/visquitto/accesscontrollist" > "$SHARE/acl.conf"
fi
if [ ! -f "$SHARE/accesscontrollist" ]; then
@@ -67,9 +70,9 @@ if [ ! -f "$SHARE/accesscontrollist" ]; then
EOF
fi
chown mosquitto:mosquitto "$SHARE/mosquitto.conf" "$SHARE/acl" "$SHARE/accesscontrollist" \
"$CONFIG/acl" "$CONFIG/accesscontrollist"
chmod 600 "$SHARE/acl" "$SHARE/accesscontrollist" "$CONFIG/acl" "$CONFIG/accesscontrollist"
chown mosquitto:mosquitto "$SHARE/mosquitto.conf" "$SHARE/acl.conf" "$SHARE/accesscontrollist" \
"$CONFIG/acl.conf" "$CONFIG/accesscontrollist"
chmod 600 "$SHARE/acl.conf" "$SHARE/accesscontrollist" "$CONFIG/acl.conf" "$CONFIG/accesscontrollist"
chmod 644 "$SHARE/mosquitto.conf"
# ---- Users from the panel ----
@@ -89,10 +92,10 @@ cat "$CONFIG/mosquitto.conf" > "$FINAL"
echo >> "$FINAL"
cat "$SHARE/mosquitto.conf" >> "$FINAL"
echo >> "$FINAL"
if grep -q '^[[:space:]]*acl_file' "$SHARE/acl"; then
cat "$SHARE/acl" >> "$FINAL"
if grep -q '^[[:space:]]*acl_file' "$SHARE/acl.conf"; then
cat "$SHARE/acl.conf" >> "$FINAL"
else
cat "$CONFIG/acl" >> "$FINAL"
cat "$CONFIG/acl.conf" >> "$FINAL"
fi
exec mosquitto -c "$FINAL"