Instalando
pkg update
pkg install mosquitto
Configurando uso en local
En el jail el fichero mosquitto.conf
tiene la magia, pero al intentar correr el servicio
tenemos
Editamos el fichero /usr/local/etc/mosquitto/mosquitto.conf
para seguridad basica
listener 1883
allow_anonymous false
password_file /usr/local/etc/mosquitto/passwd
mosquitto_passwd -c /usr/local/etc/mosquitto/passwd espuser (1)
1 | Nos pedirรก una password |
Habilitando arranque
sysrc mosquitto_enable=YES
service mosquitto start
Starting mosquitto. 1759265215: Error: cafile specified without certfile and keyfile. /usr/local/etc/rc.d/mosquitto: WARNING: failed to start mosquitto
Error: cafile specified without certfile and keyfile. |
Evita que podamos levantar el servicio de mosquitto, debido a que nos exigue TLS habilitado, pero para pequeรฑas pruebas en local podemos comentar la linea siguiente:
grep -n cafile /usr/local/etc/mosquitto/mosquitto.conf
282:# cafile, certfile, keyfile, ciphers, and ciphers_tls13 options are supported.
354:# cafile and capath define methods of accessing the PEM encoded
357:# cafile defines the path to a file containing the CA certificates.
363:cafile /usr/local/share/certs/ca-root-nss.crt (1)
844:# Either bridge_cafile or bridge_capath must be defined to enable TLS support
846:# bridge_cafile defines the path to a file containing the
853:#bridge_cafile
1 | La linea 362 la comentaremos. |
โ ~ service mosquitto restart
mosquitto not running? (check /var/run/mosquitto.pid).
Starting mosquitto.
โ ~ sockstat -4 -l | grep 1883
nobody mosquitto 17836 5 tcp4 *:1883 *:*