mosquitto.conf 39 KB

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