Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iz6R2-0007jL-D0 for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2020 22:12:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iz6R0-0007J7-Vz for pgsql-general@arkaria.postgresql.org; Tue, 04 Feb 2020 22:12:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iz6R0-0007J0-Io for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2020 22:12:42 +0000 Received: from ook.raf.org ([139.99.156.21]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iz6Qt-00010v-Ig for pgsql-general@lists.postgresql.org; Tue, 04 Feb 2020 22:12:41 +0000 Received: from localhost (localhost [127.0.0.1]) by ook.raf.org (Postfix) with ESMTP id E05F45DE7A for ; Wed, 5 Feb 2020 09:12:31 +1100 (AEDT) X-Virus-Scanned: Debian amavisd-new at ook.raf.org Received: from ook.raf.org ([127.0.0.1]) by localhost (ook.raf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fxDki00_WrFh for ; Wed, 5 Feb 2020 09:12:31 +1100 (AEDT) Received: by ook.raf.org (Postfix, from userid 1001) id A32835E259; Wed, 5 Feb 2020 09:12:31 +1100 (AEDT) Date: Wed, 5 Feb 2020 09:12:31 +1100 From: raf To: pgsql-general@lists.postgresql.org Subject: Re: Restrict connection from pgadmin. Message-ID: <20200204221231.nipp2pnbu2lkzkmx@raf.org> References: <993e25c3-0389-3f32-2b0c-a3d250e09a10@aklaver.com> <16203.1580796426@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16203.1580796426@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Lane wrote: > Pawan Sharma writes: > > Yes I will show the pgadmin in stat_activity but how can block that.. > > I think I need to create a job to terminate the pgadmin connections and > > schedule it for every 5 min and so that I will check any new connections > > from pgadmin. > > I think onlookers are still completely mystified as to why you consider > this a useful activity. > > pgadmin is nothing but a GUI. Whatever can be done through it can be > done equally well through psql, or any other client software. So if > you're looking for security against unwanted SQL commands, you're going > about it the wrong way (better to look at preventing logins of privileged > accounts, and/or use of SQL permissions to limit what can be done). > If your objective is something else, you haven't explained what that is. > > regards, tom lane You could give normal/application users/roles very limited permissions (i.e. just the ability to execute pre-existing security-defining functions and nothing else), and have a database owner user/role with all the permissions to create those functions. That's my insane setup and I love it. Then use pg_hba.conf to limit which IP addresses the database owner user/role can log in from. You could also uninstall pg_admin. :-) Also, if you are worried about "doing a lot of damage in a minute", always script everything and test it first either in a transaction that will rollback or on a test server before executing it in production. I don't think a GUI is suitable for this. cheers, raf