pgsync icon indicating copy to clipboard operation
pgsync copied to clipboard

Check only required permissions

Open evstratbg opened this issue 3 years ago • 6 comments

Context:

Im using managed postgresql from Yandex.Cloud and they cannot provide me a superuser and userepl permissions because of security. Instead, they have separate roles (mdb_replication and mdb_admin), which can be used to do just what pgsync does.

I granted these roles to my user, forked, deleted checks of permissions and tested that. It worked

So, maybe permissions check function should validate if certain functions are available, not just superuser role? I guess, any provider wont give you full permissions

evstratbg avatar Aug 01 '22 08:08 evstratbg

Thats a good idea. Perhaps we can have something the user can define in a plugin.

toluaina avatar Aug 01 '22 15:08 toluaina

exactly. How can I help implementing that?

evstratbg avatar Aug 01 '22 18:08 evstratbg

I'll leave this open for now. I have not had time to implement this new feature yet due to other commitments. One way is to use a plugin as suggested. But it might be better to research how the cloud services consider a user that has permission to create and read replication slots. Vanilla Postgres has a documented method for that which is usesuper and userrepl

toluaina avatar Aug 25 '22 17:08 toluaina

are there setting specific to Yandex.Cloud in pg_settings? i.e SELECT * setting FROM pg_settings

For instance AWS has a rds.* entry for AWS Postgres

toluaina avatar Aug 26 '22 19:08 toluaina

I believe this is also an issue with Azure. are you able to provide me with a temp account to look into this?

toluaina avatar Sep 02 '22 17:09 toluaina

You no longer need to have super user permissions as this is restricted by most cloud service providers in one ways or the other.

You do however need to have permission to:

  • create/drop replication slots/
  • create/drop triggers on the target database.

@evstratbg

toluaina avatar Sep 05 '22 19:09 toluaina

closing as resolved

toluaina avatar Oct 18 '22 19:10 toluaina