ConfigExample

Config file for mosquitto

See mosquitto.conf(5) for more information. Default values are shown, uncomment to change.

Use the # character to indicate a comment, but only if it is the very first character on the line.

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