我正在开发 Mosquitto,并计划使用 Redis 作为后端来处理用户名/密码对身份验证和 ACL。我正在使用JPmens 的身份验证插件来执行此操作。身份验证运行良好,但我无法使 ACL 正常工作。Redis 使用唯一的密钥,并且用户名(在我的例子中是密钥)用于用户名/密码对以进行身份验证。我试图在集合/列表中混合用户名、密码和主题,但它们都不起作用。
蚊子会议:
auth_plugin /etc/mosquitto/auth-plug.so
auth_opt_backends redis
auth_opt_redis_host 127.0.0.1
auth_opt_redis_port 6379
auth_opt_redis_userquery GET %s
auth_opt_redis_aclquery GET %s-%s
以下名称/密码对适用于身份验证
SET user1 PBKDF2$sha256$901$Qh18ysY4wstXoHhk$g8d2aDzbz3rYztvJiO3dsV698jzECxSg
SET user2 PBKDF2$sha256$901$R74X2ae3MufMS20M$CAbXZFDmXJN7Cc28Dm/Z97OfM8Tz1JHn ...
以下设置不适用于 ACL:(a/b... 作为主题)
悲伤的 user22 PBKDF2$sha256$901$Qh18ysY4wstXoHhk$g8d2aDzbz3rYztvJiO3dsV698jzECxSg a/bc/d
rpush user33 PBKDF2$sha256$901$q5/N74O6Iaf/e8Cg$dEA3tZSi/sJeXKAkX39Gd3agy2WY96gE e/f
这样做的正确方法是什么?在 Redis API 中,aclrequery
显示:
Single stepping until exit from function be_redis_aclcheck, which has no line number information.
redisCommand (c=0x6537d0, format=0x6561c0 "GET user1-t/c") at hiredis.c:1345
1345 void *redisCommand(redisContext *c, const char *format, ...) {
(gdb) bt
0 redisCommand (c=0x6537d0, format=0x6561c0 "GET my-t/c") at hiredis.c:1345
1 0x00007ffff5e61376 in be_redis_aclcheck () from /etc/mosquitto/auth-plug.so
2 0x00007ffff5e5c351 in mosquitto_auth_acl_check ()
来自 /etc/mosquitto/auth-plug.so
这里,user1
是用户名,t/c
是主题。GET user1-t/c
似乎告诉我 Redis 数据库中需要一个字符串类型。谁能给我一个如何让它工作的例子?
谢谢