1*4882a593Smuzhiyun# Config file for mosquitto 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# See mosquitto.conf(5) for more information. 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun# Default values are shown, uncomment to change. 6*4882a593Smuzhiyun# 7*4882a593Smuzhiyun# Use the # character to indicate a comment, but only if it is the 8*4882a593Smuzhiyun# very first character on the line. 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun# ================================================================= 11*4882a593Smuzhiyun# General configuration 12*4882a593Smuzhiyun# ================================================================= 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun# Use per listener security settings. 15*4882a593Smuzhiyun# 16*4882a593Smuzhiyun# It is recommended this option be set before any other options. 17*4882a593Smuzhiyun# 18*4882a593Smuzhiyun# If this option is set to true, then all authentication and access control 19*4882a593Smuzhiyun# options are controlled on a per listener basis. The following options are 20*4882a593Smuzhiyun# affected: 21*4882a593Smuzhiyun# 22*4882a593Smuzhiyun# acl_file 23*4882a593Smuzhiyun# allow_anonymous 24*4882a593Smuzhiyun# allow_zero_length_clientid 25*4882a593Smuzhiyun# auto_id_prefix 26*4882a593Smuzhiyun# password_file 27*4882a593Smuzhiyun# plugin 28*4882a593Smuzhiyun# plugin_opt_* 29*4882a593Smuzhiyun# psk_file 30*4882a593Smuzhiyun# 31*4882a593Smuzhiyun# Note that if set to true, then a durable client (i.e. with clean session set 32*4882a593Smuzhiyun# to false) that has disconnected will use the ACL settings defined for the 33*4882a593Smuzhiyun# listener that it was most recently connected to. 34*4882a593Smuzhiyun# 35*4882a593Smuzhiyun# The default behaviour is for this to be set to false, which maintains the 36*4882a593Smuzhiyun# setting behaviour from previous versions of mosquitto. 37*4882a593Smuzhiyun#per_listener_settings false 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun# This option controls whether a client is allowed to connect with a zero 41*4882a593Smuzhiyun# length client id or not. This option only affects clients using MQTT v3.1.1 42*4882a593Smuzhiyun# and later. If set to false, clients connecting with a zero length client id 43*4882a593Smuzhiyun# are disconnected. If set to true, clients will be allocated a client id by 44*4882a593Smuzhiyun# the broker. This means it is only useful for clients with clean session set 45*4882a593Smuzhiyun# to true. 46*4882a593Smuzhiyun#allow_zero_length_clientid true 47*4882a593Smuzhiyun 48*4882a593Smuzhiyun# If allow_zero_length_clientid is true, this option allows you to set a prefix 49*4882a593Smuzhiyun# to automatically generated client ids to aid visibility in logs. 50*4882a593Smuzhiyun# Defaults to 'auto-' 51*4882a593Smuzhiyun#auto_id_prefix auto- 52*4882a593Smuzhiyun 53*4882a593Smuzhiyun# This option affects the scenario when a client subscribes to a topic that has 54*4882a593Smuzhiyun# retained messages. It is possible that the client that published the retained 55*4882a593Smuzhiyun# message to the topic had access at the time they published, but that access 56*4882a593Smuzhiyun# has been subsequently removed. If check_retain_source is set to true, the 57*4882a593Smuzhiyun# default, the source of a retained message will be checked for access rights 58*4882a593Smuzhiyun# before it is republished. When set to false, no check will be made and the 59*4882a593Smuzhiyun# retained message will always be published. This affects all listeners. 60*4882a593Smuzhiyun#check_retain_source true 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun# QoS 1 and 2 messages will be allowed inflight per client until this limit 63*4882a593Smuzhiyun# is exceeded. Defaults to 0. (No maximum) 64*4882a593Smuzhiyun# See also max_inflight_messages 65*4882a593Smuzhiyun#max_inflight_bytes 0 66*4882a593Smuzhiyun 67*4882a593Smuzhiyun# The maximum number of QoS 1 and 2 messages currently inflight per 68*4882a593Smuzhiyun# client. 69*4882a593Smuzhiyun# This includes messages that are partway through handshakes and 70*4882a593Smuzhiyun# those that are being retried. Defaults to 20. Set to 0 for no 71*4882a593Smuzhiyun# maximum. Setting to 1 will guarantee in-order delivery of QoS 1 72*4882a593Smuzhiyun# and 2 messages. 73*4882a593Smuzhiyun#max_inflight_messages 20 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun# For MQTT v5 clients, it is possible to have the server send a "server 76*4882a593Smuzhiyun# keepalive" value that will override the keepalive value set by the client. 77*4882a593Smuzhiyun# This is intended to be used as a mechanism to say that the server will 78*4882a593Smuzhiyun# disconnect the client earlier than it anticipated, and that the client should 79*4882a593Smuzhiyun# use the new keepalive value. The max_keepalive option allows you to specify 80*4882a593Smuzhiyun# that clients may only connect with keepalive less than or equal to this 81*4882a593Smuzhiyun# value, otherwise they will be sent a server keepalive telling them to use 82*4882a593Smuzhiyun# max_keepalive. This only applies to MQTT v5 clients. The default, and maximum 83*4882a593Smuzhiyun# value allowable, is 65535. 84*4882a593Smuzhiyun# 85*4882a593Smuzhiyun# Set to 0 to allow clients to set keepalive = 0, which means no keepalive 86*4882a593Smuzhiyun# checks are made and the client will never be disconnected by the broker if no 87*4882a593Smuzhiyun# messages are received. You should be very sure this is the behaviour that you 88*4882a593Smuzhiyun# want. 89*4882a593Smuzhiyun# 90*4882a593Smuzhiyun# For MQTT v3.1.1 and v3.1 clients, there is no mechanism to tell the client 91*4882a593Smuzhiyun# what keepalive value they should use. If an MQTT v3.1.1 or v3.1 client 92*4882a593Smuzhiyun# specifies a keepalive time greater than max_keepalive they will be sent a 93*4882a593Smuzhiyun# CONNACK message with the "identifier rejected" reason code, and disconnected. 94*4882a593Smuzhiyun# 95*4882a593Smuzhiyun#max_keepalive 65535 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun# For MQTT v5 clients, it is possible to have the server send a "maximum packet 98*4882a593Smuzhiyun# size" value that will instruct the client it will not accept MQTT packets 99*4882a593Smuzhiyun# with size greater than max_packet_size bytes. This applies to the full MQTT 100*4882a593Smuzhiyun# packet, not just the payload. Setting this option to a positive value will 101*4882a593Smuzhiyun# set the maximum packet size to that number of bytes. If a client sends a 102*4882a593Smuzhiyun# packet which is larger than this value, it will be disconnected. This applies 103*4882a593Smuzhiyun# to all clients regardless of the protocol version they are using, but v3.1.1 104*4882a593Smuzhiyun# and earlier clients will of course not have received the maximum packet size 105*4882a593Smuzhiyun# information. Defaults to no limit. Setting below 20 bytes is forbidden 106*4882a593Smuzhiyun# because it is likely to interfere with ordinary client operation, even with 107*4882a593Smuzhiyun# very small payloads. 108*4882a593Smuzhiyun#max_packet_size 0 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun# QoS 1 and 2 messages above those currently in-flight will be queued per 111*4882a593Smuzhiyun# client until this limit is exceeded. Defaults to 0. (No maximum) 112*4882a593Smuzhiyun# See also max_queued_messages. 113*4882a593Smuzhiyun# If both max_queued_messages and max_queued_bytes are specified, packets will 114*4882a593Smuzhiyun# be queued until the first limit is reached. 115*4882a593Smuzhiyun#max_queued_bytes 0 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun# Set the maximum QoS supported. Clients publishing at a QoS higher than 118*4882a593Smuzhiyun# specified here will be disconnected. 119*4882a593Smuzhiyun#max_qos 2 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun# The maximum number of QoS 1 and 2 messages to hold in a queue per client 122*4882a593Smuzhiyun# above those that are currently in-flight. Defaults to 1000. Set 123*4882a593Smuzhiyun# to 0 for no maximum (not recommended). 124*4882a593Smuzhiyun# See also queue_qos0_messages. 125*4882a593Smuzhiyun# See also max_queued_bytes. 126*4882a593Smuzhiyun#max_queued_messages 1000 127*4882a593Smuzhiyun# 128*4882a593Smuzhiyun# This option sets the maximum number of heap memory bytes that the broker will 129*4882a593Smuzhiyun# allocate, and hence sets a hard limit on memory use by the broker. Memory 130*4882a593Smuzhiyun# requests that exceed this value will be denied. The effect will vary 131*4882a593Smuzhiyun# depending on what has been denied. If an incoming message is being processed, 132*4882a593Smuzhiyun# then the message will be dropped and the publishing client will be 133*4882a593Smuzhiyun# disconnected. If an outgoing message is being sent, then the individual 134*4882a593Smuzhiyun# message will be dropped and the receiving client will be disconnected. 135*4882a593Smuzhiyun# Defaults to no limit. 136*4882a593Smuzhiyun#memory_limit 0 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun# This option sets the maximum publish payload size that the broker will allow. 139*4882a593Smuzhiyun# Received messages that exceed this size will not be accepted by the broker. 140*4882a593Smuzhiyun# The default value is 0, which means that all valid MQTT messages are 141*4882a593Smuzhiyun# accepted. MQTT imposes a maximum payload size of 268435455 bytes. 142*4882a593Smuzhiyun#message_size_limit 0 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun# This option allows persistent clients (those with clean session set to false) 145*4882a593Smuzhiyun# to be removed if they do not reconnect within a certain time frame. 146*4882a593Smuzhiyun# 147*4882a593Smuzhiyun# This is a non-standard option in MQTT V3.1 but allowed in MQTT v3.1.1. 148*4882a593Smuzhiyun# 149*4882a593Smuzhiyun# Badly designed clients may set clean session to false whilst using a randomly 150*4882a593Smuzhiyun# generated client id. This leads to persistent clients that will never 151*4882a593Smuzhiyun# reconnect. This option allows these clients to be removed. 152*4882a593Smuzhiyun# 153*4882a593Smuzhiyun# The expiration period should be an integer followed by one of h d w m y for 154*4882a593Smuzhiyun# hour, day, week, month and year respectively. For example 155*4882a593Smuzhiyun# 156*4882a593Smuzhiyun# persistent_client_expiration 2m 157*4882a593Smuzhiyun# persistent_client_expiration 14d 158*4882a593Smuzhiyun# persistent_client_expiration 1y 159*4882a593Smuzhiyun# 160*4882a593Smuzhiyun# The default if not set is to never expire persistent clients. 161*4882a593Smuzhiyun#persistent_client_expiration 162*4882a593Smuzhiyun 163*4882a593Smuzhiyun# Write process id to a file. Default is a blank string which means 164*4882a593Smuzhiyun# a pid file shouldn't be written. 165*4882a593Smuzhiyun# This should be set to /var/run/mosquitto/mosquitto.pid if mosquitto is 166*4882a593Smuzhiyun# being run automatically on boot with an init script and 167*4882a593Smuzhiyun# start-stop-daemon or similar. 168*4882a593Smuzhiyun#pid_file 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun# Set to true to queue messages with QoS 0 when a persistent client is 171*4882a593Smuzhiyun# disconnected. These messages are included in the limit imposed by 172*4882a593Smuzhiyun# max_queued_messages and max_queued_bytes 173*4882a593Smuzhiyun# Defaults to false. 174*4882a593Smuzhiyun# This is a non-standard option for the MQTT v3.1 spec but is allowed in 175*4882a593Smuzhiyun# v3.1.1. 176*4882a593Smuzhiyun#queue_qos0_messages false 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun# Set to false to disable retained message support. If a client publishes a 179*4882a593Smuzhiyun# message with the retain bit set, it will be disconnected if this is set to 180*4882a593Smuzhiyun# false. 181*4882a593Smuzhiyun#retain_available true 182*4882a593Smuzhiyun 183*4882a593Smuzhiyun# Disable Nagle's algorithm on client sockets. This has the effect of reducing 184*4882a593Smuzhiyun# latency of individual messages at the potential cost of increasing the number 185*4882a593Smuzhiyun# of packets being sent. 186*4882a593Smuzhiyun#set_tcp_nodelay false 187*4882a593Smuzhiyun 188*4882a593Smuzhiyun# Time in seconds between updates of the $SYS tree. 189*4882a593Smuzhiyun# Set to 0 to disable the publishing of the $SYS tree. 190*4882a593Smuzhiyun#sys_interval 10 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun# The MQTT specification requires that the QoS of a message delivered to a 193*4882a593Smuzhiyun# subscriber is never upgraded to match the QoS of the subscription. Enabling 194*4882a593Smuzhiyun# this option changes this behaviour. If upgrade_outgoing_qos is set true, 195*4882a593Smuzhiyun# messages sent to a subscriber will always match the QoS of its subscription. 196*4882a593Smuzhiyun# This is a non-standard option explicitly disallowed by the spec. 197*4882a593Smuzhiyun#upgrade_outgoing_qos false 198*4882a593Smuzhiyun 199*4882a593Smuzhiyun# When run as root, drop privileges to this user and its primary 200*4882a593Smuzhiyun# group. 201*4882a593Smuzhiyun# Set to root to stay as root, but this is not recommended. 202*4882a593Smuzhiyun# If set to "mosquitto", or left unset, and the "mosquitto" user does not exist 203*4882a593Smuzhiyun# then it will drop privileges to the "nobody" user instead. 204*4882a593Smuzhiyun# If run as a non-root user, this setting has no effect. 205*4882a593Smuzhiyun# Note that on Windows this has no effect and so mosquitto should be started by 206*4882a593Smuzhiyun# the user you wish it to run as. 207*4882a593Smuzhiyun#user mosquitto 208*4882a593Smuzhiyunuser root 209*4882a593Smuzhiyun 210*4882a593Smuzhiyun# ================================================================= 211*4882a593Smuzhiyun# Listeners 212*4882a593Smuzhiyun# ================================================================= 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun# Listen on a port/ip address combination. By using this variable 215*4882a593Smuzhiyun# multiple times, mosquitto can listen on more than one port. If 216*4882a593Smuzhiyun# this variable is used and neither bind_address nor port given, 217*4882a593Smuzhiyun# then the default listener will not be started. 218*4882a593Smuzhiyun# The port number to listen on must be given. Optionally, an ip 219*4882a593Smuzhiyun# address or host name may be supplied as a second argument. In 220*4882a593Smuzhiyun# this case, mosquitto will attempt to bind the listener to that 221*4882a593Smuzhiyun# address and so restrict access to the associated network and 222*4882a593Smuzhiyun# interface. By default, mosquitto will listen on all interfaces. 223*4882a593Smuzhiyun# Note that for a websockets listener it is not possible to bind to a host 224*4882a593Smuzhiyun# name. 225*4882a593Smuzhiyun# 226*4882a593Smuzhiyun# On systems that support Unix Domain Sockets, it is also possible 227*4882a593Smuzhiyun# to create a # Unix socket rather than opening a TCP socket. In 228*4882a593Smuzhiyun# this case, the port number should be set to 0 and a unix socket 229*4882a593Smuzhiyun# path must be provided, e.g. 230*4882a593Smuzhiyun# listener 0 /tmp/mosquitto.sock 231*4882a593Smuzhiyun# 232*4882a593Smuzhiyun# listener port-number [ip address/host name/unix socket path] 233*4882a593Smuzhiyun#listener 234*4882a593Smuzhiyunlistener 1883 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun# By default, a listener will attempt to listen on all supported IP protocol 237*4882a593Smuzhiyun# versions. If you do not have an IPv4 or IPv6 interface you may wish to 238*4882a593Smuzhiyun# disable support for either of those protocol versions. In particular, note 239*4882a593Smuzhiyun# that due to the limitations of the websockets library, it will only ever 240*4882a593Smuzhiyun# attempt to open IPv6 sockets if IPv6 support is compiled in, and so will fail 241*4882a593Smuzhiyun# if IPv6 is not available. 242*4882a593Smuzhiyun# 243*4882a593Smuzhiyun# Set to `ipv4` to force the listener to only use IPv4, or set to `ipv6` to 244*4882a593Smuzhiyun# force the listener to only use IPv6. If you want support for both IPv4 and 245*4882a593Smuzhiyun# IPv6, then do not use the socket_domain option. 246*4882a593Smuzhiyun# 247*4882a593Smuzhiyun#socket_domain 248*4882a593Smuzhiyun 249*4882a593Smuzhiyun# Bind the listener to a specific interface. This is similar to 250*4882a593Smuzhiyun# the [ip address/host name] part of the listener definition, but is useful 251*4882a593Smuzhiyun# when an interface has multiple addresses or the address may change. If used 252*4882a593Smuzhiyun# with the [ip address/host name] part of the listener definition, then the 253*4882a593Smuzhiyun# bind_interface option will take priority. 254*4882a593Smuzhiyun# Not available on Windows. 255*4882a593Smuzhiyun# 256*4882a593Smuzhiyun# Example: bind_interface eth0 257*4882a593Smuzhiyun#bind_interface 258*4882a593Smuzhiyun 259*4882a593Smuzhiyun# When a listener is using the websockets protocol, it is possible to serve 260*4882a593Smuzhiyun# http data as well. Set http_dir to a directory which contains the files you 261*4882a593Smuzhiyun# wish to serve. If this option is not specified, then no normal http 262*4882a593Smuzhiyun# connections will be possible. 263*4882a593Smuzhiyun#http_dir 264*4882a593Smuzhiyun 265*4882a593Smuzhiyun# The maximum number of client connections to allow. This is 266*4882a593Smuzhiyun# a per listener setting. 267*4882a593Smuzhiyun# Default is -1, which means unlimited connections. 268*4882a593Smuzhiyun# Note that other process limits mean that unlimited connections 269*4882a593Smuzhiyun# are not really possible. Typically the default maximum number of 270*4882a593Smuzhiyun# connections possible is around 1024. 271*4882a593Smuzhiyun#max_connections -1 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun# The listener can be restricted to operating within a topic hierarchy using 274*4882a593Smuzhiyun# the mount_point option. This is achieved be prefixing the mount_point string 275*4882a593Smuzhiyun# to all topics for any clients connected to this listener. This prefixing only 276*4882a593Smuzhiyun# happens internally to the broker; the client will not see the prefix. 277*4882a593Smuzhiyun#mount_point 278*4882a593Smuzhiyun 279*4882a593Smuzhiyun# Choose the protocol to use when listening. 280*4882a593Smuzhiyun# This can be either mqtt or websockets. 281*4882a593Smuzhiyun# Certificate based TLS may be used with websockets, except that only the 282*4882a593Smuzhiyun# cafile, certfile, keyfile, ciphers, and ciphers_tls13 options are supported. 283*4882a593Smuzhiyun#protocol mqtt 284*4882a593Smuzhiyun 285*4882a593Smuzhiyun# Set use_username_as_clientid to true to replace the clientid that a client 286*4882a593Smuzhiyun# connected with with its username. This allows authentication to be tied to 287*4882a593Smuzhiyun# the clientid, which means that it is possible to prevent one client 288*4882a593Smuzhiyun# disconnecting another by using the same clientid. 289*4882a593Smuzhiyun# If a client connects with no username it will be disconnected as not 290*4882a593Smuzhiyun# authorised when this option is set to true. 291*4882a593Smuzhiyun# Do not use in conjunction with clientid_prefixes. 292*4882a593Smuzhiyun# See also use_identity_as_username. 293*4882a593Smuzhiyun#use_username_as_clientid 294*4882a593Smuzhiyun 295*4882a593Smuzhiyun# Change the websockets headers size. This is a global option, it is not 296*4882a593Smuzhiyun# possible to set per listener. This option sets the size of the buffer used in 297*4882a593Smuzhiyun# the libwebsockets library when reading HTTP headers. If you are passing large 298*4882a593Smuzhiyun# header data such as cookies then you may need to increase this value. If left 299*4882a593Smuzhiyun# unset, or set to 0, then the default of 1024 bytes will be used. 300*4882a593Smuzhiyun#websockets_headers_size 301*4882a593Smuzhiyun 302*4882a593Smuzhiyun# ----------------------------------------------------------------- 303*4882a593Smuzhiyun# Certificate based SSL/TLS support 304*4882a593Smuzhiyun# ----------------------------------------------------------------- 305*4882a593Smuzhiyun# The following options can be used to enable certificate based SSL/TLS support 306*4882a593Smuzhiyun# for this listener. Note that the recommended port for MQTT over TLS is 8883, 307*4882a593Smuzhiyun# but this must be set manually. 308*4882a593Smuzhiyun# 309*4882a593Smuzhiyun# See also the mosquitto-tls man page and the "Pre-shared-key based SSL/TLS 310*4882a593Smuzhiyun# support" section. Only one of certificate or PSK encryption support can be 311*4882a593Smuzhiyun# enabled for any listener. 312*4882a593Smuzhiyun 313*4882a593Smuzhiyun# Both of certfile and keyfile must be defined to enable certificate based 314*4882a593Smuzhiyun# TLS encryption. 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun# Path to the PEM encoded server certificate. 317*4882a593Smuzhiyun#certfile 318*4882a593Smuzhiyun 319*4882a593Smuzhiyun# Path to the PEM encoded keyfile. 320*4882a593Smuzhiyun#keyfile 321*4882a593Smuzhiyun 322*4882a593Smuzhiyun# If you wish to control which encryption ciphers are used, use the ciphers 323*4882a593Smuzhiyun# option. The list of available ciphers can be optained using the "openssl 324*4882a593Smuzhiyun# ciphers" command and should be provided in the same format as the output of 325*4882a593Smuzhiyun# that command. This applies to TLS 1.2 and earlier versions only. Use 326*4882a593Smuzhiyun# ciphers_tls1.3 for TLS v1.3. 327*4882a593Smuzhiyun#ciphers 328*4882a593Smuzhiyun 329*4882a593Smuzhiyun# Choose which TLS v1.3 ciphersuites are used for this listener. 330*4882a593Smuzhiyun# Defaults to "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" 331*4882a593Smuzhiyun#ciphers_tls1.3 332*4882a593Smuzhiyun 333*4882a593Smuzhiyun# If you have require_certificate set to true, you can create a certificate 334*4882a593Smuzhiyun# revocation list file to revoke access to particular client certificates. If 335*4882a593Smuzhiyun# you have done this, use crlfile to point to the PEM encoded revocation file. 336*4882a593Smuzhiyun#crlfile 337*4882a593Smuzhiyun 338*4882a593Smuzhiyun# To allow the use of ephemeral DH key exchange, which provides forward 339*4882a593Smuzhiyun# security, the listener must load DH parameters. This can be specified with 340*4882a593Smuzhiyun# the dhparamfile option. The dhparamfile can be generated with the command 341*4882a593Smuzhiyun# e.g. "openssl dhparam -out dhparam.pem 2048" 342*4882a593Smuzhiyun#dhparamfile 343*4882a593Smuzhiyun 344*4882a593Smuzhiyun# By default an TLS enabled listener will operate in a similar fashion to a 345*4882a593Smuzhiyun# https enabled web server, in that the server has a certificate signed by a CA 346*4882a593Smuzhiyun# and the client will verify that it is a trusted certificate. The overall aim 347*4882a593Smuzhiyun# is encryption of the network traffic. By setting require_certificate to true, 348*4882a593Smuzhiyun# the client must provide a valid certificate in order for the network 349*4882a593Smuzhiyun# connection to proceed. This allows access to the broker to be controlled 350*4882a593Smuzhiyun# outside of the mechanisms provided by MQTT. 351*4882a593Smuzhiyun#require_certificate false 352*4882a593Smuzhiyun 353*4882a593Smuzhiyun# cafile and capath define methods of accessing the PEM encoded 354*4882a593Smuzhiyun# Certificate Authority certificates that will be considered trusted when 355*4882a593Smuzhiyun# checking incoming client certificates. 356*4882a593Smuzhiyun# cafile defines the path to a file containing the CA certificates. 357*4882a593Smuzhiyun# capath defines a directory that will be searched for files 358*4882a593Smuzhiyun# containing the CA certificates. For capath to work correctly, the 359*4882a593Smuzhiyun# certificate files must have ".crt" as the file ending and you must run 360*4882a593Smuzhiyun# "openssl rehash <path to capath>" each time you add/remove a certificate. 361*4882a593Smuzhiyun#cafile 362*4882a593Smuzhiyun#capath 363*4882a593Smuzhiyun 364*4882a593Smuzhiyun 365*4882a593Smuzhiyun# If require_certificate is true, you may set use_identity_as_username to true 366*4882a593Smuzhiyun# to use the CN value from the client certificate as a username. If this is 367*4882a593Smuzhiyun# true, the password_file option will not be used for this listener. 368*4882a593Smuzhiyun#use_identity_as_username false 369*4882a593Smuzhiyun 370*4882a593Smuzhiyun# ----------------------------------------------------------------- 371*4882a593Smuzhiyun# Pre-shared-key based SSL/TLS support 372*4882a593Smuzhiyun# ----------------------------------------------------------------- 373*4882a593Smuzhiyun# The following options can be used to enable PSK based SSL/TLS support for 374*4882a593Smuzhiyun# this listener. Note that the recommended port for MQTT over TLS is 8883, but 375*4882a593Smuzhiyun# this must be set manually. 376*4882a593Smuzhiyun# 377*4882a593Smuzhiyun# See also the mosquitto-tls man page and the "Certificate based SSL/TLS 378*4882a593Smuzhiyun# support" section. Only one of certificate or PSK encryption support can be 379*4882a593Smuzhiyun# enabled for any listener. 380*4882a593Smuzhiyun 381*4882a593Smuzhiyun# The psk_hint option enables pre-shared-key support for this listener and also 382*4882a593Smuzhiyun# acts as an identifier for this listener. The hint is sent to clients and may 383*4882a593Smuzhiyun# be used locally to aid authentication. The hint is a free form string that 384*4882a593Smuzhiyun# doesn't have much meaning in itself, so feel free to be creative. 385*4882a593Smuzhiyun# If this option is provided, see psk_file to define the pre-shared keys to be 386*4882a593Smuzhiyun# used or create a security plugin to handle them. 387*4882a593Smuzhiyun#psk_hint 388*4882a593Smuzhiyun 389*4882a593Smuzhiyun# When using PSK, the encryption ciphers used will be chosen from the list of 390*4882a593Smuzhiyun# available PSK ciphers. If you want to control which ciphers are available, 391*4882a593Smuzhiyun# use the "ciphers" option. The list of available ciphers can be optained 392*4882a593Smuzhiyun# using the "openssl ciphers" command and should be provided in the same format 393*4882a593Smuzhiyun# as the output of that command. 394*4882a593Smuzhiyun#ciphers 395*4882a593Smuzhiyun 396*4882a593Smuzhiyun# Set use_identity_as_username to have the psk identity sent by the client used 397*4882a593Smuzhiyun# as its username. Authentication will be carried out using the PSK rather than 398*4882a593Smuzhiyun# the MQTT username/password and so password_file will not be used for this 399*4882a593Smuzhiyun# listener. 400*4882a593Smuzhiyun#use_identity_as_username false 401*4882a593Smuzhiyun 402*4882a593Smuzhiyun 403*4882a593Smuzhiyun# ================================================================= 404*4882a593Smuzhiyun# Persistence 405*4882a593Smuzhiyun# ================================================================= 406*4882a593Smuzhiyun 407*4882a593Smuzhiyun# If persistence is enabled, save the in-memory database to disk 408*4882a593Smuzhiyun# every autosave_interval seconds. If set to 0, the persistence 409*4882a593Smuzhiyun# database will only be written when mosquitto exits. See also 410*4882a593Smuzhiyun# autosave_on_changes. 411*4882a593Smuzhiyun# Note that writing of the persistence database can be forced by 412*4882a593Smuzhiyun# sending mosquitto a SIGUSR1 signal. 413*4882a593Smuzhiyun#autosave_interval 1800 414*4882a593Smuzhiyun 415*4882a593Smuzhiyun# If true, mosquitto will count the number of subscription changes, retained 416*4882a593Smuzhiyun# messages received and queued messages and if the total exceeds 417*4882a593Smuzhiyun# autosave_interval then the in-memory database will be saved to disk. 418*4882a593Smuzhiyun# If false, mosquitto will save the in-memory database to disk by treating 419*4882a593Smuzhiyun# autosave_interval as a time in seconds. 420*4882a593Smuzhiyun#autosave_on_changes false 421*4882a593Smuzhiyun 422*4882a593Smuzhiyun# Save persistent message data to disk (true/false). 423*4882a593Smuzhiyun# This saves information about all messages, including 424*4882a593Smuzhiyun# subscriptions, currently in-flight messages and retained 425*4882a593Smuzhiyun# messages. 426*4882a593Smuzhiyun# retained_persistence is a synonym for this option. 427*4882a593Smuzhiyun#persistence false 428*4882a593Smuzhiyun 429*4882a593Smuzhiyun# The filename to use for the persistent database, not including 430*4882a593Smuzhiyun# the path. 431*4882a593Smuzhiyun#persistence_file mosquitto.db 432*4882a593Smuzhiyun 433*4882a593Smuzhiyun# Location for persistent database. 434*4882a593Smuzhiyun# Default is an empty string (current directory). 435*4882a593Smuzhiyun# Set to e.g. /var/lib/mosquitto if running as a proper service on Linux or 436*4882a593Smuzhiyun# similar. 437*4882a593Smuzhiyun#persistence_location 438*4882a593Smuzhiyun 439*4882a593Smuzhiyun 440*4882a593Smuzhiyun# ================================================================= 441*4882a593Smuzhiyun# Logging 442*4882a593Smuzhiyun# ================================================================= 443*4882a593Smuzhiyun 444*4882a593Smuzhiyun# Places to log to. Use multiple log_dest lines for multiple 445*4882a593Smuzhiyun# logging destinations. 446*4882a593Smuzhiyun# Possible destinations are: stdout stderr syslog topic file dlt 447*4882a593Smuzhiyun# 448*4882a593Smuzhiyun# stdout and stderr log to the console on the named output. 449*4882a593Smuzhiyun# 450*4882a593Smuzhiyun# syslog uses the userspace syslog facility which usually ends up 451*4882a593Smuzhiyun# in /var/log/messages or similar. 452*4882a593Smuzhiyun# 453*4882a593Smuzhiyun# topic logs to the broker topic '$SYS/broker/log/<severity>', 454*4882a593Smuzhiyun# where severity is one of D, E, W, N, I, M which are debug, error, 455*4882a593Smuzhiyun# warning, notice, information and message. Message type severity is used by 456*4882a593Smuzhiyun# the subscribe/unsubscribe log_types and publishes log messages to 457*4882a593Smuzhiyun# $SYS/broker/log/M/susbcribe or $SYS/broker/log/M/unsubscribe. 458*4882a593Smuzhiyun# 459*4882a593Smuzhiyun# The file destination requires an additional parameter which is the file to be 460*4882a593Smuzhiyun# logged to, e.g. "log_dest file /var/log/mosquitto.log". The file will be 461*4882a593Smuzhiyun# closed and reopened when the broker receives a HUP signal. Only a single file 462*4882a593Smuzhiyun# destination may be configured. 463*4882a593Smuzhiyun# 464*4882a593Smuzhiyun# The dlt destination is for the automotive `Diagnostic Log and Trace` tool. 465*4882a593Smuzhiyun# This requires that Mosquitto has been compiled with DLT support. 466*4882a593Smuzhiyun# 467*4882a593Smuzhiyun# Note that if the broker is running as a Windows service it will default to 468*4882a593Smuzhiyun# "log_dest none" and neither stdout nor stderr logging is available. 469*4882a593Smuzhiyun# Use "log_dest none" if you wish to disable logging. 470*4882a593Smuzhiyun#log_dest stderr 471*4882a593Smuzhiyun 472*4882a593Smuzhiyun# Types of messages to log. Use multiple log_type lines for logging 473*4882a593Smuzhiyun# multiple types of messages. 474*4882a593Smuzhiyun# Possible types are: debug, error, warning, notice, information, 475*4882a593Smuzhiyun# none, subscribe, unsubscribe, websockets, all. 476*4882a593Smuzhiyun# Note that debug type messages are for decoding the incoming/outgoing 477*4882a593Smuzhiyun# network packets. They are not logged in "topics". 478*4882a593Smuzhiyun#log_type error 479*4882a593Smuzhiyun#log_type warning 480*4882a593Smuzhiyun#log_type notice 481*4882a593Smuzhiyun#log_type information 482*4882a593Smuzhiyun 483*4882a593Smuzhiyun 484*4882a593Smuzhiyun# If set to true, client connection and disconnection messages will be included 485*4882a593Smuzhiyun# in the log. 486*4882a593Smuzhiyun#connection_messages true 487*4882a593Smuzhiyun 488*4882a593Smuzhiyun# If using syslog logging (not on Windows), messages will be logged to the 489*4882a593Smuzhiyun# "daemon" facility by default. Use the log_facility option to choose which of 490*4882a593Smuzhiyun# local0 to local7 to log to instead. The option value should be an integer 491*4882a593Smuzhiyun# value, e.g. "log_facility 5" to use local5. 492*4882a593Smuzhiyun#log_facility 493*4882a593Smuzhiyun 494*4882a593Smuzhiyun# If set to true, add a timestamp value to each log message. 495*4882a593Smuzhiyun#log_timestamp true 496*4882a593Smuzhiyun 497*4882a593Smuzhiyun# Set the format of the log timestamp. If left unset, this is the number of 498*4882a593Smuzhiyun# seconds since the Unix epoch. 499*4882a593Smuzhiyun# This is a free text string which will be passed to the strftime function. To 500*4882a593Smuzhiyun# get an ISO 8601 datetime, for example: 501*4882a593Smuzhiyun# log_timestamp_format %Y-%m-%dT%H:%M:%S 502*4882a593Smuzhiyun#log_timestamp_format 503*4882a593Smuzhiyun 504*4882a593Smuzhiyun# Change the websockets logging level. This is a global option, it is not 505*4882a593Smuzhiyun# possible to set per listener. This is an integer that is interpreted by 506*4882a593Smuzhiyun# libwebsockets as a bit mask for its lws_log_levels enum. See the 507*4882a593Smuzhiyun# libwebsockets documentation for more details. "log_type websockets" must also 508*4882a593Smuzhiyun# be enabled. 509*4882a593Smuzhiyun#websockets_log_level 0 510*4882a593Smuzhiyun 511*4882a593Smuzhiyun 512*4882a593Smuzhiyun# ================================================================= 513*4882a593Smuzhiyun# Security 514*4882a593Smuzhiyun# ================================================================= 515*4882a593Smuzhiyun 516*4882a593Smuzhiyun# If set, only clients that have a matching prefix on their 517*4882a593Smuzhiyun# clientid will be allowed to connect to the broker. By default, 518*4882a593Smuzhiyun# all clients may connect. 519*4882a593Smuzhiyun# For example, setting "secure-" here would mean a client "secure- 520*4882a593Smuzhiyun# client" could connect but another with clientid "mqtt" couldn't. 521*4882a593Smuzhiyun#clientid_prefixes 522*4882a593Smuzhiyun 523*4882a593Smuzhiyun# Boolean value that determines whether clients that connect 524*4882a593Smuzhiyun# without providing a username are allowed to connect. If set to 525*4882a593Smuzhiyun# false then a password file should be created (see the 526*4882a593Smuzhiyun# password_file option) to control authenticated client access. 527*4882a593Smuzhiyun# 528*4882a593Smuzhiyun# Defaults to false, unless there are no listeners defined in the configuration 529*4882a593Smuzhiyun# file, in which case it is set to true, but connections are only allowed from 530*4882a593Smuzhiyun# the local machine. 531*4882a593Smuzhiyun#allow_anonymous false 532*4882a593Smuzhiyunallow_anonymous true 533*4882a593Smuzhiyun 534*4882a593Smuzhiyun# ----------------------------------------------------------------- 535*4882a593Smuzhiyun# Default authentication and topic access control 536*4882a593Smuzhiyun# ----------------------------------------------------------------- 537*4882a593Smuzhiyun 538*4882a593Smuzhiyun# Control access to the broker using a password file. This file can be 539*4882a593Smuzhiyun# generated using the mosquitto_passwd utility. If TLS support is not compiled 540*4882a593Smuzhiyun# into mosquitto (it is recommended that TLS support should be included) then 541*4882a593Smuzhiyun# plain text passwords are used, in which case the file should be a text file 542*4882a593Smuzhiyun# with lines in the format: 543*4882a593Smuzhiyun# username:password 544*4882a593Smuzhiyun# The password (and colon) may be omitted if desired, although this 545*4882a593Smuzhiyun# offers very little in the way of security. 546*4882a593Smuzhiyun# 547*4882a593Smuzhiyun# See the TLS client require_certificate and use_identity_as_username options 548*4882a593Smuzhiyun# for alternative authentication options. If a plugin is used as well as 549*4882a593Smuzhiyun# password_file, the plugin check will be made first. 550*4882a593Smuzhiyun#password_file 551*4882a593Smuzhiyun 552*4882a593Smuzhiyun# Access may also be controlled using a pre-shared-key file. This requires 553*4882a593Smuzhiyun# TLS-PSK support and a listener configured to use it. The file should be text 554*4882a593Smuzhiyun# lines in the format: 555*4882a593Smuzhiyun# identity:key 556*4882a593Smuzhiyun# The key should be in hexadecimal format without a leading "0x". 557*4882a593Smuzhiyun# If an plugin is used as well, the plugin check will be made first. 558*4882a593Smuzhiyun#psk_file 559*4882a593Smuzhiyun 560*4882a593Smuzhiyun# Control access to topics on the broker using an access control list 561*4882a593Smuzhiyun# file. If this parameter is defined then only the topics listed will 562*4882a593Smuzhiyun# have access. 563*4882a593Smuzhiyun# If the first character of a line of the ACL file is a # it is treated as a 564*4882a593Smuzhiyun# comment. 565*4882a593Smuzhiyun# Topic access is added with lines of the format: 566*4882a593Smuzhiyun# 567*4882a593Smuzhiyun# topic [read|write|readwrite|deny] <topic> 568*4882a593Smuzhiyun# 569*4882a593Smuzhiyun# The access type is controlled using "read", "write", "readwrite" or "deny". 570*4882a593Smuzhiyun# This parameter is optional (unless <topic> contains a space character) - if 571*4882a593Smuzhiyun# not given then the access is read/write. <topic> can contain the + or # 572*4882a593Smuzhiyun# wildcards as in subscriptions. 573*4882a593Smuzhiyun# 574*4882a593Smuzhiyun# The "deny" option can used to explicity deny access to a topic that would 575*4882a593Smuzhiyun# otherwise be granted by a broader read/write/readwrite statement. Any "deny" 576*4882a593Smuzhiyun# topics are handled before topics that grant read/write access. 577*4882a593Smuzhiyun# 578*4882a593Smuzhiyun# The first set of topics are applied to anonymous clients, assuming 579*4882a593Smuzhiyun# allow_anonymous is true. User specific topic ACLs are added after a 580*4882a593Smuzhiyun# user line as follows: 581*4882a593Smuzhiyun# 582*4882a593Smuzhiyun# user <username> 583*4882a593Smuzhiyun# 584*4882a593Smuzhiyun# The username referred to here is the same as in password_file. It is 585*4882a593Smuzhiyun# not the clientid. 586*4882a593Smuzhiyun# 587*4882a593Smuzhiyun# 588*4882a593Smuzhiyun# If is also possible to define ACLs based on pattern substitution within the 589*4882a593Smuzhiyun# topic. The patterns available for substition are: 590*4882a593Smuzhiyun# 591*4882a593Smuzhiyun# %c to match the client id of the client 592*4882a593Smuzhiyun# %u to match the username of the client 593*4882a593Smuzhiyun# 594*4882a593Smuzhiyun# The substitution pattern must be the only text for that level of hierarchy. 595*4882a593Smuzhiyun# 596*4882a593Smuzhiyun# The form is the same as for the topic keyword, but using pattern as the 597*4882a593Smuzhiyun# keyword. 598*4882a593Smuzhiyun# Pattern ACLs apply to all users even if the "user" keyword has previously 599*4882a593Smuzhiyun# been given. 600*4882a593Smuzhiyun# 601*4882a593Smuzhiyun# If using bridges with usernames and ACLs, connection messages can be allowed 602*4882a593Smuzhiyun# with the following pattern: 603*4882a593Smuzhiyun# pattern write $SYS/broker/connection/%c/state 604*4882a593Smuzhiyun# 605*4882a593Smuzhiyun# pattern [read|write|readwrite] <topic> 606*4882a593Smuzhiyun# 607*4882a593Smuzhiyun# Example: 608*4882a593Smuzhiyun# 609*4882a593Smuzhiyun# pattern write sensor/%u/data 610*4882a593Smuzhiyun# 611*4882a593Smuzhiyun# If an plugin is used as well as acl_file, the plugin check will be 612*4882a593Smuzhiyun# made first. 613*4882a593Smuzhiyun#acl_file 614*4882a593Smuzhiyun 615*4882a593Smuzhiyun# ----------------------------------------------------------------- 616*4882a593Smuzhiyun# External authentication and topic access plugin options 617*4882a593Smuzhiyun# ----------------------------------------------------------------- 618*4882a593Smuzhiyun 619*4882a593Smuzhiyun# External authentication and access control can be supported with the 620*4882a593Smuzhiyun# plugin option. This is a path to a loadable plugin. See also the 621*4882a593Smuzhiyun# plugin_opt_* options described below. 622*4882a593Smuzhiyun# 623*4882a593Smuzhiyun# The plugin option can be specified multiple times to load multiple 624*4882a593Smuzhiyun# plugins. The plugins will be processed in the order that they are specified 625*4882a593Smuzhiyun# here. If the plugin option is specified alongside either of 626*4882a593Smuzhiyun# password_file or acl_file then the plugin checks will be made first. 627*4882a593Smuzhiyun# 628*4882a593Smuzhiyun# If the per_listener_settings option is false, the plugin will be apply to all 629*4882a593Smuzhiyun# listeners. If per_listener_settings is true, then the plugin will apply to 630*4882a593Smuzhiyun# the current listener being defined only. 631*4882a593Smuzhiyun# 632*4882a593Smuzhiyun# This option is also available as `auth_plugin`, but this use is deprecated 633*4882a593Smuzhiyun# and will be removed in the future. 634*4882a593Smuzhiyun# 635*4882a593Smuzhiyun#plugin 636*4882a593Smuzhiyun 637*4882a593Smuzhiyun# If the plugin option above is used, define options to pass to the 638*4882a593Smuzhiyun# plugin here as described by the plugin instructions. All options named 639*4882a593Smuzhiyun# using the format plugin_opt_* will be passed to the plugin, for example: 640*4882a593Smuzhiyun# 641*4882a593Smuzhiyun# This option is also available as `auth_opt_*`, but this use is deprecated 642*4882a593Smuzhiyun# and will be removed in the future. 643*4882a593Smuzhiyun# 644*4882a593Smuzhiyun# plugin_opt_db_host 645*4882a593Smuzhiyun# plugin_opt_db_port 646*4882a593Smuzhiyun# plugin_opt_db_username 647*4882a593Smuzhiyun# plugin_opt_db_password 648*4882a593Smuzhiyun 649*4882a593Smuzhiyun 650*4882a593Smuzhiyun# ================================================================= 651*4882a593Smuzhiyun# Bridges 652*4882a593Smuzhiyun# ================================================================= 653*4882a593Smuzhiyun 654*4882a593Smuzhiyun# A bridge is a way of connecting multiple MQTT brokers together. 655*4882a593Smuzhiyun# Create a new bridge using the "connection" option as described below. Set 656*4882a593Smuzhiyun# options for the bridges using the remaining parameters. You must specify the 657*4882a593Smuzhiyun# address and at least one topic to subscribe to. 658*4882a593Smuzhiyun# 659*4882a593Smuzhiyun# Each connection must have a unique name. 660*4882a593Smuzhiyun# 661*4882a593Smuzhiyun# The address line may have multiple host address and ports specified. See 662*4882a593Smuzhiyun# below in the round_robin description for more details on bridge behaviour if 663*4882a593Smuzhiyun# multiple addresses are used. Note that if you use an IPv6 address, then you 664*4882a593Smuzhiyun# are required to specify a port. 665*4882a593Smuzhiyun# 666*4882a593Smuzhiyun# The direction that the topic will be shared can be chosen by 667*4882a593Smuzhiyun# specifying out, in or both, where the default value is out. 668*4882a593Smuzhiyun# The QoS level of the bridged communication can be specified with the next 669*4882a593Smuzhiyun# topic option. The default QoS level is 0, to change the QoS the topic 670*4882a593Smuzhiyun# direction must also be given. 671*4882a593Smuzhiyun# 672*4882a593Smuzhiyun# The local and remote prefix options allow a topic to be remapped when it is 673*4882a593Smuzhiyun# bridged to/from the remote broker. This provides the ability to place a topic 674*4882a593Smuzhiyun# tree in an appropriate location. 675*4882a593Smuzhiyun# 676*4882a593Smuzhiyun# For more details see the mosquitto.conf man page. 677*4882a593Smuzhiyun# 678*4882a593Smuzhiyun# Multiple topics can be specified per connection, but be careful 679*4882a593Smuzhiyun# not to create any loops. 680*4882a593Smuzhiyun# 681*4882a593Smuzhiyun# If you are using bridges with cleansession set to false (the default), then 682*4882a593Smuzhiyun# you may get unexpected behaviour from incoming topics if you change what 683*4882a593Smuzhiyun# topics you are subscribing to. This is because the remote broker keeps the 684*4882a593Smuzhiyun# subscription for the old topic. If you have this problem, connect your bridge 685*4882a593Smuzhiyun# with cleansession set to true, then reconnect with cleansession set to false 686*4882a593Smuzhiyun# as normal. 687*4882a593Smuzhiyun#connection <name> 688*4882a593Smuzhiyun#address <host>[:<port>] [<host>[:<port>]] 689*4882a593Smuzhiyun#topic <topic> [[[out | in | both] qos-level] local-prefix remote-prefix] 690*4882a593Smuzhiyun 691*4882a593Smuzhiyun# If you need to have the bridge connect over a particular network interface, 692*4882a593Smuzhiyun# use bridge_bind_address to tell the bridge which local IP address the socket 693*4882a593Smuzhiyun# should bind to, e.g. `bridge_bind_address 192.168.1.10` 694*4882a593Smuzhiyun#bridge_bind_address 695*4882a593Smuzhiyun 696*4882a593Smuzhiyun# If a bridge has topics that have "out" direction, the default behaviour is to 697*4882a593Smuzhiyun# send an unsubscribe request to the remote broker on that topic. This means 698*4882a593Smuzhiyun# that changing a topic direction from "in" to "out" will not keep receiving 699*4882a593Smuzhiyun# incoming messages. Sending these unsubscribe requests is not always 700*4882a593Smuzhiyun# desirable, setting bridge_attempt_unsubscribe to false will disable sending 701*4882a593Smuzhiyun# the unsubscribe request. 702*4882a593Smuzhiyun#bridge_attempt_unsubscribe true 703*4882a593Smuzhiyun 704*4882a593Smuzhiyun# Set the version of the MQTT protocol to use with for this bridge. Can be one 705*4882a593Smuzhiyun# of mqttv50, mqttv311 or mqttv31. Defaults to mqttv311. 706*4882a593Smuzhiyun#bridge_protocol_version mqttv311 707*4882a593Smuzhiyun 708*4882a593Smuzhiyun# Set the clean session variable for this bridge. 709*4882a593Smuzhiyun# When set to true, when the bridge disconnects for any reason, all 710*4882a593Smuzhiyun# messages and subscriptions will be cleaned up on the remote 711*4882a593Smuzhiyun# broker. Note that with cleansession set to true, there may be a 712*4882a593Smuzhiyun# significant amount of retained messages sent when the bridge 713*4882a593Smuzhiyun# reconnects after losing its connection. 714*4882a593Smuzhiyun# When set to false, the subscriptions and messages are kept on the 715*4882a593Smuzhiyun# remote broker, and delivered when the bridge reconnects. 716*4882a593Smuzhiyun#cleansession false 717*4882a593Smuzhiyun 718*4882a593Smuzhiyun# Set the amount of time a bridge using the lazy start type must be idle before 719*4882a593Smuzhiyun# it will be stopped. Defaults to 60 seconds. 720*4882a593Smuzhiyun#idle_timeout 60 721*4882a593Smuzhiyun 722*4882a593Smuzhiyun# Set the keepalive interval for this bridge connection, in 723*4882a593Smuzhiyun# seconds. 724*4882a593Smuzhiyun#keepalive_interval 60 725*4882a593Smuzhiyun 726*4882a593Smuzhiyun# Set the clientid to use on the local broker. If not defined, this defaults to 727*4882a593Smuzhiyun# 'local.<clientid>'. If you are bridging a broker to itself, it is important 728*4882a593Smuzhiyun# that local_clientid and clientid do not match. 729*4882a593Smuzhiyun#local_clientid 730*4882a593Smuzhiyun 731*4882a593Smuzhiyun# If set to true, publish notification messages to the local and remote brokers 732*4882a593Smuzhiyun# giving information about the state of the bridge connection. Retained 733*4882a593Smuzhiyun# messages are published to the topic $SYS/broker/connection/<clientid>/state 734*4882a593Smuzhiyun# unless the notification_topic option is used. 735*4882a593Smuzhiyun# If the message is 1 then the connection is active, or 0 if the connection has 736*4882a593Smuzhiyun# failed. 737*4882a593Smuzhiyun# This uses the last will and testament feature. 738*4882a593Smuzhiyun#notifications true 739*4882a593Smuzhiyun 740*4882a593Smuzhiyun# Choose the topic on which notification messages for this bridge are 741*4882a593Smuzhiyun# published. If not set, messages are published on the topic 742*4882a593Smuzhiyun# $SYS/broker/connection/<clientid>/state 743*4882a593Smuzhiyun#notification_topic 744*4882a593Smuzhiyun 745*4882a593Smuzhiyun# Set the client id to use on the remote end of this bridge connection. If not 746*4882a593Smuzhiyun# defined, this defaults to 'name.hostname' where name is the connection name 747*4882a593Smuzhiyun# and hostname is the hostname of this computer. 748*4882a593Smuzhiyun# This replaces the old "clientid" option to avoid confusion. "clientid" 749*4882a593Smuzhiyun# remains valid for the time being. 750*4882a593Smuzhiyun#remote_clientid 751*4882a593Smuzhiyun 752*4882a593Smuzhiyun# Set the password to use when connecting to a broker that requires 753*4882a593Smuzhiyun# authentication. This option is only used if remote_username is also set. 754*4882a593Smuzhiyun# This replaces the old "password" option to avoid confusion. "password" 755*4882a593Smuzhiyun# remains valid for the time being. 756*4882a593Smuzhiyun#remote_password 757*4882a593Smuzhiyun 758*4882a593Smuzhiyun# Set the username to use when connecting to a broker that requires 759*4882a593Smuzhiyun# authentication. 760*4882a593Smuzhiyun# This replaces the old "username" option to avoid confusion. "username" 761*4882a593Smuzhiyun# remains valid for the time being. 762*4882a593Smuzhiyun#remote_username 763*4882a593Smuzhiyun 764*4882a593Smuzhiyun# Set the amount of time a bridge using the automatic start type will wait 765*4882a593Smuzhiyun# until attempting to reconnect. 766*4882a593Smuzhiyun# This option can be configured to use a constant delay time in seconds, or to 767*4882a593Smuzhiyun# use a backoff mechanism based on "Decorrelated Jitter", which adds a degree 768*4882a593Smuzhiyun# of randomness to when the restart occurs. 769*4882a593Smuzhiyun# 770*4882a593Smuzhiyun# Set a constant timeout of 20 seconds: 771*4882a593Smuzhiyun# restart_timeout 20 772*4882a593Smuzhiyun# 773*4882a593Smuzhiyun# Set backoff with a base (start value) of 10 seconds and a cap (upper limit) of 774*4882a593Smuzhiyun# 60 seconds: 775*4882a593Smuzhiyun# restart_timeout 10 30 776*4882a593Smuzhiyun# 777*4882a593Smuzhiyun# Defaults to jitter with a base of 5 and cap of 30 778*4882a593Smuzhiyun#restart_timeout 5 30 779*4882a593Smuzhiyun 780*4882a593Smuzhiyun# If the bridge has more than one address given in the address/addresses 781*4882a593Smuzhiyun# configuration, the round_robin option defines the behaviour of the bridge on 782*4882a593Smuzhiyun# a failure of the bridge connection. If round_robin is false, the default 783*4882a593Smuzhiyun# value, then the first address is treated as the main bridge connection. If 784*4882a593Smuzhiyun# the connection fails, the other secondary addresses will be attempted in 785*4882a593Smuzhiyun# turn. Whilst connected to a secondary bridge, the bridge will periodically 786*4882a593Smuzhiyun# attempt to reconnect to the main bridge until successful. 787*4882a593Smuzhiyun# If round_robin is true, then all addresses are treated as equals. If a 788*4882a593Smuzhiyun# connection fails, the next address will be tried and if successful will 789*4882a593Smuzhiyun# remain connected until it fails 790*4882a593Smuzhiyun#round_robin false 791*4882a593Smuzhiyun 792*4882a593Smuzhiyun# Set the start type of the bridge. This controls how the bridge starts and 793*4882a593Smuzhiyun# can be one of three types: automatic, lazy and once. Note that RSMB provides 794*4882a593Smuzhiyun# a fourth start type "manual" which isn't currently supported by mosquitto. 795*4882a593Smuzhiyun# 796*4882a593Smuzhiyun# "automatic" is the default start type and means that the bridge connection 797*4882a593Smuzhiyun# will be started automatically when the broker starts and also restarted 798*4882a593Smuzhiyun# after a short delay (30 seconds) if the connection fails. 799*4882a593Smuzhiyun# 800*4882a593Smuzhiyun# Bridges using the "lazy" start type will be started automatically when the 801*4882a593Smuzhiyun# number of queued messages exceeds the number set with the "threshold" 802*4882a593Smuzhiyun# parameter. It will be stopped automatically after the time set by the 803*4882a593Smuzhiyun# "idle_timeout" parameter. Use this start type if you wish the connection to 804*4882a593Smuzhiyun# only be active when it is needed. 805*4882a593Smuzhiyun# 806*4882a593Smuzhiyun# A bridge using the "once" start type will be started automatically when the 807*4882a593Smuzhiyun# broker starts but will not be restarted if the connection fails. 808*4882a593Smuzhiyun#start_type automatic 809*4882a593Smuzhiyun 810*4882a593Smuzhiyun# Set the number of messages that need to be queued for a bridge with lazy 811*4882a593Smuzhiyun# start type to be restarted. Defaults to 10 messages. 812*4882a593Smuzhiyun# Must be less than max_queued_messages. 813*4882a593Smuzhiyun#threshold 10 814*4882a593Smuzhiyun 815*4882a593Smuzhiyun# If try_private is set to true, the bridge will attempt to indicate to the 816*4882a593Smuzhiyun# remote broker that it is a bridge not an ordinary client. If successful, this 817*4882a593Smuzhiyun# means that loop detection will be more effective and that retained messages 818*4882a593Smuzhiyun# will be propagated correctly. Not all brokers support this feature so it may 819*4882a593Smuzhiyun# be necessary to set try_private to false if your bridge does not connect 820*4882a593Smuzhiyun# properly. 821*4882a593Smuzhiyun#try_private true 822*4882a593Smuzhiyun 823*4882a593Smuzhiyun# Some MQTT brokers do not allow retained messages. MQTT v5 gives a mechanism 824*4882a593Smuzhiyun# for brokers to tell clients that they do not support retained messages, but 825*4882a593Smuzhiyun# this is not possible for MQTT v3.1.1 or v3.1. If you need to bridge to a 826*4882a593Smuzhiyun# v3.1.1 or v3.1 broker that does not support retained messages, set the 827*4882a593Smuzhiyun# bridge_outgoing_retain option to false. This will remove the retain bit on 828*4882a593Smuzhiyun# all outgoing messages to that bridge, regardless of any other setting. 829*4882a593Smuzhiyun#bridge_outgoing_retain true 830*4882a593Smuzhiyun 831*4882a593Smuzhiyun# If you wish to restrict the size of messages sent to a remote bridge, use the 832*4882a593Smuzhiyun# bridge_max_packet_size option. This sets the maximum number of bytes for 833*4882a593Smuzhiyun# the total message, including headers and payload. 834*4882a593Smuzhiyun# Note that MQTT v5 brokers may provide their own maximum-packet-size property. 835*4882a593Smuzhiyun# In this case, the smaller of the two limits will be used. 836*4882a593Smuzhiyun# Set to 0 for "unlimited". 837*4882a593Smuzhiyun#bridge_max_packet_size 0 838*4882a593Smuzhiyun 839*4882a593Smuzhiyun 840*4882a593Smuzhiyun# ----------------------------------------------------------------- 841*4882a593Smuzhiyun# Certificate based SSL/TLS support 842*4882a593Smuzhiyun# ----------------------------------------------------------------- 843*4882a593Smuzhiyun# Either bridge_cafile or bridge_capath must be defined to enable TLS support 844*4882a593Smuzhiyun# for this bridge. 845*4882a593Smuzhiyun# bridge_cafile defines the path to a file containing the 846*4882a593Smuzhiyun# Certificate Authority certificates that have signed the remote broker 847*4882a593Smuzhiyun# certificate. 848*4882a593Smuzhiyun# bridge_capath defines a directory that will be searched for files containing 849*4882a593Smuzhiyun# the CA certificates. For bridge_capath to work correctly, the certificate 850*4882a593Smuzhiyun# files must have ".crt" as the file ending and you must run "openssl rehash 851*4882a593Smuzhiyun# <path to capath>" each time you add/remove a certificate. 852*4882a593Smuzhiyun#bridge_cafile 853*4882a593Smuzhiyun#bridge_capath 854*4882a593Smuzhiyun 855*4882a593Smuzhiyun 856*4882a593Smuzhiyun# If the remote broker has more than one protocol available on its port, e.g. 857*4882a593Smuzhiyun# MQTT and WebSockets, then use bridge_alpn to configure which protocol is 858*4882a593Smuzhiyun# requested. Note that WebSockets support for bridges is not yet available. 859*4882a593Smuzhiyun#bridge_alpn 860*4882a593Smuzhiyun 861*4882a593Smuzhiyun# When using certificate based encryption, bridge_insecure disables 862*4882a593Smuzhiyun# verification of the server hostname in the server certificate. This can be 863*4882a593Smuzhiyun# useful when testing initial server configurations, but makes it possible for 864*4882a593Smuzhiyun# a malicious third party to impersonate your server through DNS spoofing, for 865*4882a593Smuzhiyun# example. Use this option in testing only. If you need to resort to using this 866*4882a593Smuzhiyun# option in a production environment, your setup is at fault and there is no 867*4882a593Smuzhiyun# point using encryption. 868*4882a593Smuzhiyun#bridge_insecure false 869*4882a593Smuzhiyun 870*4882a593Smuzhiyun# Path to the PEM encoded client certificate, if required by the remote broker. 871*4882a593Smuzhiyun#bridge_certfile 872*4882a593Smuzhiyun 873*4882a593Smuzhiyun# Path to the PEM encoded client private key, if required by the remote broker. 874*4882a593Smuzhiyun#bridge_keyfile 875*4882a593Smuzhiyun 876*4882a593Smuzhiyun# ----------------------------------------------------------------- 877*4882a593Smuzhiyun# PSK based SSL/TLS support 878*4882a593Smuzhiyun# ----------------------------------------------------------------- 879*4882a593Smuzhiyun# Pre-shared-key encryption provides an alternative to certificate based 880*4882a593Smuzhiyun# encryption. A bridge can be configured to use PSK with the bridge_identity 881*4882a593Smuzhiyun# and bridge_psk options. These are the client PSK identity, and pre-shared-key 882*4882a593Smuzhiyun# in hexadecimal format with no "0x". Only one of certificate and PSK based 883*4882a593Smuzhiyun# encryption can be used on one 884*4882a593Smuzhiyun# bridge at once. 885*4882a593Smuzhiyun#bridge_identity 886*4882a593Smuzhiyun#bridge_psk 887*4882a593Smuzhiyun 888*4882a593Smuzhiyun 889*4882a593Smuzhiyun# ================================================================= 890*4882a593Smuzhiyun# External config files 891*4882a593Smuzhiyun# ================================================================= 892*4882a593Smuzhiyun 893*4882a593Smuzhiyun# External configuration files may be included by using the 894*4882a593Smuzhiyun# include_dir option. This defines a directory that will be searched 895*4882a593Smuzhiyun# for config files. All files that end in '.conf' will be loaded as 896*4882a593Smuzhiyun# a configuration file. It is best to have this as the last option 897*4882a593Smuzhiyun# in the main file. This option will only be processed from the main 898*4882a593Smuzhiyun# configuration file. The directory specified must not contain the 899*4882a593Smuzhiyun# main configuration file. 900*4882a593Smuzhiyun# Files within include_dir will be loaded sorted in case-sensitive 901*4882a593Smuzhiyun# alphabetical order, with capital letters ordered first. If this option is 902*4882a593Smuzhiyun# given multiple times, all of the files from the first instance will be 903*4882a593Smuzhiyun# processed before the next instance. See the man page for examples. 904*4882a593Smuzhiyun#include_dir 905