mosquitto-broker-conf-example.txt 38 KB

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