mosquitto_ctrl.1 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163
  1. '\" t
  2. .\" Title: mosquitto_ctrl
  3. .\" Author: [see the "Author" section]
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 10/27/2021
  6. .\" Manual: Commands
  7. .\" Source: Mosquitto Project
  8. .\" Language: English
  9. .\"
  10. .TH "MOSQUITTO_CTRL" "1" "10/27/2021" "Mosquitto Project" "Commands"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. mosquitto_ctrl \- a tool for initialising/configuring a Mosquitto broker instance
  32. .SH "SYNOPSIS"
  33. .HP \w'\fBmosquitto_ctrl\fR\ 'u
  34. \fBmosquitto_ctrl\fR [connection\-options\ |\ \-o\ config\-file] module\-name module\-command [command\-options]
  35. .HP \w'\fBconnection\-options:\fR\ 'u
  36. \fBconnection\-options:\fR {[\fB\-h\fR\ \fIhostname\fR]\ [\fB\-\-unix\fR\ \fIsocket\ path\fR]\ [\fB\-p\fR\ \fIport\-number\fR]\ [\fB\-u\fR\ \fIusername\fR]\ [\fB\-P\fR\ \fIpassword\fR] | \fB\-L\fR\ \fIURL\fR} [\fB\-A\fR\ \fIbind\-address\fR] [\fB\-c\fR] [\fB\-d\fR] [\fB\-i\fR\ \fIclient\-id\fR] [\fB\-q\fR\ \fImessage\-QoS\fR] [\fB\-\-quiet\fR] [\fB\-V\fR\ \fIprotocol\-version\fR] [[{\fB\-\-cafile\fR\ \fIfile\fR\ |\ \fB\-\-capath\fR\ \fIdir\fR}\ [\fB\-\-cert\fR\ \fIfile\fR]\ [\fB\-\-key\fR\ \fIfile\fR]\ [\fB\-\-ciphers\fR\ \fIciphers\fR]\ [\fB\-\-tls\-version\fR\ \fIversion\fR]\ [\fB\-\-tls\-alpn\fR\ \fIprotocol\fR]\ [\fB\-\-tls\-engine\fR\ \fIengine\fR]\ [\fB\-\-keyform\fR\ {\fIpem\fR\ |\ \fIengine\fR}]\ [\fB\-\-tls\-engine\-kpass\-sha1\fR\ \fIkpass\-sha1\fR]\ [\fB\-\-insecure\fR]] | [\fB\-\-psk\fR\ \fIhex\-key\fR\ \fB\-\-psk\-identity\fR\ \fIidentity\fR\ [\fB\-\-ciphers\fR\ \fIciphers\fR]\ [\fB\-\-tls\-version\fR\ \fIversion\fR]]] [\fB\-\-proxy\fR\ \fIsocks\-url\fR]
  37. .HP \w'\fBmosquitto_ctrl\fR\ 'u
  38. \fBmosquitto_ctrl\fR [\fB\-\-help\fR]
  39. .SH "DESCRIPTION"
  40. .PP
  41. \fBmosquitto_ctrl\fR
  42. is a tool for helping configure a Mosquitto broker instance\&.
  43. .SH "ENCRYPTED CONNECTIONS"
  44. .PP
  45. \fBmosquitto_ctrl\fR
  46. supports TLS encrypted connections\&. It is strongly recommended that you use an encrypted connection for all remote use of mosquitto_ctrl\&.
  47. .PP
  48. To enable TLS connections when using x509 certificates, one of either
  49. \fB\-\-cafile\fR
  50. or
  51. \fB\-\-capath\fR
  52. must be provided as an option\&.
  53. .PP
  54. To enable TLS connections when using TLS\-PSK, you must use the
  55. \fB\-\-psk\fR
  56. and the
  57. \fB\-\-psk\-identity\fR
  58. options\&.
  59. .SH "MODULES"
  60. .PP
  61. \fBDynamic security\fR
  62. .RS 4
  63. Authentication, and role based access control with users and groups\&. Uses the
  64. \fBdynsec\fR
  65. module name\&. See:
  66. \fBmosquitto_ctrl_dynsec\fR(1)
  67. .RE
  68. .PP
  69. \fBExternal modules\fR
  70. .RS 4
  71. \fBmosquitto_ctrl\fR
  72. has the ability to load external modules in the form of shared libraries\&. For example using the module name
  73. \fBexample\fR
  74. will try to load the external module
  75. \fBmosquitto_ctrl_example\&.so\fR
  76. or
  77. \fBmosquitto_ctrl_example\&.dll\fR, depending on platform\&. This allows new functionality to be added to Mosquitto by combining a plugin and mosquitto_ctrl module, without having to recompile any Mosquitto source code\&.
  78. .RE
  79. .SH "CONNECTION OPTIONS"
  80. .PP
  81. The options below may be given on the command line, but may also be placed in a config file located at
  82. \fB$XDG_CONFIG_HOME/mosquitto_ctrl\fR
  83. or
  84. \fB$HOME/\&.config/mosquitto_ctrl\fR\&.
  85. .PP
  86. The config file may be specified manually with the
  87. \fB\-o \fR\fB\fIconfig\-file\fR\fR
  88. option\&.
  89. .PP
  90. The config file should have one pair of
  91. \fB\-option \fR\fB\fIvalue\fR\fR
  92. per line\&. The values in the config file will be used as defaults and can be overridden by using the command line\&. The exceptions to this are the message type options, of which only one can be specified\&. Note also that currently some options cannot be negated, e\&.g\&.
  93. \fB\-S\fR\&. Config file lines that have a
  94. \fB#\fR
  95. as the first character are treated as comments and not processed any further\&.
  96. .PP
  97. \fB\-A\fR
  98. .RS 4
  99. Bind the outgoing connection to a local ip address/hostname\&. Use this argument if you need to restrict network communication to a particular interface\&.
  100. .RE
  101. .PP
  102. \fB\-\-cafile\fR
  103. .RS 4
  104. Define the path to a file containing PEM encoded CA certificates that are trusted\&. Used to enable SSL communication\&.
  105. .sp
  106. See also
  107. \fB\-\-capath\fR
  108. .RE
  109. .PP
  110. \fB\-\-capath\fR
  111. .RS 4
  112. Define the path to a directory containing PEM encoded CA certificates that are trusted\&. Used to enable SSL communication\&.
  113. .sp
  114. For
  115. \fB\-\-capath\fR
  116. to work correctly, the certificate files must have "\&.crt" as the file ending and you must run "openssl rehash <path to capath>" each time you add/remove a certificate\&.
  117. .sp
  118. See also
  119. \fB\-\-cafile\fR
  120. .RE
  121. .PP
  122. \fB\-\-cert\fR
  123. .RS 4
  124. Define the path to a file containing a PEM encoded certificate for this client, if required by the server\&.
  125. .sp
  126. See also
  127. \fB\-\-key\fR\&.
  128. .RE
  129. .PP
  130. \fB\-\-ciphers\fR
  131. .RS 4
  132. An openssl compatible list of TLS ciphers to support in the client\&. See
  133. \fBciphers\fR(1)
  134. for more information\&.
  135. .RE
  136. .PP
  137. \fB\-d\fR, \fB\-\-debug\fR
  138. .RS 4
  139. Enable debug messages\&.
  140. .RE
  141. .PP
  142. \fB\-D\fR, \fB\-\-property\fR
  143. .RS 4
  144. Use an MQTT v5 property with this publish\&. If you use this option, the client will be set to be an MQTT v5 client\&. This option has two forms:
  145. .sp
  146. \fB\-D command identifier value\fR
  147. .sp
  148. \fB\-D command identifier name value\fR
  149. .sp
  150. \fBcommand\fR
  151. is the MQTT command/packet identifier and can be one of CONNECT, PUBLISH, PUBREL, DISCONNECT, AUTH, or WILL\&. The properties available for each command are listed in the
  152. Properties
  153. section\&.
  154. .sp
  155. \fBidentifier\fR
  156. is the name of the property to add\&. This is as described in the specification, but with \*(Aq\-\*(Aq as a word separator\&. For example:
  157. \fBpayload\-format\-indicator\fR\&. More details are in the
  158. Properties
  159. section\&.
  160. .sp
  161. \fBvalue\fR
  162. is the value of the property to add, with a data type that is property specific\&.
  163. .sp
  164. \fBname\fR
  165. is only used for the
  166. \fBuser\-property\fR
  167. property as the first of the two strings in the string pair\&. In that case,
  168. \fBvalue\fR
  169. is the second of the strings in the pair\&.
  170. .RE
  171. .PP
  172. \fB\-\-help\fR
  173. .RS 4
  174. Display usage information\&.
  175. .RE
  176. .PP
  177. \fB\-h\fR, \fB\-\-host\fR
  178. .RS 4
  179. Specify the host to connect to\&. Defaults to localhost\&.
  180. .RE
  181. .PP
  182. \fB\-i\fR, \fB\-\-id\fR
  183. .RS 4
  184. The id to use for this client\&. If not given, a client id will be generated depending on the MQTT version being used\&. For v3\&.1\&.1/v3\&.1, the client generates a client id in the format
  185. \fBmosq\-XXXXXXXXXXXXXXXXXX\fR, where the
  186. \fBX\fR
  187. are replaced with random alphanumeric characters\&. For v5\&.0, the client sends a zero length client id, and the server will generate a client id for the client\&.
  188. .sp
  189. This option cannot be used at the same time as the
  190. \fB\-\-id\-prefix\fR
  191. argument\&.
  192. .RE
  193. .PP
  194. \fB\-\-insecure\fR
  195. .RS 4
  196. When using certificate based encryption, this option disables verification of the server hostname in the server certificate\&. This can be useful when testing initial server configurations but makes it possible for a malicious third party to impersonate your server through DNS spoofing, for example\&. Use this option in testing
  197. \fIonly\fR\&. If you need to resort to using this option in a production environment, your setup is at fault and there is no point using encryption\&.
  198. .RE
  199. .PP
  200. \fB\-\-key\fR
  201. .RS 4
  202. Define the path to a file containing a PEM encoded private key for this client, if required by the server\&.
  203. .sp
  204. See also
  205. \fB\-\-cert\fR\&.
  206. .RE
  207. .PP
  208. \fB\-\-keyform\fR
  209. .RS 4
  210. Specifies the type of private key in use when making TLS connections\&.\&. This can be "pem" or "engine"\&. This parameter is useful when a TPM module is being used and the private key has been created with it\&. Defaults to "pem", which means normal private key files are used\&.
  211. .sp
  212. See also
  213. \fB\-\-tls\-engine\fR\&.
  214. .RE
  215. .PP
  216. \fB\-L\fR, \fB\-\-url\fR
  217. .RS 4
  218. Specify specify user, password, hostname, port and topic at once as a URL\&. The URL must be in the form: mqtt(s)://[username[:password]@]host[:port]/topic
  219. .sp
  220. If the scheme is mqtt:// then the port defaults to 1883\&. If the scheme is mqtts:// then the port defaults to 8883\&.
  221. .RE
  222. .PP
  223. \fB\-\-nodelay\fR
  224. .RS 4
  225. Disable Nagle\*(Aqs algorithm for the socket\&. This means that latency of sent messages is reduced, which is particularly noticable for small, reasonably infrequent messages\&. Using this option may result in more packets being sent than would normally be necessary\&.
  226. .RE
  227. .PP
  228. \fB\-o\fR \fIconfig\-file\fR
  229. .RS 4
  230. Provide a path to a config file to load options from\&. The config file should have one pair of
  231. \fB\-option \fR\fB\fIvalue\fR\fR
  232. per line\&. The values in the config file will be used as defaults and can be overridden by using the command line\&. The exceptions to this are the message type options, of which only one can be specified\&. Note also that currently some options cannot be negated, e\&.g\&.
  233. \fB\-S\fR\&. Config file lines that have a
  234. \fB#\fR
  235. as the first character are treated as comments and not processed any further\&.
  236. .RE
  237. .PP
  238. \fB\-p\fR, \fB\-\-port\fR
  239. .RS 4
  240. Connect to the port specified\&. If not given, the default of 1883 for plain MQTT or 8883 for MQTT over TLS will be used\&.
  241. .RE
  242. .PP
  243. \fB\-P\fR, \fB\-\-pw\fR
  244. .RS 4
  245. Provide a password to be used for authenticating with the broker\&. Using this argument without also specifying a username is invalid when using MQTT v3\&.1 or v3\&.1\&.1\&. See also the
  246. \fB\-\-username\fR
  247. option\&.
  248. .RE
  249. .PP
  250. \fB\-\-proxy\fR
  251. .RS 4
  252. Specify a SOCKS5 proxy to connect through\&. "None" and "username" authentication types are supported\&. The
  253. \fBsocks\-url\fR
  254. must be of the form
  255. \fBsocks5h://[username[:password]@]host[:port]\fR\&. The protocol prefix
  256. \fBsocks5h\fR
  257. means that hostnames are resolved by the proxy\&. The symbols %25, %3A and %40 are URL decoded into %, : and @ respectively, if present in the username or password\&.
  258. .sp
  259. If username is not given, then no authentication is attempted\&. If the port is not given, then the default of 1080 is used\&.
  260. .sp
  261. More SOCKS versions may be available in the future, depending on demand, and will use different protocol prefixes as described in
  262. \fBcurl\fR(1)\&.
  263. .RE
  264. .PP
  265. \fB\-\-psk\fR
  266. .RS 4
  267. Provide the hexadecimal (no leading 0x) pre\-shared\-key matching the one used on the broker to use TLS\-PSK encryption support\&.
  268. \fB\-\-psk\-identity\fR
  269. must also be provided to enable TLS\-PSK\&.
  270. .RE
  271. .PP
  272. \fB\-\-psk\-identity\fR
  273. .RS 4
  274. The client identity to use with TLS\-PSK support\&. This may be used instead of a username if the broker is configured to do so\&.
  275. .RE
  276. .PP
  277. \fB\-q\fR, \fB\-\-qos\fR
  278. .RS 4
  279. Specify the quality of service to use for messages, from 0, 1 and 2\&. Defaults to 1\&.
  280. .RE
  281. .PP
  282. \fB\-\-quiet\fR
  283. .RS 4
  284. If this argument is given, no runtime errors will be printed\&. This excludes any error messages given in case of invalid user input (e\&.g\&. using
  285. \fB\-\-port\fR
  286. without a port)\&.
  287. .RE
  288. .PP
  289. \fB\-\-tls\-alpn\fR
  290. .RS 4
  291. Provide a protocol to use when connecting to a broker that has multiple protocols available on a single port, e\&.g\&. MQTT and WebSockets\&.
  292. .RE
  293. .PP
  294. \fB\-\-tls\-engine\fR
  295. .RS 4
  296. A valid openssl engine id\&. These can be listed with openssl engine command\&.
  297. .sp
  298. See also
  299. \fB\-\-keyform\fR\&.
  300. .RE
  301. .PP
  302. \fB\-\-tls\-engine\-kpass\-sha1\fR
  303. .RS 4
  304. SHA1 of the private key password when using an TLS engine\&. Some TLS engines such as the TPM engine may require the use of a password in order to be accessed\&. This option allows a hex encoded SHA1 hash of the password to the engine directly, instead of the user being prompted for the password\&.
  305. .sp
  306. See also
  307. \fB\-\-tls\-engine\fR\&.
  308. .RE
  309. .PP
  310. \fB\-\-tls\-version\fR
  311. .RS 4
  312. Choose which TLS protocol version to use when communicating with the broker\&. Valid options are
  313. \fBtlsv1\&.3\fR,
  314. \fBtlsv1\&.2\fR
  315. and
  316. \fBtlsv1\&.1\fR\&. The default value is
  317. \fBtlsv1\&.2\fR\&. Must match the protocol version used by the broker\&.
  318. .RE
  319. .PP
  320. \fB\-u\fR, \fB\-\-username\fR
  321. .RS 4
  322. Provide a username to be used for authenticating with the broker\&. See also the
  323. \fB\-\-pw\fR
  324. argument\&.
  325. .RE
  326. .PP
  327. \fB\-\-unix\fR
  328. .RS 4
  329. Connect to a broker through a local unix domain socket instead of a TCP socket\&. This is a replacement for
  330. \fB\-h\fR
  331. and
  332. \fB\-L\fR\&. For example:
  333. \fBmosquitto_ctrl \-\-unix /tmp/mosquitto\&.sock \&.\&.\&.\fR
  334. .sp
  335. See the
  336. \fBsocket_domain\fR
  337. option in
  338. \m[blue]\fBmosquitto\&.conf\fR\m[](5)
  339. to configure Mosquitto to listen on a unix socket\&.
  340. .RE
  341. .PP
  342. \fB\-V\fR, \fB\-\-protocol\-version\fR
  343. .RS 4
  344. Specify which version of the MQTT protocol should be used when connecting to the rmeote broker\&. Can be
  345. \fB5\fR,
  346. \fB311\fR,
  347. \fB31\fR, or the more verbose
  348. \fBmqttv5\fR,
  349. \fBmqttv311\fR, or
  350. \fBmqttv31\fR\&. Defaults to
  351. \fB311\fR\&.
  352. .RE
  353. .SH "PROPERTIES"
  354. .PP
  355. The
  356. \fB\-D\fR
  357. /
  358. \fB\-\-property\fR
  359. option allows adding properties to different stages of the mosquitto_ctrl run\&. The properties supported for each command are as follows:
  360. .SS "Connect"
  361. .sp
  362. .RS 4
  363. .ie n \{\
  364. \h'-04'\(bu\h'+03'\c
  365. .\}
  366. .el \{\
  367. .sp -1
  368. .IP \(bu 2.3
  369. .\}
  370. \fBauthentication\-data\fR
  371. (binary data \- note treated as a string in mosquitto_ctrl)
  372. .RE
  373. .sp
  374. .RS 4
  375. .ie n \{\
  376. \h'-04'\(bu\h'+03'\c
  377. .\}
  378. .el \{\
  379. .sp -1
  380. .IP \(bu 2.3
  381. .\}
  382. \fBauthentication\-method\fR
  383. (UTF\-8 string pair)
  384. .RE
  385. .sp
  386. .RS 4
  387. .ie n \{\
  388. \h'-04'\(bu\h'+03'\c
  389. .\}
  390. .el \{\
  391. .sp -1
  392. .IP \(bu 2.3
  393. .\}
  394. \fBmaximum\-packet\-size\fR
  395. (32\-bit unsigned integer)
  396. .RE
  397. .sp
  398. .RS 4
  399. .ie n \{\
  400. \h'-04'\(bu\h'+03'\c
  401. .\}
  402. .el \{\
  403. .sp -1
  404. .IP \(bu 2.3
  405. .\}
  406. \fBreceive\-maximum\fR
  407. (16\-bit unsigned integer)
  408. .RE
  409. .sp
  410. .RS 4
  411. .ie n \{\
  412. \h'-04'\(bu\h'+03'\c
  413. .\}
  414. .el \{\
  415. .sp -1
  416. .IP \(bu 2.3
  417. .\}
  418. \fBrequest\-problem\-information\fR
  419. (8\-bit unsigned integer)
  420. .RE
  421. .sp
  422. .RS 4
  423. .ie n \{\
  424. \h'-04'\(bu\h'+03'\c
  425. .\}
  426. .el \{\
  427. .sp -1
  428. .IP \(bu 2.3
  429. .\}
  430. \fBrequest\-response\-information\fR
  431. (8\-bit unsigned integer)
  432. .RE
  433. .sp
  434. .RS 4
  435. .ie n \{\
  436. \h'-04'\(bu\h'+03'\c
  437. .\}
  438. .el \{\
  439. .sp -1
  440. .IP \(bu 2.3
  441. .\}
  442. \fBsession\-expiry\-interval\fR
  443. (32\-bit unsigned integer, note use
  444. \fB\-x\fR
  445. instead)
  446. .RE
  447. .sp
  448. .RS 4
  449. .ie n \{\
  450. \h'-04'\(bu\h'+03'\c
  451. .\}
  452. .el \{\
  453. .sp -1
  454. .IP \(bu 2.3
  455. .\}
  456. \fBtopic\-alias\-maximum\fR
  457. (16\-bit unsigned integer)
  458. .RE
  459. .sp
  460. .RS 4
  461. .ie n \{\
  462. \h'-04'\(bu\h'+03'\c
  463. .\}
  464. .el \{\
  465. .sp -1
  466. .IP \(bu 2.3
  467. .\}
  468. \fBuser\-property\fR
  469. (UTF\-8 string pair)
  470. .RE
  471. .SS "Publish"
  472. .sp
  473. .RS 4
  474. .ie n \{\
  475. \h'-04'\(bu\h'+03'\c
  476. .\}
  477. .el \{\
  478. .sp -1
  479. .IP \(bu 2.3
  480. .\}
  481. \fBcontent\-type\fR
  482. (UTF\-8 string)
  483. .RE
  484. .sp
  485. .RS 4
  486. .ie n \{\
  487. \h'-04'\(bu\h'+03'\c
  488. .\}
  489. .el \{\
  490. .sp -1
  491. .IP \(bu 2.3
  492. .\}
  493. \fBcorrelation\-data\fR
  494. (binary data \- note treated as a string in mosquitto_ctrl)
  495. .RE
  496. .sp
  497. .RS 4
  498. .ie n \{\
  499. \h'-04'\(bu\h'+03'\c
  500. .\}
  501. .el \{\
  502. .sp -1
  503. .IP \(bu 2.3
  504. .\}
  505. \fBmessage\-expiry\-interval\fR
  506. (32\-bit unsigned integer)
  507. .RE
  508. .sp
  509. .RS 4
  510. .ie n \{\
  511. \h'-04'\(bu\h'+03'\c
  512. .\}
  513. .el \{\
  514. .sp -1
  515. .IP \(bu 2.3
  516. .\}
  517. \fBpayload\-format\-indicator\fR
  518. (8\-bit unsigned integer)
  519. .RE
  520. .sp
  521. .RS 4
  522. .ie n \{\
  523. \h'-04'\(bu\h'+03'\c
  524. .\}
  525. .el \{\
  526. .sp -1
  527. .IP \(bu 2.3
  528. .\}
  529. \fBresponse\-topic\fR
  530. (UTF\-8 string)
  531. .RE
  532. .sp
  533. .RS 4
  534. .ie n \{\
  535. \h'-04'\(bu\h'+03'\c
  536. .\}
  537. .el \{\
  538. .sp -1
  539. .IP \(bu 2.3
  540. .\}
  541. \fBtopic\-alias\fR
  542. (16\-bit unsigned integer)
  543. .RE
  544. .sp
  545. .RS 4
  546. .ie n \{\
  547. \h'-04'\(bu\h'+03'\c
  548. .\}
  549. .el \{\
  550. .sp -1
  551. .IP \(bu 2.3
  552. .\}
  553. \fBuser\-property\fR
  554. (UTF\-8 string pair)
  555. .RE
  556. .SS "Disconnect"
  557. .sp
  558. .RS 4
  559. .ie n \{\
  560. \h'-04'\(bu\h'+03'\c
  561. .\}
  562. .el \{\
  563. .sp -1
  564. .IP \(bu 2.3
  565. .\}
  566. \fBsession\-expiry\-interval\fR
  567. (32\-bit unsigned integer)
  568. .RE
  569. .sp
  570. .RS 4
  571. .ie n \{\
  572. \h'-04'\(bu\h'+03'\c
  573. .\}
  574. .el \{\
  575. .sp -1
  576. .IP \(bu 2.3
  577. .\}
  578. \fBuser\-property\fR
  579. (UTF\-8 string pair)
  580. .RE
  581. .SS "Will properties"
  582. .sp
  583. .RS 4
  584. .ie n \{\
  585. \h'-04'\(bu\h'+03'\c
  586. .\}
  587. .el \{\
  588. .sp -1
  589. .IP \(bu 2.3
  590. .\}
  591. \fBcontent\-type\fR
  592. (UTF\-8 string)
  593. .RE
  594. .sp
  595. .RS 4
  596. .ie n \{\
  597. \h'-04'\(bu\h'+03'\c
  598. .\}
  599. .el \{\
  600. .sp -1
  601. .IP \(bu 2.3
  602. .\}
  603. \fBcorrelation\-data\fR
  604. (binary data \- note treated as a string in mosquitto_ctrl)
  605. .RE
  606. .sp
  607. .RS 4
  608. .ie n \{\
  609. \h'-04'\(bu\h'+03'\c
  610. .\}
  611. .el \{\
  612. .sp -1
  613. .IP \(bu 2.3
  614. .\}
  615. \fBmessage\-expiry\-interval\fR
  616. (32\-bit unsigned integer)
  617. .RE
  618. .sp
  619. .RS 4
  620. .ie n \{\
  621. \h'-04'\(bu\h'+03'\c
  622. .\}
  623. .el \{\
  624. .sp -1
  625. .IP \(bu 2.3
  626. .\}
  627. \fBpayload\-format\-indicator\fR
  628. (8\-bit unsigned integer)
  629. .RE
  630. .sp
  631. .RS 4
  632. .ie n \{\
  633. \h'-04'\(bu\h'+03'\c
  634. .\}
  635. .el \{\
  636. .sp -1
  637. .IP \(bu 2.3
  638. .\}
  639. \fBresponse\-topic\fR
  640. (UTF\-8 string)
  641. .RE
  642. .sp
  643. .RS 4
  644. .ie n \{\
  645. \h'-04'\(bu\h'+03'\c
  646. .\}
  647. .el \{\
  648. .sp -1
  649. .IP \(bu 2.3
  650. .\}
  651. \fBuser\-property\fR
  652. (UTF\-8 string pair)
  653. .RE
  654. .sp
  655. .RS 4
  656. .ie n \{\
  657. \h'-04'\(bu\h'+03'\c
  658. .\}
  659. .el \{\
  660. .sp -1
  661. .IP \(bu 2.3
  662. .\}
  663. \fBwill\-delay\-interval\fR
  664. (32\-bit unsigned integer)
  665. .RE
  666. .SH "EXIT STATUS"
  667. .PP
  668. mosquitto_sub returns zero on success, or non\-zero on error\&. If the connection is refused by the broker at the MQTT level, then the exit code is the CONNACK reason code\&. If another error occurs, the exit code is a libmosquitto return value\&.
  669. .PP
  670. MQTT v3\&.1\&.1 CONNACK codes:
  671. .sp
  672. .RS 4
  673. .ie n \{\
  674. \h'-04'\(bu\h'+03'\c
  675. .\}
  676. .el \{\
  677. .sp -1
  678. .IP \(bu 2.3
  679. .\}
  680. \fB0\fR
  681. Success
  682. .RE
  683. .sp
  684. .RS 4
  685. .ie n \{\
  686. \h'-04'\(bu\h'+03'\c
  687. .\}
  688. .el \{\
  689. .sp -1
  690. .IP \(bu 2.3
  691. .\}
  692. \fB1\fR
  693. Connection refused: Bad protocol version
  694. .RE
  695. .sp
  696. .RS 4
  697. .ie n \{\
  698. \h'-04'\(bu\h'+03'\c
  699. .\}
  700. .el \{\
  701. .sp -1
  702. .IP \(bu 2.3
  703. .\}
  704. \fB2\fR
  705. Connection refused: Identifier rejected
  706. .RE
  707. .sp
  708. .RS 4
  709. .ie n \{\
  710. \h'-04'\(bu\h'+03'\c
  711. .\}
  712. .el \{\
  713. .sp -1
  714. .IP \(bu 2.3
  715. .\}
  716. \fB3\fR
  717. Connection refused: Server unavailable
  718. .RE
  719. .sp
  720. .RS 4
  721. .ie n \{\
  722. \h'-04'\(bu\h'+03'\c
  723. .\}
  724. .el \{\
  725. .sp -1
  726. .IP \(bu 2.3
  727. .\}
  728. \fB4\fR
  729. Connection refused: Bad username/password
  730. .RE
  731. .sp
  732. .RS 4
  733. .ie n \{\
  734. \h'-04'\(bu\h'+03'\c
  735. .\}
  736. .el \{\
  737. .sp -1
  738. .IP \(bu 2.3
  739. .\}
  740. \fB5\fR
  741. Connection refused: Not authorized
  742. .RE
  743. .PP
  744. MQTT v5 CONNACK codes:
  745. .sp
  746. .RS 4
  747. .ie n \{\
  748. \h'-04'\(bu\h'+03'\c
  749. .\}
  750. .el \{\
  751. .sp -1
  752. .IP \(bu 2.3
  753. .\}
  754. \fB0\fR
  755. Success
  756. .RE
  757. .sp
  758. .RS 4
  759. .ie n \{\
  760. \h'-04'\(bu\h'+03'\c
  761. .\}
  762. .el \{\
  763. .sp -1
  764. .IP \(bu 2.3
  765. .\}
  766. \fB128\fR
  767. Unspecified error
  768. .RE
  769. .sp
  770. .RS 4
  771. .ie n \{\
  772. \h'-04'\(bu\h'+03'\c
  773. .\}
  774. .el \{\
  775. .sp -1
  776. .IP \(bu 2.3
  777. .\}
  778. \fB129\fR
  779. Malformed packet
  780. .RE
  781. .sp
  782. .RS 4
  783. .ie n \{\
  784. \h'-04'\(bu\h'+03'\c
  785. .\}
  786. .el \{\
  787. .sp -1
  788. .IP \(bu 2.3
  789. .\}
  790. \fB130\fR
  791. Protocol error
  792. .RE
  793. .sp
  794. .RS 4
  795. .ie n \{\
  796. \h'-04'\(bu\h'+03'\c
  797. .\}
  798. .el \{\
  799. .sp -1
  800. .IP \(bu 2.3
  801. .\}
  802. \fB131\fR
  803. Implementation specific error
  804. .RE
  805. .sp
  806. .RS 4
  807. .ie n \{\
  808. \h'-04'\(bu\h'+03'\c
  809. .\}
  810. .el \{\
  811. .sp -1
  812. .IP \(bu 2.3
  813. .\}
  814. \fB132\fR
  815. Unsupported protocol version
  816. .RE
  817. .sp
  818. .RS 4
  819. .ie n \{\
  820. \h'-04'\(bu\h'+03'\c
  821. .\}
  822. .el \{\
  823. .sp -1
  824. .IP \(bu 2.3
  825. .\}
  826. \fB133\fR
  827. Client ID not valid
  828. .RE
  829. .sp
  830. .RS 4
  831. .ie n \{\
  832. \h'-04'\(bu\h'+03'\c
  833. .\}
  834. .el \{\
  835. .sp -1
  836. .IP \(bu 2.3
  837. .\}
  838. \fB134\fR
  839. Bad username or password
  840. .RE
  841. .sp
  842. .RS 4
  843. .ie n \{\
  844. \h'-04'\(bu\h'+03'\c
  845. .\}
  846. .el \{\
  847. .sp -1
  848. .IP \(bu 2.3
  849. .\}
  850. \fB135\fR
  851. Not authorized
  852. .RE
  853. .sp
  854. .RS 4
  855. .ie n \{\
  856. \h'-04'\(bu\h'+03'\c
  857. .\}
  858. .el \{\
  859. .sp -1
  860. .IP \(bu 2.3
  861. .\}
  862. \fB136\fR
  863. Server unavailable
  864. .RE
  865. .sp
  866. .RS 4
  867. .ie n \{\
  868. \h'-04'\(bu\h'+03'\c
  869. .\}
  870. .el \{\
  871. .sp -1
  872. .IP \(bu 2.3
  873. .\}
  874. \fB137\fR
  875. Server busy
  876. .RE
  877. .sp
  878. .RS 4
  879. .ie n \{\
  880. \h'-04'\(bu\h'+03'\c
  881. .\}
  882. .el \{\
  883. .sp -1
  884. .IP \(bu 2.3
  885. .\}
  886. \fB138\fR
  887. Banned
  888. .RE
  889. .sp
  890. .RS 4
  891. .ie n \{\
  892. \h'-04'\(bu\h'+03'\c
  893. .\}
  894. .el \{\
  895. .sp -1
  896. .IP \(bu 2.3
  897. .\}
  898. \fB139\fR
  899. Server shutting down
  900. .RE
  901. .sp
  902. .RS 4
  903. .ie n \{\
  904. \h'-04'\(bu\h'+03'\c
  905. .\}
  906. .el \{\
  907. .sp -1
  908. .IP \(bu 2.3
  909. .\}
  910. \fB140\fR
  911. Bad authentication method
  912. .RE
  913. .sp
  914. .RS 4
  915. .ie n \{\
  916. \h'-04'\(bu\h'+03'\c
  917. .\}
  918. .el \{\
  919. .sp -1
  920. .IP \(bu 2.3
  921. .\}
  922. \fB141\fR
  923. Keep alive timeout
  924. .RE
  925. .sp
  926. .RS 4
  927. .ie n \{\
  928. \h'-04'\(bu\h'+03'\c
  929. .\}
  930. .el \{\
  931. .sp -1
  932. .IP \(bu 2.3
  933. .\}
  934. \fB142\fR
  935. Session taken over
  936. .RE
  937. .sp
  938. .RS 4
  939. .ie n \{\
  940. \h'-04'\(bu\h'+03'\c
  941. .\}
  942. .el \{\
  943. .sp -1
  944. .IP \(bu 2.3
  945. .\}
  946. \fB143\fR
  947. Topic filter invalid
  948. .RE
  949. .sp
  950. .RS 4
  951. .ie n \{\
  952. \h'-04'\(bu\h'+03'\c
  953. .\}
  954. .el \{\
  955. .sp -1
  956. .IP \(bu 2.3
  957. .\}
  958. \fB144\fR
  959. Topic name invalid
  960. .RE
  961. .sp
  962. .RS 4
  963. .ie n \{\
  964. \h'-04'\(bu\h'+03'\c
  965. .\}
  966. .el \{\
  967. .sp -1
  968. .IP \(bu 2.3
  969. .\}
  970. \fB147\fR
  971. Receive maximum exceeded
  972. .RE
  973. .sp
  974. .RS 4
  975. .ie n \{\
  976. \h'-04'\(bu\h'+03'\c
  977. .\}
  978. .el \{\
  979. .sp -1
  980. .IP \(bu 2.3
  981. .\}
  982. \fB148\fR
  983. Topic alias invalid
  984. .RE
  985. .sp
  986. .RS 4
  987. .ie n \{\
  988. \h'-04'\(bu\h'+03'\c
  989. .\}
  990. .el \{\
  991. .sp -1
  992. .IP \(bu 2.3
  993. .\}
  994. \fB149\fR
  995. Packet too large
  996. .RE
  997. .sp
  998. .RS 4
  999. .ie n \{\
  1000. \h'-04'\(bu\h'+03'\c
  1001. .\}
  1002. .el \{\
  1003. .sp -1
  1004. .IP \(bu 2.3
  1005. .\}
  1006. \fB148\fR
  1007. Message rate too high
  1008. .RE
  1009. .sp
  1010. .RS 4
  1011. .ie n \{\
  1012. \h'-04'\(bu\h'+03'\c
  1013. .\}
  1014. .el \{\
  1015. .sp -1
  1016. .IP \(bu 2.3
  1017. .\}
  1018. \fB151\fR
  1019. Quota exceeded
  1020. .RE
  1021. .sp
  1022. .RS 4
  1023. .ie n \{\
  1024. \h'-04'\(bu\h'+03'\c
  1025. .\}
  1026. .el \{\
  1027. .sp -1
  1028. .IP \(bu 2.3
  1029. .\}
  1030. \fB152\fR
  1031. Administrative action
  1032. .RE
  1033. .sp
  1034. .RS 4
  1035. .ie n \{\
  1036. \h'-04'\(bu\h'+03'\c
  1037. .\}
  1038. .el \{\
  1039. .sp -1
  1040. .IP \(bu 2.3
  1041. .\}
  1042. \fB153\fR
  1043. Payload format invalid
  1044. .RE
  1045. .sp
  1046. .RS 4
  1047. .ie n \{\
  1048. \h'-04'\(bu\h'+03'\c
  1049. .\}
  1050. .el \{\
  1051. .sp -1
  1052. .IP \(bu 2.3
  1053. .\}
  1054. \fB154\fR
  1055. Retain not supported
  1056. .RE
  1057. .sp
  1058. .RS 4
  1059. .ie n \{\
  1060. \h'-04'\(bu\h'+03'\c
  1061. .\}
  1062. .el \{\
  1063. .sp -1
  1064. .IP \(bu 2.3
  1065. .\}
  1066. \fB155\fR
  1067. QoS not supported
  1068. .RE
  1069. .sp
  1070. .RS 4
  1071. .ie n \{\
  1072. \h'-04'\(bu\h'+03'\c
  1073. .\}
  1074. .el \{\
  1075. .sp -1
  1076. .IP \(bu 2.3
  1077. .\}
  1078. \fB156\fR
  1079. Use another server
  1080. .RE
  1081. .sp
  1082. .RS 4
  1083. .ie n \{\
  1084. \h'-04'\(bu\h'+03'\c
  1085. .\}
  1086. .el \{\
  1087. .sp -1
  1088. .IP \(bu 2.3
  1089. .\}
  1090. \fB157\fR
  1091. Server moved
  1092. .RE
  1093. .sp
  1094. .RS 4
  1095. .ie n \{\
  1096. \h'-04'\(bu\h'+03'\c
  1097. .\}
  1098. .el \{\
  1099. .sp -1
  1100. .IP \(bu 2.3
  1101. .\}
  1102. \fB158\fR
  1103. Shared subscriptions not supported
  1104. .RE
  1105. .sp
  1106. .RS 4
  1107. .ie n \{\
  1108. \h'-04'\(bu\h'+03'\c
  1109. .\}
  1110. .el \{\
  1111. .sp -1
  1112. .IP \(bu 2.3
  1113. .\}
  1114. \fB159\fR
  1115. Connection rate exceeded
  1116. .RE
  1117. .sp
  1118. .RS 4
  1119. .ie n \{\
  1120. \h'-04'\(bu\h'+03'\c
  1121. .\}
  1122. .el \{\
  1123. .sp -1
  1124. .IP \(bu 2.3
  1125. .\}
  1126. \fB160\fR
  1127. Maximum connect time
  1128. .RE
  1129. .sp
  1130. .RS 4
  1131. .ie n \{\
  1132. \h'-04'\(bu\h'+03'\c
  1133. .\}
  1134. .el \{\
  1135. .sp -1
  1136. .IP \(bu 2.3
  1137. .\}
  1138. \fB161\fR
  1139. Subscription IDs not supported
  1140. .RE
  1141. .sp
  1142. .RS 4
  1143. .ie n \{\
  1144. \h'-04'\(bu\h'+03'\c
  1145. .\}
  1146. .el \{\
  1147. .sp -1
  1148. .IP \(bu 2.3
  1149. .\}
  1150. \fB162\fR
  1151. Wildcard subscriptions not supported
  1152. .RE
  1153. .SH "BUGS"
  1154. .PP
  1155. \fBmosquitto\fR
  1156. bug information can be found at
  1157. \m[blue]\fB\%https://github.com/eclipse/mosquitto/issues\fR\m[]
  1158. .SH "SEE ALSO"
  1159. \fBmqtt\fR(7), \fBmosquitto_rr\fR(1), \fBmosquitto_pub\fR(1), \fBmosquitto_sub\fR(1), \fBmosquitto\fR(8), \fBlibmosquitto\fR(3), \fBmosquitto-tls\fR(7)
  1160. .SH "AUTHOR"
  1161. .PP
  1162. Roger Light
  1163. <roger@atchoo\&.org>