Client authorization Mosquitto?

huangapple go评论44阅读模式
英文:

Client authorization Mosquitto?

问题

我们希望通过Mosquitto MQTT代理来实现特定的授权检查:

  1. 客户端证书的SAN(主题替代名称)应包含传入MQTT请求的clientID

  2. 客户端只能订阅包含其clientID的主题,即主题授权。

  3. 只有已知的clientID才能订阅通配符主题。

这些是否可以通过配置更改而不更改Mosquitto代码来实现?

英文:

We want to achieve certain Authorization checks using Mosquitto MQTT Broker:

  1. The SAN (Subject Alt Name) of the client certificate shall contain the clientID of the incoming MQTT request.

  2. A client shall be able to subscribe only those topics which contain it's clientID i.e Topic Authorization.

  3. Only known clientID's shall be able to subscribe to wildcard topics.

Can these be achieved with configuration changes without changing Mosquitto code ?

答案1

得分: 1

  1. 如果同时使用 use_identity_as_usernameuse_username_as_clientid,您可以将CN(注意不是SAN)用作用户名和客户端ID。

  2. 这将取决于主题结构的一些因素,但您可以使用 %c 模式构建一个ACL条目,它将匹配以客户端ID开头的所有主题,例如 %c/# 将允许所有以客户端ID开头的主题。

  3. ACL是由用户名而不是客户端ID控制的,但考虑到1.两者应该相同,所以在默认选项下应该是可能的。

英文:
  1. If you combine both use_identity_as_username and use_username_as_clientid you can use the CN (note not the SAN) as both the username and client id.

  2. That will depend a little on the topic structure, but you can probably use the %c pattern to build a ACL entry that will match e.g. %c/# will allow all topics starting with the client id

  3. The ACLs are controlled by username not client id, but given 1. both should be the same so again this should be possible with the default options.

huangapple
  • 本文由 发表于 2023年7月3日 19:45:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76604420.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定