DASSL / ClassDB

An open-source system to let students experiment with relational data
https://dassl.github.io/ClassDB/
Other
8 stars 2 forks source link

classdb.killUserConnections will not work unless prepareClassDB is run as a superuser (W) #53

Closed wildtayne closed 7 years ago

wildtayne commented 7 years ago

Currently, classdb.killUserConnections requires that its definer have permission to kill any user's connections. If prepareClassDB.sql is not run as superuser, then classdb.killUserConnections will only be able to target connections belonging to its defining user.

Postgres provides a facility to fix this problem. There is a predefined role pg_signal_backend, which allows a granted user to kill connections from any non-superusers. I propose that we grant this to the ClassDB role.

One requirement for this fix is that the user running prepareClassDB.sql must have ADMIN rights on pg_signal_backend. It seems common for non-superuser 'admin' accounts, for example the ones for AWS and Bluemix, to have ADMIN rights on pg_signal_backend to other users. We will definitely want to document this requirement.

wildtayne commented 7 years ago

I added a GRANT of pg_signal_backend to ClassDB in adf665613711a6c2e2d4645ab7adbe549aabc4a0. Right now, it does not check if the running use is able to grant pg_signal_backend, however.

wildtayne commented 7 years ago

Since we are assuming that the script will be run as a superuser for M1, the user permission check does not need to be implemented, since superuser can grant pg_signal_backend. So, this is effectively fixed by adf6656.