Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 8A8F69C3462 for ; Tue, 20 Dec 2011 04:14:08 -0400 (AST) Received: from out2.mail.amis.hr ([188.129.0.5]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rcupq-0000qk-CV for pgsql-admin@postgresql.org; Tue, 20 Dec 2011 08:14:08 +0000 Received: from out.fsec.sm.srv.amis.hr (out.fsec.sm.srv.amis.hr [192.168.106.22]) by out2.mail.amis.hr (Postfix) with ESMTP id 82C041FA67 for ; Tue, 20 Dec 2011 09:13:53 +0100 (CET) Received: from pps.filterd (out [127.0.0.1]) by out.fsec.sm.srv.amis.hr (8.14.3/8.14.3) with SMTP id pBK8CJe4032336 for ; Tue, 20 Dec 2011 09:13:53 +0100 Received: from smtp.amis.hr (smtp.sm.srv.amis.hr [192.168.106.39]) by out.fsec.sm.srv.amis.hr with ESMTP id 11t5hag8nu-1 for ; Tue, 20 Dec 2011 09:13:53 +0100 A-Original-Client-UID: 188.129.64.3 splivalo Received: from [192.168.10.1] (cpe-188-129-64-3.dynamic.amis.hr [188.129.64.3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: splivalo) by smtp.amis.hr (Postfix) with ESMTPSA id 2DF533BA for ; Tue, 20 Dec 2011 09:13:53 +0100 (CET) Message-ID: <4EF043E1.4010808@megafon.hr> Date: Tue, 20 Dec 2011 09:14:25 +0100 From: Mario Splivalo User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Giving postgres roles 'sudo'-like access References: <4EEF7C9D.60006@megafon.hr> <4EEF869D.9060703@emolecules.com> In-Reply-To: <4EEF869D.9060703@emolecules.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.5.7110, 1.0.211, 0.0.0000 definitions=2011-12-20_02:2011-12-20, 2011-12-20, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=6.0.2-1012030000 definitions=main-1112200002 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201112/100 X-Sequence-Number: 38858 On 12/19/2011 07:46 PM, Craig James wrote: > Backend Postgres processes run as the Postgres user, so they have > permission to kill each other. You write an add-on function that just > kills a process: > > select my_kill_backend(pid); > > Naturally, this is very dangerous. There are all sorts of security > implications. You want to use signal 2 or 15, not 9. And so forth. That 'my_kill_backend' actually calls kill, not pg_cancel/terminate_backend? I'm thinking into creating this function, and granting particular role access to it, and then make sure, in the function, that it can kill only processes 'owned' by that role. Mario