mosquitto-tls.7.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <?xml-stylesheet type="text/xsl" href="manpage.xsl"?>
  3. <refentry xml:id="mosquitto-tls" xmlns:xlink="http://www.w3.org/1999/xlink">
  4. <refmeta>
  5. <refentrytitle>mosquitto-tls</refentrytitle>
  6. <manvolnum>7</manvolnum>
  7. <refmiscinfo class="source">Mosquitto Project</refmiscinfo>
  8. <refmiscinfo class="manual">Conventions and miscellaneous</refmiscinfo>
  9. </refmeta>
  10. <refnamediv>
  11. <refname>mosquitto-tls</refname>
  12. <refpurpose>Configure SSL/TLS support for Mosquitto</refpurpose>
  13. </refnamediv>
  14. <refsect1>
  15. <title>Description</title>
  16. <para><command>mosquitto</command> provides SSL support for encrypted
  17. network connections and authentication. This manual describes how
  18. to create the files needed.</para>
  19. <note><para>It is important to use different certificate subject
  20. parameters for your CA, server and clients. If the certificates
  21. appear identical, even though generated separately, the
  22. broker/client will not be able to distinguish between them and
  23. you will experience difficult to diagnose errors.</para></note>
  24. </refsect1>
  25. <refsect1>
  26. <title>Generating certificates</title>
  27. <para>The sections below give the openssl commands that can be used to
  28. generate certificates, but without any context. The asciicast at
  29. <link
  30. xlink:href="https://asciinema.org/a/201826">https://asciinema.org/a/201826</link>
  31. gives a full run through of how to use those commands.</para>
  32. </refsect1>
  33. <refsect1>
  34. <title>Certificate Authority</title>
  35. <para>Generate a certificate authority certificate and key.</para>
  36. <itemizedlist mark="circle">
  37. <listitem><para>openssl req -new -x509 -days &lt;duration&gt; -extensions v3_ca -keyout ca.key -out ca.crt</para></listitem>
  38. </itemizedlist>
  39. </refsect1>
  40. <refsect1>
  41. <title>Server</title>
  42. <para>Generate a server key.</para>
  43. <itemizedlist mark="circle">
  44. <listitem><para>openssl genrsa -des3 -out server.key 2048</para></listitem>
  45. </itemizedlist>
  46. <para>Generate a server key without encryption.</para>
  47. <itemizedlist mark="circle">
  48. <listitem><para>openssl genrsa -out server.key 2048</para></listitem>
  49. </itemizedlist>
  50. <para>Generate a certificate signing request to send to the CA.</para>
  51. <itemizedlist mark="circle">
  52. <listitem><para>openssl req -out server.csr -key server.key -new</para></listitem>
  53. </itemizedlist>
  54. <note><para>When prompted for the CN (Common Name), please enter either your server (or broker) hostname or domain name.</para></note>
  55. <para>Send the CSR to the CA, or sign it with your CA key:</para>
  56. <itemizedlist mark="circle">
  57. <listitem><para>openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days &lt;duration&gt;</para></listitem>
  58. </itemizedlist>
  59. </refsect1>
  60. <refsect1>
  61. <title>Client</title>
  62. <para>Generate a client key.</para>
  63. <itemizedlist mark="circle">
  64. <listitem><para>openssl genrsa -des3 -out client.key 2048</para></listitem>
  65. </itemizedlist>
  66. <para>Generate a certificate signing request to send to the CA.</para>
  67. <itemizedlist mark="circle">
  68. <listitem><para>openssl req -out client.csr -key client.key -new</para></listitem>
  69. </itemizedlist>
  70. <para>Send the CSR to the CA, or sign it with your CA key:</para>
  71. <itemizedlist mark="circle">
  72. <listitem><para>openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days &lt;duration&gt;</para></listitem>
  73. </itemizedlist>
  74. </refsect1>
  75. <refsect1>
  76. <title>See Also</title>
  77. <simplelist type="inline">
  78. <member>
  79. <citerefentry>
  80. <refentrytitle><link xlink:href="mosquitto-8.html">mosquitto</link></refentrytitle>
  81. <manvolnum>8</manvolnum>
  82. </citerefentry>
  83. </member>
  84. <member>
  85. <citerefentry>
  86. <refentrytitle><link xlink:href="mosquitto-conf-5.html">mosquitto-conf</link></refentrytitle>
  87. <manvolnum>5</manvolnum>
  88. </citerefentry>
  89. </member>
  90. </simplelist>
  91. </refsect1>
  92. <refsect1>
  93. <title>Author</title>
  94. <para>Roger Light <email>roger@atchoo.org</email></para>
  95. </refsect1>
  96. </refentry>