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

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

1、先上效果,可以根据mysql中mosquitto数据库的不同users角色登陆mosquitto:
SELECT * FROM mosquitto.users;
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第1张图片

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;

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

Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第2张图片

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

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

Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第3张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第4张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第5张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第6张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第7张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第8张图片
Ubuntu22.04.1上 mosquitto安装及mosquitto-auth-plug 认证插件配置_第9张图片
2、账号密码 123456


你可能感兴趣的:(物联项目,读书笔记,java,数据库,auth-plug)