Database Automatic User Provisioning support for self-hosted MongoDB#33717
Database Automatic User Provisioning support for self-hosted MongoDB#33717
Conversation
4d1c9c8 to
914369e
Compare
399a50e to
95217ed
Compare
cc48523 to
398a930
Compare
8b83049 to
672aed7
Compare
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
smallinsky
left a comment
There was a problem hiding this comment.
Great job. Tested on my local setup without any issue. LGTM
| databaseName string | ||
| databaseURI string | ||
| adminUser string |
There was a problem hiding this comment.
Probably there is a corner case during CA rotation where a shared client should be reused but a connection needs to be recreated but this should be really narrow case.
There was a problem hiding this comment.
Good catch. During a rotation, the server should be restarted with a new configuration so the connection will be dead. The connection could be killed for other reasons as well.
Let me try to add a check on whether the shared client is dead after getting it from the cache. If so, just make a non-shared client.
There was a problem hiding this comment.
Seems the mongo client connection pool has the ability to reconnect even if i restarted mongo docker. So I will not handle that case.
As for the CA rotation case, users should understand that the connection may have issues during rotation. And it should self-heal after cache expires (one minute). I will leave a comment in the code for this case but not worth it to fix properly.
gabrielcorado
left a comment
There was a problem hiding this comment.
I've also tested with my local setup and everything worked as expected. Nice work.
eca68d2 to
492b307
Compare
…33717) * Database Automatic User Provisioning support for self-hosted MongoDB * Use user's customData instead of teleport-auto-user role * cache admin connections * add UT in db/mongodb * add UT in db/autousers_test * check version for showCustomData * remove command comment to compat with older versions * address comments round 1 * update new license * ensure shared client is diabled during CI
…ngoDB (#35317) * Database Automatic User Provisioning support for self-hosted MongoDB (#33717) * Database Automatic User Provisioning support for self-hosted MongoDB * Use user's customData instead of teleport-auto-user role * cache admin connections * add UT in db/mongodb * add UT in db/autousers_test * check version for showCustomData * remove command comment to compat with older versions * address comments round 1 * update new license * ensure shared client is diabled during CI * replace license * fix ut
Part of #27323
changelog: Database Automatic User Provisioning support for self-hosted MongoDB
Implemented as RFD: #33750
Testing:
Manual testing example
1. Configure self-hosted MongoDB
Setup a self-hosted MongoDB. Sample docker setup
https://github.com/greedy52/teleport-database-test-setup/tree/main/mongo
Log into the database as the default admin, for ex:
Create the role for
teleport-admin:Create
teleport-adminuser:Create a custom role for testing:
2. Configure Teleport
Create a Teleport role for auto-user and assign it to your Teleport user, ex:
Assign the role to your User.
Create a database:
3. Connect
tsh logintsh db connect --db-user <teleport-user> --db-name test self-hosted-mongo-autoThe change is ready but waiting for #34132 to merge before open for review.
Also need #34271 to show proper error messages when setup is bad.