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# ================================================================= 11# General configuration 12# ================================================================= 13 14# Time in seconds to wait before resending an outgoing QoS=1 or 15# QoS=2 message. 16#retry_interval 20 17 18# Time in seconds between updates of the $SYS tree. 19# Set to 0 to disable the publishing of the $SYS tree. 20#sys_interval 10 21 22# Time in seconds between cleaning the internal message store of 23# unreferenced messages. Lower values will result in lower memory 24# usage but more processor time, higher values will have the 25# opposite effect. 26# Setting a value of 0 means the unreferenced messages will be 27# disposed of as quickly as possible. 28#store_clean_interval 10 29 30# Write process id to a file. Default is a blank string which means 31# a pid file shouldn't be written. 32# This should be set to /var/run/mosquitto.pid if mosquitto is 33# being run automatically on boot with an init script and 34# start-stop-daemon or similar. 35#pid_file 36 37# When run as root, drop privileges to this user and its primary 38# group. 39# Leave blank to stay as root, but this is not recommended. 40# If run as a non-root user, this setting has no effect. 41# Note that on Windows this has no effect and so mosquitto should 42# be started by the user you wish it to run as. 43#user mosquitto 44 45# The maximum number of QoS 1 and 2 messages currently inflight per 46# client. 47# This includes messages that are partway through handshakes and 48# those that are being retried. Defaults to 20. Set to 0 for no 49# maximum. Setting to 1 will guarantee in-order delivery of QoS 1 50# and 2 messages. 51#max_inflight_messages 20 52 53# The maximum number of QoS 1 and 2 messages to hold in a queue 54# above those that are currently in-flight. Defaults to 100. Set 55# to 0 for no maximum (not recommended). 56# See also queue_qos0_messages. 57#max_queued_messages 100 58 59# Set to true to queue messages with QoS 0 when a persistent client is 60# disconnected. These messages are included in the limit imposed by 61# max_queued_messages. 62# Defaults to false. 63# This is a non-standard option for the MQTT v3.1 spec but is allowed in 64# v3.1.1. 65#queue_qos0_messages false 66 67# This option sets the maximum publish payload size that the broker will allow. 68# Received messages that exceed this size will not be accepted by the broker. 69# The default value is 0, which means that all valid MQTT messages are 70# accepted. MQTT imposes a maximum payload size of 268435455 bytes. 71#message_size_limit 0 72 73# This option controls whether a client is allowed to connect with a zero 74# length client id or not. This option only affects clients using MQTT v3.1.1 75# and later. If set to false, clients connecting with a zero length client id 76# are disconnected. If set to true, clients will be allocated a client id by 77# the broker. This means it is only useful for clients with clean session set 78# to true. 79#allow_zero_length_clientid true 80 81# If allow_zero_length_clientid is true, this option allows you to set a prefix 82# to automatically generated client ids to aid visibility in logs. 83#auto_id_prefix 84 85# This option allows persistent clients (those with clean session set to false) 86# to be removed if they do not reconnect within a certain time frame. 87# 88# This is a non-standard option in MQTT V3.1 but allowed in MQTT v3.1.1. 89# 90# Badly designed clients may set clean session to false whilst using a randomly 91# generated client id. This leads to persistent clients that will never 92# reconnect. This option allows these clients to be removed. 93# 94# The expiration period should be an integer followed by one of h d w m y for 95# hour, day, week, month and year respectively. For example 96# 97# persistent_client_expiration 2m 98# persistent_client_expiration 14d 99# persistent_client_expiration 1y 100# 101# The default if not set is to never expire persistent clients. 102#persistent_client_expiration 103 104# If a client is subscribed to multiple subscriptions that overlap, e.g. foo/# 105# and foo/+/baz , then MQTT expects that when the broker receives a message on 106# a topic that matches both subscriptions, such as foo/bar/baz, then the client 107# should only receive the message once. 108# Mosquitto keeps track of which clients a message has been sent to in order to 109# meet this requirement. The allow_duplicate_messages option allows this 110# behaviour to be disabled, which may be useful if you have a large number of 111# clients subscribed to the same set of topics and are very concerned about 112# minimising memory usage. 113# It can be safely set to true if you know in advance that your clients will 114# never have overlapping subscriptions, otherwise your clients must be able to 115# correctly deal with duplicate messages even when then have QoS=2. 116#allow_duplicate_messages false 117 118# The MQTT specification requires that the QoS of a message delivered to a 119# subscriber is never upgraded to match the QoS of the subscription. Enabling 120# this option changes this behaviour. If upgrade_outgoing_qos is set true, 121# messages sent to a subscriber will always match the QoS of its subscription. 122# This is a non-standard option explicitly disallowed by the spec. 123#upgrade_outgoing_qos false 124 125# ================================================================= 126# Default listener 127# ================================================================= 128 129# IP address/hostname to bind the default listener to. If not 130# given, the default listener will not be bound to a specific 131# address and so will be accessible to all network interfaces. 132# bind_address ip-address/host name 133#bind_address 134 135# Port to use for the default listener. 136#port 1883 137listener 8884 138 139# The maximum number of client connections to allow. This is 140# a per listener setting. 141# Default is -1, which means unlimited connections. 142# Note that other process limits mean that unlimited connections 143# are not really possible. Typically the default maximum number of 144# connections possible is around 1024. 145#max_connections -1 146 147# Choose the protocol to use when listening. 148# This can be either mqtt or websockets. 149# Websockets support is currently disabled by default at compile time. 150# Certificate based TLS may be used with websockets, except that 151# only the cafile, certfile, keyfile and ciphers options are supported. 152#protocol mqtt 153 154# When a listener is using the websockets protocol, it is possible to serve 155# http data as well. Set http_dir to a directory which contains the files you 156# wish to serve. If this option is not specified, then no normal http 157# connections will be possible. 158#http_dir 159 160# Set use_username_as_clientid to true to replace the clientid that a client 161# connected with with its username. This allows authentication to be tied to 162# the clientid, which means that it is possible to prevent one client 163# disconnecting another by using the same clientid. 164# If a client connects with no username it will be disconnected as not 165# authorised when this option is set to true. 166# Do not use in conjunction with clientid_prefixes. 167# See also use_identity_as_username. 168#use_username_as_clientid 169 170# ----------------------------------------------------------------- 171# Certificate based SSL/TLS support 172# ----------------------------------------------------------------- 173# The following options can be used to enable SSL/TLS support for 174# this listener. Note that the recommended port for MQTT over TLS 175# is 8883, but this must be set manually. 176# 177# See also the mosquitto-tls man page. 178 179# At least one of cafile or capath must be defined. They both 180# define methods of accessing the PEM encoded Certificate 181# Authority certificates that have signed your server certificate 182# and that you wish to trust. 183# cafile defines the path to a file containing the CA certificates. 184# capath defines a directory that will be searched for files 185# containing the CA certificates. For capath to work correctly, the 186# certificate files must have ".crt" as the file ending and you must run 187# "c_rehash <path to capath>" each time you add/remove a certificate. 188#cafile 189#capath 190 191# Path to the PEM encoded server certificate. 192#certfile 193 194 195# Path to the PEM encoded keyfile. 196#keyfile 197 198# This option defines the version of the TLS protocol to use for this listener. 199# The default value allows v1.2, v1.1 and v1.0, if they are all supported by 200# the version of openssl that the broker was compiled against. For openssl >= 201# 1.0.1 the valid values are tlsv1.2 tlsv1.1 and tlsv1. For openssl < 1.0.1 the 202# valid values are tlsv1. 203#tls_version 204 205# By default a TLS enabled listener will operate in a similar fashion to a 206# https enabled web server, in that the server has a certificate signed by a CA 207# and the client will verify that it is a trusted certificate. The overall aim 208# is encryption of the network traffic. By setting require_certificate to true, 209# the client must provide a valid certificate in order for the network 210# connection to proceed. This allows access to the broker to be controlled 211# outside of the mechanisms provided by MQTT. 212#require_certificate false 213 214# If require_certificate is true, you may set use_identity_as_username to true 215# to use the CN value from the client certificate as a username. If this is 216# true, the password_file option will not be used for this listener. 217#use_identity_as_username false 218 219# If you have require_certificate set to true, you can create a certificate 220# revocation list file to revoke access to particular client certificates. If 221# you have done this, use crlfile to point to the PEM encoded revocation file. 222#crlfile 223 224# If you wish to control which encryption ciphers are used, use the ciphers 225# option. The list of available ciphers can be optained using the "openssl 226# ciphers" command and should be provided in the same format as the output of 227# that command. 228# If unset defaults to DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:@STRENGTH 229#ciphers DEFAULT:!aNULL:!eNULL:!LOW:!EXPORT:!SSLv2:@STRENGTH 230 231# ----------------------------------------------------------------- 232# Pre-shared-key based SSL/TLS support 233# ----------------------------------------------------------------- 234# The following options can be used to enable PSK based SSL/TLS support for 235# this listener. Note that the recommended port for MQTT over TLS is 8883, but 236# this must be set manually. 237# 238# See also the mosquitto-tls man page and the "Certificate based SSL/TLS 239# support" section. Only one of certificate or PSK encryption support can be 240# enabled for any listener. 241 242# The psk_hint option enables pre-shared-key support for this listener and also 243# acts as an identifier for this listener. The hint is sent to clients and may 244# be used locally to aid authentication. The hint is a free form string that 245# doesn't have much meaning in itself, so feel free to be creative. 246# If this option is provided, see psk_file to define the pre-shared keys to be 247# used or create a security plugin to handle them. 248psk_hint Client_identity 249 250# Set use_identity_as_username to have the psk identity sent by the client used 251# as its username. Authentication will be carried out using the PSK rather than 252# the MQTT username/password and so password_file will not be used for this 253# listener. 254use_identity_as_username true 255 256# When using PSK, the encryption ciphers used will be chosen from the list of 257# available PSK ciphers. If you want to control which ciphers are available, 258# use the "ciphers" option. The list of available ciphers can be optained 259# using the "openssl ciphers" command and should be provided in the same format 260# as the output of that command. 261#ciphers 262 263# ================================================================= 264# Persistence 265# ================================================================= 266 267# If persistence is enabled, save the in-memory database to disk 268# every autosave_interval seconds. If set to 0, the persistence 269# database will only be written when mosquitto exits. See also 270# autosave_on_changes. 271# Note that writing of the persistence database can be forced by 272# sending mosquitto a SIGUSR1 signal. 273#autosave_interval 1800 274 275# If true, mosquitto will count the number of subscription changes, retained 276# messages received and queued messages and if the total exceeds 277# autosave_interval then the in-memory database will be saved to disk. 278# If false, mosquitto will save the in-memory database to disk by treating 279# autosave_interval as a time in seconds. 280#autosave_on_changes false 281 282# Save persistent message data to disk (true/false). 283# This saves information about all messages, including 284# subscriptions, currently in-flight messages and retained 285# messages. 286# retained_persistence is a synonym for this option. 287#persistence false 288 289# The filename to use for the persistent database, not including 290# the path. 291#persistence_file mosquitto.db 292 293# Location for persistent database. Must include trailing / 294# Default is an empty string (current directory). 295# Set to e.g. /var/lib/mosquitto/ if running as a proper service on Linux or 296# similar. 297#persistence_location 298 299# ================================================================= 300# Logging 301# ================================================================= 302 303# Places to log to. Use multiple log_dest lines for multiple 304# logging destinations. 305# Possible destinations are: stdout stderr syslog topic file 306# 307# stdout and stderr log to the console on the named output. 308# 309# syslog uses the userspace syslog facility which usually ends up 310# in /var/log/messages or similar. 311# 312# topic logs to the broker topic '$SYS/broker/log/<severity>', 313# where severity is one of D, E, W, N, I, M which are debug, error, 314# warning, notice, information and message. Message type severity is used by 315# the subscribe/unsubscribe log_types and publishes log messages to 316# $SYS/broker/log/M/susbcribe or $SYS/broker/log/M/unsubscribe. 317# 318# The file destination requires an additional parameter which is the file to be 319# logged to, e.g. "log_dest file /var/log/mosquitto.log". The file will be 320# closed and reopened when the broker receives a HUP signal. Only a single file 321# destination may be configured. 322# 323# Note that if the broker is running as a Windows service it will default to 324# "log_dest none" and neither stdout nor stderr logging is available. 325# Use "log_dest none" if you wish to disable logging. 326#log_dest stderr 327 328# If using syslog logging (not on Windows), messages will be logged to the 329# "daemon" facility by default. Use the log_facility option to choose which of 330# local0 to local7 to log to instead. The option value should be an integer 331# value, e.g. "log_facility 5" to use local5. 332#log_facility 333 334# Types of messages to log. Use multiple log_type lines for logging 335# multiple types of messages. 336# Possible types are: debug, error, warning, notice, information, 337# none, subscribe, unsubscribe, websockets, all. 338# Note that debug type messages are for decoding the incoming/outgoing 339# network packets. They are not logged in "topics". 340#log_type error 341#log_type warning 342#log_type notice 343#log_type information 344 345# Change the websockets logging level. This is a global option, it is not 346# possible to set per listener. This is an integer that is interpreted by 347# libwebsockets as a bit mask for its lws_log_levels enum. See the 348# libwebsockets documentation for more details. "log_type websockets" must also 349# be enabled. 350#websockets_log_level 0 351 352# If set to true, client connection and disconnection messages will be included 353# in the log. 354#connection_messages true 355 356# If set to true, add a timestamp value to each log message. 357#log_timestamp true 358 359# ================================================================= 360# Security 361# ================================================================= 362 363# If set, only clients that have a matching prefix on their 364# clientid will be allowed to connect to the broker. By default, 365# all clients may connect. 366# For example, setting "secure-" here would mean a client "secure- 367# client" could connect but another with clientid "mqtt" couldn't. 368#clientid_prefixes 369 370# Boolean value that determines whether clients that connect 371# without providing a username are allowed to connect. If set to 372# false then a password file should be created (see the 373# password_file option) to control authenticated client access. 374# Defaults to true. 375allow_anonymous true 376 377# In addition to the clientid_prefixes, allow_anonymous and TLS 378# authentication options, username based authentication is also 379# possible. The default support is described in "Default 380# authentication and topic access control" below. The auth_plugin 381# allows another authentication method to be used. 382# Specify the path to the loadable plugin and see the 383# "Authentication and topic access plugin options" section below. 384#auth_plugin 385 386# ----------------------------------------------------------------- 387# Default authentication and topic access control 388# ----------------------------------------------------------------- 389 390# Control access to the broker using a password file. This file can be 391# generated using the mosquitto_passwd utility. If TLS support is not compiled 392# into mosquitto (it is recommended that TLS support should be included) then 393# plain text passwords are used, in which case the file should be a text file 394# with lines in the format: 395# username:password 396# The password (and colon) may be omitted if desired, although this 397# offers very little in the way of security. 398# 399# See the TLS client require_certificate and use_identity_as_username options 400# for alternative authentication options. 401#password_file 402 403# Access may also be controlled using a pre-shared-key file. This requires 404# TLS-PSK support and a listener configured to use it. The file should be text 405# lines in the format: 406# identity:key 407# The key should be in hexadecimal format without a leading "0x". 408psk_file ./psk_file.txt 409 410# Control access to topics on the broker using an access control list 411# file. If this parameter is defined then only the topics listed will 412# have access. 413# If the first character of a line of the ACL file is a # it is treated as a 414# comment. 415# Topic access is added with lines of the format: 416# 417# topic [read|write|readwrite] <topic> 418# 419# The access type is controlled using "read", "write" or "readwrite". This 420# parameter is optional (unless <topic> contains a space character) - if not 421# given then the access is read/write. <topic> can contain the + or # 422# wildcards as in subscriptions. 423# 424# The first set of topics are applied to anonymous clients, assuming 425# allow_anonymous is true. User specific topic ACLs are added after a 426# user line as follows: 427# 428# user <username> 429# 430# The username referred to here is the same as in password_file. It is 431# not the clientid. 432# 433# 434# If is also possible to define ACLs based on pattern substitution within the 435# topic. The patterns available for substition are: 436# 437# %c to match the client id of the client 438# %u to match the username of the client 439# 440# The substitution pattern must be the only text for that level of hierarchy. 441# 442# The form is the same as for the topic keyword, but using pattern as the 443# keyword. 444# Pattern ACLs apply to all users even if the "user" keyword has previously 445# been given. 446# 447# If using bridges with usernames and ACLs, connection messages can be allowed 448# with the following pattern: 449# pattern write $SYS/broker/connection/%c/state 450# 451# pattern [read|write|readwrite] <topic> 452# 453# Example: 454# 455# pattern write sensor/%u/data 456# 457#acl_file 458 459# ----------------------------------------------------------------- 460# Authentication and topic access plugin options 461# ----------------------------------------------------------------- 462 463# If the auth_plugin option above is used, define options to pass to the 464# plugin here as described by the plugin instructions. All options named 465# using the format auth_opt_* will be passed to the plugin, for example: 466# 467# auth_opt_db_host 468# auth_opt_db_port 469# auth_opt_db_username 470# auth_opt_db_password 471 472# ================================================================= 473# External config files 474# ================================================================= 475 476# External configuration files may be included by using the 477# include_dir option. This defines a directory that will be searched 478# for config files. All files that end in '.conf' will be loaded as 479# a configuration file. It is best to have this as the last option 480# in the main file. This option will only be processed from the main 481# configuration file. The directory specified must not contain the 482# main configuration file. 483#include_dir 484 485# ================================================================= 486# rsmb options - unlikely to ever be supported 487# ================================================================= 488 489#ffdc_output 490#max_log_entries 491#trace_level 492#trace_output 493