Re: Re: Questions of the privileges to use the pg_cancel_backend and pg_terminate_backend function. Thanks.

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Re: Questions of the privileges to use the pg_cancel_backend and pg_terminate_backend function. Thanks.
Дата
Msg-id CAHyXU0zyPuFkkR-Br_VB+dBBg2xE8XUe0F0453Qg1PPp9L3B-A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Questions of the privileges to use the pg_cancel_backend and pg_terminate_backend function. Thanks.  (leaf_yxj <leaf_yxj@163.com>)
Список pgsql-general
On Wed, Apr 4, 2012 at 12:24 PM, leaf_yxj <leaf_yxj@163.com> wrote:
> Hi Aaron: thanks. I tried the security definer. it works well as follows :
>
> CREATE FUNCTION kill_process(integer) RETURNS boolean AS 'select
> pg_cancel_backend($1);' LANGUAGE SQL SECURITY DEFINER;
>
> ---- One more question about this function : if non-super user get the
> execute this function, he/her will have privilege to kill all the processes
> which belong to the postgresql process. How can we avoid that happing.

maybe, inside kill_process, do a quick check against pg_stat_activity
and bail if the process doesn't belong to a known usename?

merlin

В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: views, queries, and locks
Следующее
От: Eliot Gable
Дата:
Сообщение: Leaky Perl / DBIx / Postgres 9.0.1 Trio