|
|
|
@@ -42,8 +42,14 @@ 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
|
|
|
|
|
|
|
|
|
@@ -51,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
|
|
|
|
@@ -66,20 +70,28 @@ 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
|
|
|
|
|
cat > "$CONFIG/acl_plain" <<EOF
|
|
|
|
|
# ============================================================
|
|
|
|
|
# Not certified devices
|
|
|
|
|
# ============================================================
|
|
|
|
|
user hamqtt
|
|
|
|
|
|
|
|
|
|
# Test topic
|
|
|
|
|
topic readwrite test
|
|
|
|
|
# Initial enrollment
|
|
|
|
|
topic write cert/enroll/+/request
|
|
|
|
|
topic read cert/enroll/+/issued
|
|
|
|
|
|
|
|
|
|
# ============================================================
|
|
|
|
|
# Certificate manager
|
|
|
|
|
# ============================================================
|
|
|
|
|
user viracert
|
|
|
|
|
|
|
|
|
|
topic read cert/enroll/+/request
|
|
|
|
|
topic write cert/enroll/+/issued
|
|
|
|
|
topic read cert/enroll/+/renew
|
|
|
|
@@ -89,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) ----
|
|
|
|
|