Closed rcadena closed 6 years ago
@rcadena thank you for your report. I have, based on your suggested patch, added support for this and I'd appreciate you testing it.
The way it's supposed to work is that when we detect that a client has authenticated with a TLS client certificate that we then use the functions you propose to extract clientId
and username
. Should these not be available we DEFER as we've done so far.
Does that sound reasonable? And more importantly: does it actually work for you?
@jpmens apologies for the delay in replying. I will give it a test and report back. Thanks!
@jpmens I just tried it and ran the same tests and it works perfectly! Thanks for the patch.
Thank you, @rcadena for the hint and the fix, and for reporting back.
mosquitto: 1.5.3 mosquitto_auth_plug: Commit # 4e7fe9a
backend: http
mosquitto.conf configured with:
Issue: The ACL check on auth-plug.c:611 fails when a client is "authenticated" via a certificate.
It looks like the plugin's auth method is not called when the above config options are used, so the client is not "cached" by auth-plug, which causes the ACL call to fail getting the username and id from the hash.
Details:
A quick fix I implemented was as follows:
This extracts the clientid and username using mosquitto's built in functions. I'm not sure this is the correct way to fix this, however. Thoughts are welcome.
NOTE This is the same issue as: https://github.com/jpmens/mosquitto-auth-plug/issues/331 however, the fix there was first to set the cache time to 0, and to make sure the superusers return 40X... However, I would like to not have to set the cache time to 0 because I could be making lots of ACL checks.