Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ESP8266 Home Automation Projects

You're reading from  ESP8266 Home Automation Projects

Product type Book
Published in Nov 2017
Publisher Packt
ISBN-13 9781787282629
Pages 196 pages
Edition 1st Edition
Languages
Authors (2):
Catalin Batrinu Catalin Batrinu
Profile icon Catalin Batrinu
Constantin Tambrea Constantin Tambrea
Profile icon Constantin Tambrea
View More author details
Toc

Securing Mosquitto


If your Mosquitto MQTT broker is in the cloud it is a good idea to secure it at least with a user and password.

Mosquitto offers the mosquitto_passwd utility, which allows us to create a user and a password. You will be invited to enter a password and to confirm it:

sudo mosquito_passwd -c /etc/mosquito/passwd   joe

In the /etc/mosquitto directory a file named passwd will be created and in the file will be a user named joe and its encoded password as in the following screenshot:

Now let's add the passwd file into the mosquitto.conf. Use your favorite text editor and change the file /etc/mosquitto.conf to instruct Mosquitto to read and use the passwd file.

The content of the file will be:

Password file location

  • allow_anonymous: It is a boolean value that determines whether clients that connects without providing a username are allowed to connect. If set to false then another means a connection should be created to control authenticated client access.
  • password_file: Sets the path...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}