Skip to content
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

Feature database client id match #2197

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bilal-haider-cowlar
Copy link

Proposed Changes

As we were using username and password in acl file auth. But in the case of DB, we are also matching client_id. There are a lot of cases where we only want to authenticate using username and password from the DB. So, i made this thing optional.

Now we only have to pass a variable in our docker env like DATABASE_CLIENT_ID_MATCH: 'off'. If its value is off then client_id will not get matched from DB and it will act same like in case of acl files auth.

I just access this variable from os env and i have changed swl query for not matching client_id.

Types of Changes

  • Bugfix (non-breaking change which fixes issue #XXXX)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (correction or otherwise)
  • Cosmetics (whitespace, styles...)
  • DevOps (Build scripts, pipelines...)

Checklist

  • I have read the CODE_OF_CONDUCT.md document
  • All tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if needed)
  • Any dependent changes have been merged and published in related repositories
  • I have updated changelog (At the bottom of the release version)
  • I have squashed all my commits into one before merging

Further Comments

For now. I have implemented this optional feature for mysql. I want to get reviews on it. If this get approved then I will add this functionality for all databases.

@bilal-haider-cowlar
Copy link
Author

@ioolkos want reviews on this

@ioolkos
Copy link
Contributor

ioolkos commented Sep 20, 2023

@bilal-haider-cowlar Thanks for the effort. THB, I'm not yet sure what to do, as it introduces an option to lower security (but only for MySQL). Also note that if we deem this acceptable we should have the setting in the vmq_diversity schema file, and not have it read from the OS user env.

@mths1
Copy link
Contributor

mths1 commented Sep 22, 2023

I can see the need (acl based on "device class") without having to have an acl on each individual device. If we want to proceed with this pull request I'd suggest to make it even more flexible, as in just allow a null in the db and do an auth like (pseudo sql)

select top 1 ... where ... and ((client_id := client_id) or (client_id is null)) order by client_id nulls last

other options would include auth based on device classes (which would be an additional concept) or allow some sort of regex...

@Climax777
Copy link

This is also an issue for me using the MongoDB method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants