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:42] – [Setup] darrontools:mosquitto [2024/09/01 10:03] (current) – [Test] darron
Line 22: Line 22:
 ==Private LAN== ==Private LAN==
  
 +Create and edit local config
  
-/etc/mosquitto/conf.d/local/conf:+<code> 
 +vi /etc/mosquitto/conf.d/local.conf 
 +</code> 
 + 
 +Add the following
  
 <code> <code>
Line 31: Line 36:
  
 ==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 42: Line 68:
 sleep 1 sleep 1
  
 +#LOG
 +exec 2>&1
 +ulimit -l unlimited
 +ulimit -i unlimited
 +ulimit -q unlimited
 +ulimit -n 8192
 +ulimit -aH
 +
 +#RUN
 mkdir -p /var/lib/mosquitto mkdir -p /var/lib/mosquitto
 chown -R mosquitto:mosquitto /var/lib/mosquitto chown -R mosquitto:mosquitto /var/lib/mosquitto
- 
 mkdir -p /var/log/mosquitto mkdir -p /var/log/mosquitto
 chown -R mosquitto:mosquitto /var/log/mosquitto chown -R mosquitto:mosquitto /var/log/mosquitto
- 
 mkdir -p /run/mosquitto mkdir -p /run/mosquitto
 chown -R mosquitto:mosquitto /run/mosquitto chown -R mosquitto:mosquitto /run/mosquitto
- +exec /usr/sbin/mosquitto -c 
-exec /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf+
 </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.