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

Error: Unable to load auth plugin "/usr/lib/auth-plug.so" #33

Closed
gallog opened this Issue Oct 6, 2014 · 12 comments

Comments

Projects
None yet
5 participants
@gallog
Copy link

gallog commented Oct 6, 2014

Hi,
I've a problem running your library on a x86 machine:

./mosquitto -c mosquitto.conf1412605004: mosquitto version 1.3.4 (build date 2014-10-06 16:14:36+0200) starting
1412605004: Config loaded from mosquitto.conf.
1412605004: Error: Unable to load auth plugin "/usr/lib/auth-plug.so".

I've succesfully compiled the library without modify your makefile (I've only changed the MOSQUITTO_SRC) and moved to /usr/lib/auth.plugin.so.

I'm using mosquitto 1.3.4 compiled by myself and here is my mosquitto.conf:

autosave_interval 1800
connection_messages true
log_timestamp true
listener 1883
auth_plugin /usr/lib/auth-plug.so
auth_opt_backends mysql
auth_opt_host 127.0.0.1
auth_opt_port 3306
auth_opt_dbname mqtt
auth_opt_user mqttauth
auth_opt_pass mqttauthpassword
auth_opt_userquery SELECT password FROM USERS WHERE id_user = %s
auth_opt_superquery SELECT IFNULL(COUNT(), 0) FROM USERS WHERE id_user = %s AND superuser = 1
auth_opt_superusers S

@jpmens

This comment has been minimized.

Copy link
Owner

jpmens commented Oct 6, 2014

You've compiled yourself, so you've probably also made install in Mosquitto. Did you remember to run ldconfig so that your system picks up new libs? Also, check ldd /usr/lib/auth-plug.so to see whether all paths can be resolved.

@gallog

This comment has been minimized.

Copy link
Author

gallog commented Oct 6, 2014

I've made
sudo make install
sudo ldconfig

ldd output:
ldd /usr/lib/auth-plug.so
linux-gate.so.1 => (0xb777b000)
libmysqlclient.so.18 => /usr/lib/i386-linux-gnu/libmysqlclient.so.18 (0xb743b000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xb7290000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb70ea000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb70d4000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb70cf000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb70b4000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7088000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7069000)
/lib/ld-linux.so.2 (0xb777c000)

ldd mosquitto
linux-gate.so.1 => (0xb7708000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb76eb000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb76bf000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xb76b5000)
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0 (0xb765d000)
libcrypto.so.1.0.0 => /lib/i386-linux-gnu/libcrypto.so.1.0.0 (0xb74b2000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb730d000)
/lib/ld-linux.so.2 (0xb7709000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb72f2000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xb72db000)

@jpmens

This comment has been minimized.

Copy link
Owner

jpmens commented Oct 6, 2014

In Mosquitto's src/security.c, on line 56, can you add this after the call to LIB_LOAD?

if (!lib){
       printf("LOADERROR %s\n", dlerror());
@gallog

This comment has been minimized.

Copy link
Author

gallog commented Oct 6, 2014

Output:
LOADERROR /usr/lib/auth-plug.so: undefined symbol: ares_library_init

@jpmens

This comment has been minimized.

Copy link
Owner

jpmens commented Oct 6, 2014

There you go. :)
Mosquitto requires the cares for DNS SRV records, but you can safely change Mosquitto's config.mk to set WITH_SRV:=no. Then:

make clean
make
@gallog

This comment has been minimized.

Copy link
Author

gallog commented Oct 6, 2014

Solved, thanks :)
Also need to rebuild you plugin after changing WITH_SRV:=no and recompiling mosquitto.

@jpmens

This comment has been minimized.

Copy link
Owner

jpmens commented Oct 6, 2014

Because of the linkage with Mosquitto, yes. Sorry: I forgot to say that. Glad it works now.

@zhangshexin

This comment has been minimized.

Copy link

zhangshexin commented Dec 19, 2014

Hello, I am using is 1.3.5, I tried in accordance with the above method, but it's still an error like that

@hkverma310

This comment has been minimized.

Copy link

hkverma310 commented Sep 11, 2015

Access denied for user 'xxxx'@'localhost' (using password: NO)
i am getting the above error

any help

auth_opt_backends mysql
auth_opt_db_host 192.168.1.95
auth_opt_db_port 3307
auth_opt_db_username root
auth_opt_db_password root
auth_opt_dbname test
auth_opt_anonusername AnonymouS
auth_opt_userquery SELECT pw FROM users WHERE username = '%s'
auth_opt_superquery SELECT IFNULL(COUNT(*), 0) FROM users WHERE username = '%s' AND super = 1

@jpmens

This comment has been minimized.

Copy link
Owner

jpmens commented Sep 11, 2015

Why are you commenting on a closed issue with something that has nothing to do with the original issue?! The plugin isn't allowed to connect to mysql. are you sure root is your db password?

@hkverma310

This comment has been minimized.

Copy link

hkverma310 commented Sep 11, 2015

yeah my db password is root

@mahesh-balumuri

This comment has been minimized.

Copy link

mahesh-balumuri commented Mar 11, 2016

I have changed WITH_SRV:=no and recompiled both mosquitto and mqtt-auth-plugin. I am getting the below error.

./mosquitto -c ../local.conf
1457697662: mosquitto version 1.4.8 (build date 2016-03-11 03:59:19-0800) starting
1457697662: Config loaded from ../local.conf.
1457697662: |-- *** auth-plug: startup
|-- No backends configured.
|-- *** ABORT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment