Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFacO-0002m9-Om for pgsql-general@arkaria.postgresql.org; Wed, 11 Jan 2023 12:54:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFacN-00051D-Ii for pgsql-general@arkaria.postgresql.org; Wed, 11 Jan 2023 12:54:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFacN-000514-5B for pgsql-general@lists.postgresql.org; Wed, 11 Jan 2023 12:54:11 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFacH-00056I-MN for pgsql-general@lists.postgresql.org; Wed, 11 Jan 2023 12:54:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=MjGfENzpBDhro7tRxxZzW/W++JP9SdE9xVLCmw3B2Ew=; b=JqwD1KELth0YAUaHMPA9gnDS+A +d2GnQ34AuZA2n2vo5mXRhAtQfMZwnDNcLNUvNWc5WNarE49clAkL3vtgUiIUgi5bvCez1s638mIA STSiTHTqwAiQ9DJI+T5p/5Txdhi/p4yOthHRFwWBtW7W8W3DH4KJezXkJPBkJapSrWck=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1pFacF-0045YH-MM; Wed, 11 Jan 2023 13:54:03 +0100 Date: Wed, 11 Jan 2023 13:54:03 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Wiwwo Staff Cc: pgsql-general@lists.postgresql.org Subject: Re: Disallow execution of shell commands from psql Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jan 10, 2023 at 07:01:24PM +0100, Wiwwo Staff wrote: > Hi! > Happy new (gregorian calendar) year! > > Somehow related to the proposal of having a `psql --idle` option, is there > a way to disallow the command `\!` (and anything of the likes in psql? > > Sure, I can set the SHELL env var at run-time, but I still want to have > postgres user to be a normal user, with its shell etc, which means it can > change this SHELL setting somewhere. As far as I know, it's not possible. Why is that a problem though? \! will run command as the user that ran psql. So it's not a security issue. What's the problem then? Best regards, depesz