ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

mosquitto auth http 安全认证

2022-01-13 10:04:51  阅读:206  来源: 互联网

标签:plug http no auth mosquitto BACKEND


mosquitto auth http 安全认证

安装curl依赖

yum install -y libcurl-dev libcurl-devel

安装mosquitto-auth-plug

下载安装包:https://github.com/jpmens/mosquitto-auth-plug/releases/

wget https://github.com/jpmens/mosquitto-auth-plug/archive/0.1.3.tar.gz
tar -xzvf mosquitto-auth-plug-0.1.3.tar.gz
cd mosquitto-auth-plug-0.1.3
cp config.mk.in config.mk

vim 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 = /data/mosquitto

# Specify the path the OpenSSL here
OPENSSLDIR = /etc/pki/tls

# 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 =

查看openssl的安装目录的方法:

openssl version -a

将mosquitto目录下的config.h复制到 ./src/下一份
修改uthash.h,在uthash.h中添加一行

#define _mosquitto_free(ptr)

接下来执行编译指令(如果之前在使用其他插件时进行过编译,先执行make clean)

make

编译成功会在当前目录下生成auth-plug.so文件,然后将auth-plug.so复制到mosquitto的目录下的plugin中
修改mosquitto的配置文件

allow_anonymous false
auth_plugin /data/mqttbroker/mosquitto/plugin/auth-plug.so
auth_opt_backends http
auth_opt_http_ip 172.30.1.146
auth_opt_http_port 9060
#auth_opt_http_hostname example.org
auth_opt_http_getuser_uri /mosquitto/auth
auth_opt_http_superuser_uri /mosquitto/superuser
auth_opt_http_aclcheck_uri /mosquitto/acl

重启mosquitto

标签:plug,http,no,auth,mosquitto,BACKEND
来源: https://blog.csdn.net/huihui_1223/article/details/122460523

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有