I have a working system using Mosquitto 2.0.13. There are two connection types - client and engine
both types use TLS client certificates and use the same listener on 8883. Because of legacy code the clients are not logging on (yet) so the listener is set to allow anonymous.
I have been doing some basic penetration testing and found a concern but don’t know if this is a problem or not.
My ACL is set up to allow anonymous clients the ability to read and write client patterns
pattern read /pgn/%c/cmd
pattern write /pgn/%c/data
I connect as client1 and tried to publish as client2 and log showed ‘denied PUBLISH’ - Good, that is what I want.
But, client2 ( or anyone) seems to be able to subscribe to ANY topic ( even /# ) without an error in the log . Log shows ‘Received SUSCRIBE from client1 /# (Qos 1)’. It does not appear that the bad subscribe is working in that the client is not receiving more data than it should after the extra subscribe but I am worried that the log suggests the subscribe has been approved.
Any idea what is happening?
Here are config and ACL
config
per_listener_settings true
allow_anonymous false
connection_messages true
# uncomment logdest stdout for troubleshooting to see live logs on screen
#log_dest stdout
log_type debug
log_type error
log_type warning
log_type notice
log_type information
listener 8883
allow_anonymous true
acl_file /etc/mosquitto/conf.d/newacl.txt
password_file /etc/mosquitto/conf.d/passwords.txt
cafile /etc/mosquitto/ca_certificates/ca.crt
certfile /etc/mosquitto/certs/server.crt
keyfile /etc/mosquitto/certs/server.key
require_certificate true
tls_version tlsv1.2
ACL
#user clientdevice ( commented out so anonymous)
pattern read /pgn/%c/cmd
pattern write /pgn/%c/data
# user engine gets to read and write all topics
user engine
topic readwrite /pgn/#
topic readwrite $SYS/#