Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Set username and password for brokerconnection #16

Open
Fabi1080 opened this issue Feb 10, 2017 · 3 comments
Open

[Question] Set username and password for brokerconnection #16

Fabi1080 opened this issue Feb 10, 2017 · 3 comments
Labels

Comments

@Fabi1080
Copy link

Is there an easy way to start this container with an username and password for the broker connection configured? Let any security issues aside, i need that for testing. Thx.

@toke toke added the question label Feb 10, 2017
@toke
Copy link
Owner

toke commented Feb 10, 2017

Hello @Fabi1080,

Kind of…
As you can provide an configuration you can add passwords too.

The easiest way to do this is running it with -v /srv/mqtt/config:/mqtt/config and place your config in /srv/mqtt/config/(mosquitto.conf)`

Just configure your ACL's and Passwords there. You can run mosquitto_passwd inside you container if you need hashed passwords.

A start would be (relevant part only):

allow_anonymous true

password_file /mqtt/config/mosquitto.passwd
acl_file /mqtt/config/mosquitto.acl

mosquitto.acl:

user toke
topic read #
topic readwrite devices/#
topic readwrite homie/#

@thunderkit
Copy link

thunderkit commented Dec 31, 2017

@Fabi1080 @toke any of you please help. Created hashed password in container, but while writing it is throwing error as readonly, how to create a file and specify in password_file.

@koraysels
Copy link

koraysels commented Mar 13, 2018

I had the same problem. but just create a temporary passwd in dthe container and copy the value into your config. like this:

$ touch passwd
$ mosquitto_passwd -b passwd mosquitto test
$ cat passwd

then you will have your hashed password .. hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants