Closed chrysa95 closed 5 years ago
Did you copy the compiled auth-plug.so
into /home/user/mosquitto
?
Becaus it says No such file or directory
@t00manysecretss No, i couldn't do that, because when i am trying to build mosquitto-auth-plugin by executing the following in command: sudo make I got the following error: Makefile:160: recipe for target 'auth-plug.so' failed make: *** [auth-plug.so] Error 1
Did you read the readme?
If you use the plugin you should also compile the mosquitto server by yourself. That should be done before compiling the plugin.
Example for debian would be:
# dependencies
apt-get update
apt-get install axel git ca-certificates build-essential libc-ares-dev uuid-dev libwebsockets-dev libmariadbclient-dev libssl-dev xsltproc docbook-xsl
# source code
axel -o mosquitto-src.tar.gz https://github.com/eclipse/mosquitto/archive/v${MOSQUITTO_VERSION}.tar.gz
axel -o mosquitto-auth-plug.tar.gz https://github.com/jpmens/mosquitto-auth-plug/archive/${AUTH_VERSION}.tar.gz
tar -xvzf mosquitto-src.tar.gz
tar -xvzf mosquitto-auth-plug.tar.gz
mv -v mosquitto-${MOSQUITTO_VERSION} ~/mosquitto
mv -v mosquitto-auth-plug-${AUTH_VERSION} ~/auth
# configuration dir
mkdir -p /etc/mosquitto
# mosquitto compilation
cd ~/mosquitto
make WITH_SRV=yes WITH_UUID=no WITH_WEBSOCKETS=yes WITH_TLS=yes WITH_DOCS=yes \
make install
# this is needed so that the auth-plug can find the libmosquitto.so.1 file without installing libmosquitto-dev with apt-get. You could also simply copy the file instead of creating a softlink
cd /usr/lib/x86_64-linux-gnu/
ln -s -v ./../../../home/$USER/mosquitto/lib/libmosquitto.so.1 ./
cd ~/auth
# configure config.mk
make
Example config.mk
# Select your backends from this list
BACKEND_CDB ?= no
BACKEND_MYSQL ?= yes
BACKEND_SQLITE ?= no
BACKEND_REDIS ?= no
BACKEND_POSTGRES ?= no
BACKEND_LDAP ?= no
BACKEND_HTTP ?= no
BACKEND_JWT ?= no
BACKEND_MONGO ?= no
BACKEND_FILES ?= no
BACKEND_MEMCACHED ?= no
# Specify the path to the Mosquitto sources here
# MOSQUITTO_SRC = /usr/local/Cellar/mosquitto/1.4.12
MOSQUITTO_SRC = /mosquitto
# Specify the path the OpenSSL here
OPENSSLDIR =
# Add support for django hashers algorithm name
SUPPORT_DJANGO_HASHERS ?= no
# 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 = -undefined dynamic_lookup -L/usr/local/Cellar/openssl/1.0.2l/lib
# CFG_CFLAGS = -I/usr/local/Cellar/openssl/1.0.2l/include -I/usr/local/Cellar/mosquitto/1.4.12/include
CFG_LDFLAGS =
CFG_CFLAGS = -I/usr/include/mysql
Please note that this commands are for a installation on debian with the mysql backend and websocket support!
@t00manysecretss i have done this.I am following this tutorial:http://www.yasith.me/2016/04/securing-mqtt-connection-using.html
My config.mk
# Select your backends from this list
BACKEND_CDB ?= no
BACKEND_MYSQL ?= no
BACKEND_SQLITE ?= no
BACKEND_REDIS ?= no
BACKEND_POSTGRES ?= no
BACKEND_LDAP ?= no
BACKEND_HTTP ?= yes
BACKEND_JWT ?= no
BACKEND_MONGO ?= no
BACKEND_FILES ?= no
BACKEND_MEMCACHED ?= no
# Specify the path to the Mosquitto sources here
# MOSQUITTO_SRC = /usr/local/Cellar/mosquitto/1.4.12
MOSQUITTO_SRC = /home/user/mqtt/mosquitto
# Specify the path the OpenSSL here
OPENSSLDIR = /usr/bin
# Add support for django hashers algorithm name
SUPPORT_DJANGO_HASHERS ?= no
# 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 = -undefined dynamic_lookup -L/usr/local/Cellar/openssl/1.0.2l/lib
# CFG_CFLAGS = -I/usr/local/Cellar/openssl/1.0.2l/include -I/usr/local/Cellar/mosquitto/1.4.12/include
CFG_LDFLAGS =
CFG_CFLAGS =
When i am trying sudo make
in order to create auth-plug.so ,I have a problem with make (maybe)
as i mentioned before.
Could please tell me which linux version you are using and post the entire make log?
I assume you use debian or ubuntu.
Because then you do not need to set the OPENSSLDIR variable in the config.mk
Actually this broke my compilation once because a /include
was added at the end of it an then the compilation failed.
Ubuntu 16.04.5 I remove the OPENSSLDIR variable in the config.mk and it works fine, as you suggested. But when i try this in order to run the mosquitto broker
Machine:~/mqtt/mosquitto$ mosquitto -c /home/user/mosquitto/mosquitto.conf
Error: Unable to open config file /home/user/mosquitto/mosquitto.conf
Error found at /home/hit5/mosquitto/mosquitto.conf:0.
Error: Unable to open configuration file.
Machine:~/mqtt/mosquitto$
This maybe happens due to access rights. Try (if not already enabled) to allow read for everyone or change the owner to the user which executes mosquitto
Hello,
I m trying to load auth-pluguin but i have the following error
Virtual-Machine:~$ mosquitto -c /home/user/mqtt/mosquitto/mosquitto.conf
mosquitto version 1.5.5 starting Config loaded from /home/user/mqtt/mosquitto/mosquitto.conf. Error: Unable to load auth plugin "/home/user/mosquitto/auth-plug.so". Load error: /home/user/mosquitto/auth-plug.so: cannot open shared object file: No such file or directory
I edit the mosquitto.config file as follow (in security section) : auth_plugin /home/user/mosquitto/auth-plug.so auth_opt_backends http auth_opt_http_ip 172.22.17.*** auth_opt_http_port 8083 auth_opt_http_getuser_uri /mosquitto/authplugin/auth auth_opt_http_superuser_uri /mosquitto/authplugin/superuser auth_opt_http_aclcheck_uri /mosquitto/authplugin/acl
Any ideas? Thanks!