Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:mosquitto [2024/08/29 07:27] – [Runit] darrontools:mosquitto [2024/09/01 10:03] (current) – [Test] darron
Line 21: Line 21:
  
 ==Private LAN== ==Private LAN==
 +
 +Create and edit local config
 +
 +<code>
 +vi /etc/mosquitto/conf.d/local.conf
 +</code>
 +
 +Add the following
  
 <code> <code>
-echo "\nlistener 1883\nallow_anonymous true" >> /etc/mosquitto/mosquitto.conf+listener 1883 
 +allow_anonymous true
 </code> </code>
  
 ==Public WAN== ==Public WAN==
 +
 +Create password file and add a user
  
 <code> <code>
-TODO+touch /etc/mosquitto/pwfile 
 +mosquitto_passwd -b /etc/mosquitto/pwfile username password 
 +</code> 
 + 
 +Create and edit local config 
 + 
 +<code> 
 +vi /etc/mosquitto/conf.d/local.conf 
 +</code> 
 + 
 +Add the following 
 + 
 +<code> 
 +listener 8883 
 +allow_anonymous false 
 +password_file /etc/mosquitto/pwfile 
 + 
 +certfile /etc/mosquitto/certs/cert.pem 
 +cafile   /etc/mosquitto/certs/fullchain.pem 
 +keyfile  /etc/mosquitto/certs/key.pem
 </code> </code>
  
Line 38: Line 68:
 sleep 1 sleep 1
  
-mkdir -p /var/log/mosquitto +#LOG 
-chown -R mosquitto mosquitto /var/log/mosquitto+exec 2>&
 +ulimit -l unlimited 
 +ulimit -i unlimited 
 +ulimit -q unlimited 
 +ulimit -n 8192 
 +ulimit -aH
  
-mkdir -p /var/run/mosquitto +#RUN 
-chown -R mosquitto mosquitto /var/run/mosquitto +mkdir -p /var/lib/mosquitto 
- +chown -R mosquitto:mosquitto /var/lib/mosquitto 
-exec /usr/sbin/mosquitto -/etc/mosquitto/mosquitto.conf+mkdir -p /var/log/mosquitto 
 +chown -R mosquitto:mosquitto /var/log/mosquitto 
 +mkdir -/run/mosquitto 
 +chown -R mosquitto:mosquitto /run/mosquitto 
 +exec /usr/sbin/mosquitto -c 
 </code> </code>
  
 ===Test=== ===Test===
  
-MQTT host is listening at 192.168.0.13+==Private LAN==
  
 <code> <code>
 mosquitto_sub -h 192.168.0.13 -t '#' mosquitto_sub -h 192.168.0.13 -t '#'
 </code> </code>
 +
 +==Public WAN==
 +
 +<code>
 +mosquitto_sub -v -h hostname.example.com -p 8883 -u username -P password -t '#'
 +</code>
 +
 +The hostname must match the name in the TLS certificate.