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 1nqzat-0004hH-52 for pgsql-general@arkaria.postgresql.org; Tue, 17 May 2022 15:58:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nqzar-0001ED-QA for pgsql-general@arkaria.postgresql.org; Tue, 17 May 2022 15:58:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqzaq-0001E4-7g for pgsql-general@lists.postgresql.org; Tue, 17 May 2022 15:58:41 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nqzai-0003NC-Vr for pgsql-general@lists.postgresql.org; Tue, 17 May 2022 15:58:39 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B93AB3200657; Tue, 17 May 2022 11:58:30 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 17 May 2022 11:58:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1652803110; x= 1652889510; bh=nOoteV7TVuR0Da03Ggk/JrEIe1CVmbxE703eeEdYIrk=; b=R aTBiwPeLKtAlzkFHsW3YxLpwUeN9bPNYfIjGjmX1HnU/++zuzEq7aD0t/gvuvUN3 xIi8vY84PScxvBbINYogRjwE9poGoMIQXC+l8wa0+UmnBeUJpQtOCEgZXkOekUy4 qWRyfXI9AC22T8f9TK0Tx/oHTWMwyA7U5K1fcQ9Vu81c+oGm1mPJ2Y7kPnJ0cp2J unQL9743wh0e5ShNO5Co6JKi3C6klN0BIsC8wwIYdXVsopy0uFRSnov1Ocmv7AWK v0mz9E5Kw0O3kVMOgX3IdNS9H+Z/JNk55HIQNsLK1ns77d33be6hQGiTODWvvHPp dliq2mek4lowE0DGf0DwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1652803110; x= 1652889510; bh=nOoteV7TVuR0Da03Ggk/JrEIe1CVmbxE703eeEdYIrk=; b=E BU5oQJVvRb/6gDykHCLaviI0FzOQql68rLOZDMqVN3Szll1Ho9Pmx18i6zMi17GA opesslWr6gg82gCVFrdRNt72RMniwngS7ooQZjLJC7NNijYzMTeJqZyDJtpAOQLp 9PsfSc1Q6kySB5Jhn/p+WfCvUB9FgUiZDT4/3LaplsMP/QdQ8zog8jM1Ac4z0VBK qQrDZ6Bt49kwIi7KwKrCn46u3hM8CJpgJPcStEQtIYuotg0zpAXyGcX5ZxdUfMHa 6V/2/MeaekJffg0+PnqNx1/XPr4/gn9+PMny0gDVEmhvsXQfaZytcHyRkizEG4Ea bTOooazVXcZDuuiYxgPAA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrheejgdelvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpefhgeevkeefleffvdfgvdefffdtueejheehueeifffh feeihfdvhffgtefgvdeugfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 May 2022 11:58:29 -0400 (EDT) Message-ID: Date: Tue, 17 May 2022 08:58:28 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: Restricting user to see schema structure Content-Language: en-US To: Bryn Llewellyn , "David G. Johnston" Cc: Neeraj M R , Tom Lane PostgreSQL , pgsql-general list References: <048ab2c5-ddf6-d039-3c2a-1828d8c9137b@aklaver.com> <569304.1652411286@sss.pgh.pa.us> <228E8A44-A504-4E0D-99BD-71B41812FFE2@yugabyte.com> <557fd2b6-dd2e-66ad-4920-25d173eaf10e@aklaver.com> <84B060E2-4393-4D49-AB4C-BAFCA94620F1@yugabyte.com> <766C91F2-6FF8-4D4B-94BB-39B3BAD2AFE8@yugabyte.com> From: Adrian Klaver In-Reply-To: <766C91F2-6FF8-4D4B-94BB-39B3BAD2AFE8@yugabyte.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 5/16/22 22:21, Bryn Llewellyn wrote: >> Because as mentioned previously you did not "revoke connect on >> database postgres from public". > > Right, I see the importance of this now. I now realize that when a > database is created, CONNECT on it is automatically granted to PUBLIC. > But there's no mention of this (or what to read to learn that this is > the case) in the "pg_hba.conf" chapter. Nor does the section on the > CREATE DATABASE statement mention this. How is the neophyte supposed to > know about this behavior? CREATE DATABASE is an object creation command and what you are concerned with is not that but the privileges associated with the object. As David pointed out that is spelled out in the section on privileges. To me it makes sense to aggregate privilege information rather then have to walk through all the object creation sections. > > Another thing that confused me was the significance of the lines for the > database "replication" in the "pg_hba.conf" that came with my > installation. Add to this the mutually exclusive keywords "REPLICATION" > and "NO REPLICATION" in the CREATE ROLE statement. ("These clauses > determine whether a role is a replication role.") So this seems to be a > distinct use of the word from how it's used in "pg_hba.conf" as the name > of a database (that might well not exist). Strangely, the CREATE ROLE > doc says that you don't need either of "REPLICATION" or "NO REPLICATION" > but it doesn't say what the default is. From here: https://www.postgresql.org/docs/current/auth-pg-hba-conf.html "The value replication specifies that the record matches if a physical replication connection is requested, however, it doesn't match with logical replication connections. Note that physical replication connections do not specify any particular database whereas logical replication connections do specify it." Makes sense to me, it is a 'dummy' value for binary replication connections as they do not actually connect to a database but to a cluster. As to CREATE ROLE: https://www.postgresql.org/docs/current/sql-createrole.html REPLICATION NOREPLICATION " These clauses determine whether a role is a replication role. A role must have this attribute (or be a superuser) in order to be able to connect to the server in replication mode (physical or logical replication) and in order to be able to create or drop replication slots. A role having the REPLICATION attribute is a very highly privileged role, and should only be used on roles actually used for replication. If not specified, NOREPLICATION is the default. You must be a superuser to create a new role having the REPLICATION attribute. " So the default of NOREPLICATION is mentioned. replication(pg_hba.conf 'dummy' value) and REPLICATION/NOREPLICATION roles are referring to different aspects of the same process. Honestly I'm not seeing how this is any different from database postgres and role postgres. -- Adrian Klaver adrian.klaver@aklaver.com