eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.93k stars 2.37k forks source link

Trying to add the auth plugin in Mosquitto broker #1110

Open itsmiranda opened 5 years ago

itsmiranda commented 5 years ago

Hello guys, I'm trying to add the auth plugin in the mosquitto broker. But when I add the settings in the mosquitto.conf file and trying to run mosquitto -c /home/USER/mosquitto/mosquitto.conf it returns me the error: Error: Unable to open config file /home/USER/mosquitto/mosquitto.conf Error found at /home/USER/mosquitto/mosquitto.conf:0. Error: Unable to open configuration file.

Here's my mosquitto.conf file

# =================================================================
# Security
# =================================================================

# If set, only clients that have a matching prefix on their 
# clientid will be allowed to connect to the broker. By default, 
# all clients may connect.
# For example, setting "secure-" here would mean a client "secure-
# client" could connect but another with clientid "mqtt" couldn't.
#clientid_prefixes

# Boolean value that determines whether clients that connect 
# without providing a username are allowed to connect. If set to 
# false then a password file should be created (see the 
# password_file option) to control authenticated client access. 
#
# Defaults to true if no other security options are set. If any other
# authentication options are set, then allow_anonymous defaults to false.
#
#allow_anonymous true

# In addition to the clientid_prefixes, allow_anonymous and TLS 
# authentication options, username based authentication is also 
# possible. The default support is described in "Default 
# authentication and topic access control" below. The auth_plugin 
# allows another authentication method to be used.
# Specify the path to the loadable plugin and see the 
# "Authentication and topic access plugin options" section below.
#auth_plugin

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_hostname example.org
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 possible answers? I have only modified the security part in the mosquitto.conf file.
ralight commented 5 years ago

The error Error found at /home/USER/mosquitto/mosquitto.conf:0. is saying that it has failed before it has even read a line, so the most likely scenario is that it doesn't have permission to read the config file, or it doesn't exist at the path you gave.

jeremyLi1990 commented 5 years ago

The error Error found at /home/USER/mosquitto/mosquitto.conf:0. is saying that it has failed before it has even read a line, so the most likely scenario is that it doesn't have permission to read the config file, or it doesn't exist at the path you gave.

Hi, how to config acl and user auth in database with last mosquitto version 1.6.X? Is there any docs?