MQTT Authentication (Mosquitto Auth Plug): Fatal Error


#1

We’ve read about MQTT authentication and authorization, and we’ve started the process by installing the necessary files.

Such as the following:

  • git
  • mosquitto-dev
  • libmosquitto-dev
  • postgresql-server-dev-9.6
  • build-essential
  • libssl-dev

We then cloned the repository and as described:

cd /opt
sudo git clone https://github.com/jpmens/mosquitto-auth-plug.git

We then configured the config file by following command (No file was called config.mk, but config.mk.inm so by running following command it created a new file called config.mk):

sudo nano /opt/mosquitto-auth-plug/config.mk

This is what’s written in the configuration file:

(#) Select your backends from this list
BACKEND_CDB ?= no
BACKEND_MYSQL ?= no
BACKEND_SQLITE ?= no
BACKEND_REDIS ?= no
BACKEND_POSTGRES ?= yes
BACKEND_LDAP ?= no
BACKEND_HTTP ?= no
BACKEND_JWT ?= no
BACKEND_MONGO ?= no
BACKEND_FILES ?= yes
BACKEND_MEMCACHED ?= no

(#) Specify the path to the Mosquitto sources here
MOSQUITTO_SRC =

(#) Specify the path the OpenSSL here
OPENSSLDIR = /usr

(#) Specify optional/additional linker/compiler flags here
(#) On macOS, add
(#) CFG_LDFLAGS = -undefined dynamic_lookup
(#) as described in https://github.com/eclipse/mosquitto/issues/244
CFG_LDFLAGS =
CFG_CFLAGS = -DRAW_SALT

Then when compiling the plugin by following commands:

cd /opt/mosquitto-auth-plug
sudo make

We receive following error:

ingen sådan fil eller filkatalog = no such file or directory

What is causing this fatal error?


#2

Make sure you have the right version of mosquitto installed – the master version of mosquitto-auth-plug seems to require 1.5.

If you’re stuck with mosquitto 1.4 (e.g. because your distro does not have newer versions and you don’t want to install from source), you can use version 0.1.2 of the auth plugin which builds and works perfectly fine.

You should also consider switching to mosquitto-go-auth, which is actively maintained and in my opinion offers a far better experience (simpler configuration, no external backend dependencies).

HTH