Skip to content

Commit

Permalink
add username/pass to mosquitto
Browse files Browse the repository at this point in the history
  • Loading branch information
CamDavidsonPilon committed Nov 27, 2022
1 parent 8a7ce28 commit fb56766
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion workspace/scripts/09-install-mosquitto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ if [ "$LEADER" == "1" ]; then
sudo apt-get install -y mosquitto mosquitto-clients
sudo systemctl enable mosquitto.service

# create auth file
echo "pioreactor:raspberry" > /etc/mosquitto/pw.txt
# hash password
mosquitto_passwd -U /etc/mosquitto/pw.txt

grep -qxF 'autosave_interval 300' /etc/mosquitto/mosquitto.conf || echo "autosave_interval 300" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'listener 1883' /etc/mosquitto/mosquitto.conf || echo "listener 1883" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'protocol mqtt' /etc/mosquitto/mosquitto.conf || echo "protocol mqtt" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'listener 9001' /etc/mosquitto/mosquitto.conf || echo "listener 9001" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'protocol websockets' /etc/mosquitto/mosquitto.conf || echo "protocol websockets" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'allow_anonymous true' /etc/mosquitto/mosquitto.conf || echo "allow_anonymous true" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'allow_anonymous false' /etc/mosquitto/mosquitto.conf || echo "allow_anonymous false" | sudo tee /etc/mosquitto/mosquitto.conf -a
grep -qxF 'password_file /etc/mosquitto/pw.txt' /etc/mosquitto/mosquitto.conf || echo "password_file /etc/mosquitto/pw.txt" | sudo tee /etc/mosquitto/mosquitto.conf -a
fi

0 comments on commit fb56766

Please sign in to comment.