|
|
|
@@ -34,18 +34,22 @@ chmod 600 "$CERTDIR/key.pem"
|
|
|
|
|
|
|
|
|
|
# ---- Defaults in /config (regenerated at every start) ----
|
|
|
|
|
cat > "$CONFIG/mosquitto.conf" <<EOF
|
|
|
|
|
log_dest stdout
|
|
|
|
|
log_type error
|
|
|
|
|
log_type warning
|
|
|
|
|
log_type notice
|
|
|
|
|
$(jq -r '.log_dest[]? | "log_dest \(.)"' /data/options.json)
|
|
|
|
|
$(jq -r '.log_type[]? | "log_type \(.)"' /data/options.json)
|
|
|
|
|
log_timestamp_format %Y-%m-%d %H:%M:%S
|
|
|
|
|
|
|
|
|
|
persistence true
|
|
|
|
|
persistence_location $DATA/
|
|
|
|
|
max_queued_messages 8192
|
|
|
|
|
|
|
|
|
|
plugin_load acl_file /usr/lib/mosquitto_acl_file.so
|
|
|
|
|
plugin_load password_file /usr/lib/mosquitto_password_file.so
|
|
|
|
|
plugin_load passwd /usr/lib/mosquitto_password_file.so
|
|
|
|
|
plugin_opt_password_file $PASSWD
|
|
|
|
|
|
|
|
|
|
plugin_load acl_plain /usr/lib/mosquitto_acl_file.so
|
|
|
|
|
plugin_opt_acl_file $DATA/acl_plain
|
|
|
|
|
|
|
|
|
|
plugin_load acl_tls /usr/lib/mosquitto_acl_file.so
|
|
|
|
|
plugin_opt_acl_file $DATA/acl_tls
|
|
|
|
|
|
|
|
|
|
include_dir $SHARE
|
|
|
|
|
|
|
|
|
@@ -53,10 +57,8 @@ include_dir $SHARE
|
|
|
|
|
listener 1883
|
|
|
|
|
protocol mqtt
|
|
|
|
|
allow_anonymous false
|
|
|
|
|
plugin_use password_file
|
|
|
|
|
plugin_opt_password_file $PASSWD
|
|
|
|
|
plugin_use acl_file
|
|
|
|
|
plugin_opt_acl_file $DATA/acl_plain
|
|
|
|
|
plugin_use passwd
|
|
|
|
|
plugin_use acl_plain
|
|
|
|
|
|
|
|
|
|
# TLS listener (host port 9993): client certificate required
|
|
|
|
|
listener 8883
|
|
|
|
@@ -68,10 +70,8 @@ keyfile $CERTDIR/key.pem
|
|
|
|
|
tls_version tlsv1.2
|
|
|
|
|
require_certificate true
|
|
|
|
|
use_identity_as_username true
|
|
|
|
|
plugin_use password_file
|
|
|
|
|
plugin_opt_password_file $PASSWD
|
|
|
|
|
plugin_use acl_file
|
|
|
|
|
plugin_opt_acl_file $DATA/acl_tls
|
|
|
|
|
plugin_use passwd
|
|
|
|
|
plugin_use acl_tls
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# plain ACL
|
|
|
|
@@ -101,6 +101,7 @@ EOF
|
|
|
|
|
cat > "$CONFIG/acl_tls" <<EOF
|
|
|
|
|
# Default rule for every certificate client. %u is the certificate CN.
|
|
|
|
|
pattern readwrite clients/%u/#
|
|
|
|
|
pattern write cert/enroll/%u/renew
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# ---- User customization in /share (created once, never overwritten) ----
|
|
|
|
|