Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置

Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置

1、先上效果,可以根据mysql中mosquitto数据库的不同users角色登陆mosquitto:

SELECT * FROM mosquitto.users;

bash 复制代码
id,username,pw,super
1,jjolie,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,0
2,a,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,0
3,su1,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,1
4,S1,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,1
5,m1,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,0
6,ps1,PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH,0

SELECT * FROM mosquitto.acls;

bash 复制代码
-- MySQL dump 10.13  Distrib 8.0.32, for Linux (x86_64)
--
-- Host: 127.0.0.1    Database: mosquitto
-- ------------------------------------------------------
-- Server version	8.0.34-0ubuntu0.22.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(25) NOT NULL,
  `pw` varchar(128) NOT NULL,
  `super` int NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'jjolie','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',0),(2,'a','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',0),(3,'su1','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',1),(4,'S1','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',1),(5,'m1','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',0),(6,'ps1','PBKDF2$sha256$901$yZnELWKK4NnaNNJl$+T24etYFlJ7AtliumcehcOtudZGLu9ZH',0);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-08-31 16:17:15
bash 复制代码
id,username,topic,rw
1,jjolie,loc/jjolie,1
2,jjolie,loc/ro,1
3,jjolie,loc/rw,2
4,jjolie,$SYS/something,1
5,a,loc/test/#,1
6,a,$SYS/broker/log/+,1
7,su1,/#,1
8,nop,mega/secret,1
9,jog,loc/#,1
10,m1,loc/#,1
11,ps1,x,1
12,ps1,blabla/%c/priv/#,1
bash 复制代码
-- MySQL dump 10.13  Distrib 8.0.32, for Linux (x86_64)
--
-- Host: 127.0.0.1    Database: mosquitto
-- ------------------------------------------------------
-- Server version	8.0.34-0ubuntu0.22.04.1

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `acls`
--

DROP TABLE IF EXISTS `acls`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `acls` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(25) NOT NULL,
  `topic` varchar(256) NOT NULL,
  `rw` int NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `acls_user_topic` (`username`,`topic`(228))
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `acls`
--

LOCK TABLES `acls` WRITE;
/*!40000 ALTER TABLE `acls` DISABLE KEYS */;
INSERT INTO `acls` VALUES (1,'jjolie','loc/jjolie',1),(2,'jjolie','loc/ro',1),(3,'jjolie','loc/rw',2),(4,'jjolie','$SYS/something',1),(5,'a','loc/test/#',1),(6,'a','$SYS/broker/log/+',1),(7,'su1','/#',1),(8,'nop','mega/secret',1),(9,'jog','loc/#',1),(10,'m1','loc/#',1),(11,'ps1','x',1),(12,'ps1','blabla/%c/priv/#',1);
/*!40000 ALTER TABLE `acls` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2023-08-31 16:17:15







2、账号密码 123456

复制代码
相关推荐
Python私教2 小时前
model中能定义字段声明不存储到数据库吗
数据库·oracle
吾日三省吾码3 小时前
JVM 性能调优
java
弗拉唐4 小时前
springBoot,mp,ssm整合案例
java·spring boot·mybatis
oi774 小时前
使用itextpdf进行pdf模版填充中文文本时部分字不显示问题
java·服务器
BestandW1shEs4 小时前
谈谈Mysql的常见基础问题
数据库·mysql
重生之Java开发工程师4 小时前
MySQL中的CAST类型转换函数
数据库·sql·mysql
教练、我想打篮球5 小时前
66 mysql 的 表自增长锁
数据库·mysql
Ljw...5 小时前
表的操作(MySQL)
数据库·mysql·表的操作
哥谭居民00015 小时前
MySQL的权限管理机制--授权表
数据库