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

复制代码
相关推荐
快来卷java24 分钟前
JVM虚拟机篇(五):深入理解Java类加载器与类加载机制
java·jvm·mysql
禾小西2 小时前
Java 逐梦力扣之旅_[204. 计数质数]
java·算法·leetcode
快来卷java2 小时前
MySQL篇(六)MySQL 分库分表:应对数据增长挑战的有效策略
数据库·mysql·oracle
ゞ 正在缓冲99%…2 小时前
leetcode295.数据流的中位数
java·数据结构·算法·leetcode·
有梦想的攻城狮4 小时前
spring-cloud-alibaba-nacos-config使用说明
java·spring·nacos·springcloud·配置中心
IT认证通关4 小时前
金仓数据库KCM认证考试介绍【2025年4月更新】
数据库
程序猿阿伟4 小时前
《SQL赋能人工智能:解锁特征工程的隐秘力量》
数据库·人工智能·sql
冰箱里的金鱼5 小时前
MYSQL 存储引擎 和 日志
数据库
Yan-英杰5 小时前
【百日精通JAVA | SQL篇 | 第三篇】 MYSQL增删改查
java·数据库·sql
信徒_5 小时前
Mysql 中的 binlog、redolog、undolog
数据库·mysql