mosquitto-tls.7 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. '\" t
  2. .\" Title: mosquitto-tls
  3. .\" Author: [see the "Author" section]
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 10/27/2021
  6. .\" Manual: Conventions and miscellaneous
  7. .\" Source: Mosquitto Project
  8. .\" Language: English
  9. .\"
  10. .TH "MOSQUITTO\-TLS" "7" "10/27/2021" "Mosquitto Project" "Conventions and miscellaneous"
  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-tls \- Configure SSL/TLS support for Mosquitto
  32. .SH "DESCRIPTION"
  33. .PP
  34. \fBmosquitto\fR
  35. provides SSL support for encrypted network connections and authentication\&. This manual describes how to create the files needed\&.
  36. .if n \{\
  37. .sp
  38. .\}
  39. .RS 4
  40. .it 1 an-trap
  41. .nr an-no-space-flag 1
  42. .nr an-break-flag 1
  43. .br
  44. .ps +1
  45. \fBNote\fR
  46. .ps -1
  47. .br
  48. .PP
  49. It is important to use different certificate subject parameters for your CA, server and clients\&. If the certificates appear identical, even though generated separately, the broker/client will not be able to distinguish between them and you will experience difficult to diagnose errors\&.
  50. .sp .5v
  51. .RE
  52. .SH "GENERATING CERTIFICATES"
  53. .PP
  54. The sections below give the openssl commands that can be used to generate certificates, but without any context\&. The asciicast at
  55. \m[blue]\fBhttps://asciinema\&.org/a/201826\fR\m[]
  56. gives a full run through of how to use those commands\&.
  57. .SH "CERTIFICATE AUTHORITY"
  58. .PP
  59. Generate a certificate authority certificate and key\&.
  60. .sp
  61. .RS 4
  62. .ie n \{\
  63. \h'-04'\(bu\h'+03'\c
  64. .\}
  65. .el \{\
  66. .sp -1
  67. .IP \(bu 2.3
  68. .\}
  69. openssl req \-new \-x509 \-days <duration> \-extensions v3_ca \-keyout ca\&.key \-out ca\&.crt
  70. .RE
  71. .SH "SERVER"
  72. .PP
  73. Generate a server key\&.
  74. .sp
  75. .RS 4
  76. .ie n \{\
  77. \h'-04'\(bu\h'+03'\c
  78. .\}
  79. .el \{\
  80. .sp -1
  81. .IP \(bu 2.3
  82. .\}
  83. openssl genrsa \-des3 \-out server\&.key 2048
  84. .RE
  85. .PP
  86. Generate a server key without encryption\&.
  87. .sp
  88. .RS 4
  89. .ie n \{\
  90. \h'-04'\(bu\h'+03'\c
  91. .\}
  92. .el \{\
  93. .sp -1
  94. .IP \(bu 2.3
  95. .\}
  96. openssl genrsa \-out server\&.key 2048
  97. .RE
  98. .PP
  99. Generate a certificate signing request to send to the CA\&.
  100. .sp
  101. .RS 4
  102. .ie n \{\
  103. \h'-04'\(bu\h'+03'\c
  104. .\}
  105. .el \{\
  106. .sp -1
  107. .IP \(bu 2.3
  108. .\}
  109. openssl req \-out server\&.csr \-key server\&.key \-new
  110. .RE
  111. .if n \{\
  112. .sp
  113. .\}
  114. .RS 4
  115. .it 1 an-trap
  116. .nr an-no-space-flag 1
  117. .nr an-break-flag 1
  118. .br
  119. .ps +1
  120. \fBNote\fR
  121. .ps -1
  122. .br
  123. .PP
  124. When prompted for the CN (Common Name), please enter either your server (or broker) hostname or domain name\&.
  125. .sp .5v
  126. .RE
  127. .PP
  128. Send the CSR to the CA, or sign it with your CA key:
  129. .sp
  130. .RS 4
  131. .ie n \{\
  132. \h'-04'\(bu\h'+03'\c
  133. .\}
  134. .el \{\
  135. .sp -1
  136. .IP \(bu 2.3
  137. .\}
  138. openssl x509 \-req \-in server\&.csr \-CA ca\&.crt \-CAkey ca\&.key \-CAcreateserial \-out server\&.crt \-days <duration>
  139. .RE
  140. .SH "CLIENT"
  141. .PP
  142. Generate a client key\&.
  143. .sp
  144. .RS 4
  145. .ie n \{\
  146. \h'-04'\(bu\h'+03'\c
  147. .\}
  148. .el \{\
  149. .sp -1
  150. .IP \(bu 2.3
  151. .\}
  152. openssl genrsa \-des3 \-out client\&.key 2048
  153. .RE
  154. .PP
  155. Generate a certificate signing request to send to the CA\&.
  156. .sp
  157. .RS 4
  158. .ie n \{\
  159. \h'-04'\(bu\h'+03'\c
  160. .\}
  161. .el \{\
  162. .sp -1
  163. .IP \(bu 2.3
  164. .\}
  165. openssl req \-out client\&.csr \-key client\&.key \-new
  166. .RE
  167. .PP
  168. Send the CSR to the CA, or sign it with your CA key:
  169. .sp
  170. .RS 4
  171. .ie n \{\
  172. \h'-04'\(bu\h'+03'\c
  173. .\}
  174. .el \{\
  175. .sp -1
  176. .IP \(bu 2.3
  177. .\}
  178. openssl x509 \-req \-in client\&.csr \-CA ca\&.crt \-CAkey ca\&.key \-CAcreateserial \-out client\&.crt \-days <duration>
  179. .RE
  180. .SH "SEE ALSO"
  181. \fBmosquitto\fR(8), \fBmosquitto-conf\fR(5)
  182. .SH "AUTHOR"
  183. .PP
  184. Roger Light
  185. <roger@atchoo\&.org>