{"id":260,"date":"2024-11-07T17:13:43","date_gmt":"2024-11-07T16:13:43","guid":{"rendered":"https:\/\/guillemrueda.com\/blog\/?p=260"},"modified":"2024-11-07T17:14:05","modified_gmt":"2024-11-07T16:14:05","slug":"mqtt-websockets-i-certificats","status":"publish","type":"post","link":"https:\/\/guillemrueda.com\/blog\/2024\/11\/07\/mqtt-websockets-i-certificats\/","title":{"rendered":"MQTT, websockets i certificats"},"content":{"rendered":"\n<p>Les compilacions descarregables de Mosquito corresponents a:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>2.0.20<\/li>\n\n\n\n<li>2.0.19<\/li>\n<\/ul>\n\n\n\n<p>No tenen ni <a href=\"https:\/\/github.com\/eclipse-mosquitto\/mosquitto\/issues\/3148\">ben compilat els websockets<\/a> (fatal) ni te <a href=\"https:\/\/github.com\/eclipse-mosquitto\/mosquitto\/issues\/1211\">els websockets sobre http\/2<\/a> (greu). <a href=\"https:\/\/mosquitto.org\/files\/binary\/win64\/\">La seg\u00fcent m\u00e9s recent \u00e9s la 2.0.18a (maig del 2024)<\/a> i no t\u00e9 el primer. Per al segon no hi ha un altre remei que desactivar el HTTP2 al firefox al about:config desactivar-lo posant a fals el valor de network.http.http2.websockets (o <strong>network.http.spdy.websockets<\/strong>).<\/p>\n\n\n\n<p>Posteriorment per a poder fer el SSL a WebSockets amb un certificat autosignat caldr\u00e0 generar la entitat certificadora i el certificat adhoc:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl genrsa -des3 -out ca.key 2048\r\nopenssl req -new -x509 -days 1826 -key ca.key -out ca.crt\r\nopenssl genrsa -out server.key 2048\r\nopenssl req -new -out server.csr -key server.key\r\nopenssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt -days 360<\/code><\/pre>\n\n\n\n<p>Per part de la configuraci\u00f3 del mosquitto caldr\u00e0 establir aquests valors al conf, els certificats estarien al mateix directori per\u00f2 el correcte seria posar-los en un altre:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>listener 9002\nprotocol websockets\r\ncafile ca.crt\r\ncertfile server.crt\r\nkeyfile server.key\r\ntls_version tlsv1\r\n\r\nsocket_domain ipv4\r\n#require_certificate false\r\nallow_anonymous true<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Les compilacions descarregables de Mosquito corresponents a: No tenen ni ben compilat els websockets (fatal) ni te els websockets sobre http\/2 (greu). La seg\u00fcent m\u00e9s recent \u00e9s la 2.0.18a (maig del 2024) i no t\u00e9 el primer. Per al segon no hi ha un altre remei que desactivar el HTTP2 al firefox al about:config desactivar-lo &hellip; <a href=\"https:\/\/guillemrueda.com\/blog\/2024\/11\/07\/mqtt-websockets-i-certificats\/\" class=\"more-link\">Continua la lectura de <span class=\"screen-reader-text\">MQTT, websockets i certificats<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14,6],"tags":[],"class_list":["post-260","post","type-post","status-publish","format-standard","hentry","category-mqtt","category-programacio"],"_links":{"self":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/comments?post=260"}],"version-history":[{"count":1,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/260\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/posts\/260\/revisions\/261"}],"wp:attachment":[{"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/media?parent=260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/categories?post=260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guillemrueda.com\/blog\/wp-json\/wp\/v2\/tags?post=260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}