mosquitto.conf 37 KB

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