Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Authentication failure

Just to be clear.

You are creating a password file in the following format

username:password

Where `password` is the clear text version of the password?

If so this will be the problem. The password file needs to be generated with the `mosquitto_passwd` file and should be of the following format

username:hashed_password.

You can do this with the mosquitto_passwd comand as follows

mosquitto_passed -b /etc/mosquitto/passwd usename password

The following is from the mosquitto.conf man page

Set the path to a password file. If defined, the contents of the file are used to control client access to the broker. The file can be created using the mosquitto_passwd(1) utility. If mosquitto is compiled without TLS support (it is recommended that TLS support is included), then the password file should be a text file with each line in the format "username:password", where the colon and password are optional but recommended

Note the second sentence is for is mosquitto is compiled **without** TLS, the build in the container includes TLS support.

If this is not the case please give a lot more details about how the password file is being generated and your mosquitto.conf (and any additional file in the conf.d directory)

On 25/08/2024 04:26, Anthony Falzon III via mosquitto-dev wrote:
Yes, the service is running, when I change the allow anonymous to yes it works.

I ran
chown mosquitto:mosquitto /etc/mosquitto/passwd

After creating the passwd file, that should take care of file access. It also can write to the file because it's generating the auto password through your utility.

I have tried a simplified password and that did not work either.


------------------------------------------------------------------------
*From:* mosquitto-dev <mosquitto-dev-bounces@xxxxxxxxxxx> on behalf of Peter Rockett via mosquitto-dev <mosquitto-dev@xxxxxxxxxxx>
*Sent:* Saturday, August 24, 2024 3:30:33 AM
*To:* mosquitto-dev@xxxxxxxxxxx <mosquitto-dev@xxxxxxxxxxx>
*Cc:* Peter Rockett <p.rockett@xxxxxxxxxxxxxxx>
*Subject:* Re: [mosquitto-dev] Authentication failure

Is the mosquitto service actually running?

As of mosquitto version 2.0.18 (at least), the passwd file requires read access for the ‘mosquitto’ user that is created when installing the software.  Otherwise starting the mosquitto service fails. This is documented, but is easy to overlook.

P.


On 24/08/2024 03:31, Anthony Falzon III via mosquitto-dev wrote:
I am using tteks script to install mqtt as a docker LXC.

Install went fine, created the passwd file, which generated:
<username>:<auto generated password>

I am getting an authorization error when using the username or password in that file.

conf.d does point to that file. allow_anonymous is set to false. If I change it to true and comment out my password/username I everything works as expected.


I'm failing in Z2MQTT and Home Assistant.



_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx  <mailto:mosquitto-dev@xxxxxxxxxxx>
To unsubscribe from this list, visithttps://www.eclipse.org/mailman/listinfo/mosquitto-dev  <https://www.eclipse.org/mailman/listinfo/mosquitto-dev>

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev

--
https://www.hardill.me.uk/wordpress
https://github.com/hardillb
https://about.me/hardillb
https://flickr.com/photos/hardillb/
https://keybase.io/hardillb


Back to the top