Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRHD5-0003xM-Fs for pgsql-admin@arkaria.postgresql.org; Tue, 19 Dec 2017 12:41:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRHD4-0001lG-Gh for pgsql-admin@arkaria.postgresql.org; Tue, 19 Dec 2017 12:41:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eRHD4-0001l5-9f for pgsql-admin@lists.postgresql.org; Tue, 19 Dec 2017 12:41:26 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eRHD0-00041f-4Q for pgsql-admin@postgresql.org; Tue, 19 Dec 2017 12:41:25 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id DF94046FC6; Tue, 19 Dec 2017 13:41:19 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id BzetrJNxG9Mv; Tue, 19 Dec 2017 13:41:19 +0100 (CET) Message-ID: <1513687278.2428.7.camel@cybertec.at> Subject: Re: Background worker process From: Laurenz Albe To: "Brandl, Wolfgang" , "pgsql-admin@postgresql.org" Date: Tue, 19 Dec 2017 13:41:18 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Wolfgang Brandl wrote: > We want to start processes controlled by a prostgres table which acts like crontab. > So we want to start a background worker process which starts the defined functions. > > Is it possible to start from a background worker process a child process with a specific User. > So this process can only acces the data for his authority. > Like a SQL Intrusion with this definition nobody can start a process a Postgres superuser. You normally do things like that on UNIX-like operating systems by setting the "setuid" bit on the executable that you want to start and transferring ownership to the desired user. There is no other way for a non-root user like "postgres" to start an executable as a different user. Your setup seems complicated. Why don't you have a daemon process running as root outside of PostgreSQL that regularly checks the table and starts scheduled processes? Yours, Laurenz Albe