-
Notifications
You must be signed in to change notification settings - Fork 4k
Add config to adjust MQTT whether disconnect when publish or subscribe non-authorized topic #15123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| %% | ||
| %% {ignore_unauthorized, false}, | ||
|
|
||
| {mapping, "mqtt.ignore_unauthorized", "rabbitmq_mqtt.ignore_unauthorized", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a problem with this name. Ignore authorized what specifically?
This could be mqtt.ignore_authorization_failures but that would not explain when exactly and the name can be misleading.
mqtt.maintain_connection_on_authorization_failures is slightly more specific and is the best suggestion I have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find maintain_connection_on_authorization_failures is too long.
Let's name it disconnect_on_unauthorized (defaulting to true since that's today's behaviour).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale of this PR makes sense because the MQTT 5.0 spec states:
Errors other than Malformed Packet and Protocol Errors cannot be anticipated by the sender because the receiver might have constraints which it has not communicated to the sender. A receiving Client or Server might encounter a transient error, such as a shortage of memory, that prevents successful processing of an individual MQTT Control Packet. Acknowledgment packets PUBACK, PUBREC, PUBREL, PUBCOMP, SUBACK, UNSUBACK with a Reason Code of 0x80 or greater indicate that the received packet, identified by a Packet Identifier, was in error. There are no consequences for other Sessions or other Packets flowing on the same Session.
EMQX also has a config option to toggle this disconnect on authz failure behaviour.
I find maintain_connection_on_authorization_failures is too long.
Let's name it disconnect_on_unauthorized (defaulting to true since that's today's behaviour).
@iamdrq tests are missing. Please add tests.
Proposed Changes
Thanks all works.
In MQTT spec, not clear descipe client whether disconnect when publish or subscribe non-authorized topic,
So implement has diffrent action:
In AMQP spec, disconnect client when touch non-authorized topic, so Rabbitmq MQTT keep this action now.
In MQTT spec,this is not clear.
Someone hope touch non-authorized topic disconnect and someone hope not, #12902
So let's add config to adjust Rabbitmq MQTT whether disconnect when
publishorsubscribenon-authorized topic,give control to the user.
rabbitmq.conf
mqtt.ignore_unauthorized=false
mqtt.ignore_unauthorized=true
Types of Changes
What types of changes does your code introduce to this project?
Checklist
CONTRIBUTING.mddocument