将 mosquitto MQTT 发布者限制为仅一个 IP 地址
我不确定这是否可以从conf 文件中实现,但应该可以。我不关心订阅者来自哪个网络......即订阅者连接到哪个 IP 地址/网络适配器,但我只希望 127.0.0.1 或其他网络适配器(如 openVPN 虚拟适配器)能够发布消息。 用蚊子可以实现吗?
I'm not sure if this is possible from the conf file but it should be. I don't care what network subscribers come from... .i.e what ip address/network adapter the subscribers connect to but I only want 127.0.0.1 or another network adapter (like an openVPN virtual adapter) to be able to publish messages.
Is that achievable with mosquitto?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不容易。通常,您可以通过用户名来识别可以发布然后拒绝向匿名用户发布的用户。
您可以通过使用
per_listener_settings
设置将不同的 ACL 文件附加到每个监听器并为 lo 接口指定一个特定的监听器,从而有效地实现您想要的目的。这样做的问题是你需要为每个接口都有监听器,并且我不确定它对于启动时可能不存在的接口(例如 VPN 适配器)会如何表现
Not easily. This is normally something you would do via usernames to identify a user that can publish and then deny publishing to anonymous users.
You may be able to effectively achieve what you want by using the
per_listener_settings
setting to attach different ACL files to each listener and have a specific listener for the lo interface.The problem with this is you would need to have listeners for every interface and I'm not sure how it would behave with interfaces that may not be present at startup (e.g. a vpn adapter)