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 1osdUz-0003ts-2i for pgsql-general@arkaria.postgresql.org; Wed, 09 Nov 2022 05:19:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1osdUx-00046H-Mp for pgsql-general@arkaria.postgresql.org; Wed, 09 Nov 2022 05:19:39 +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 1osdUx-000462-Bo for pgsql-general@lists.postgresql.org; Wed, 09 Nov 2022 05:19:39 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1osdUq-0003lz-G1 for pgsql-general@lists.postgresql.org; Wed, 09 Nov 2022 05:19:38 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 825B05C0101; Wed, 9 Nov 2022 00:19:30 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Wed, 09 Nov 2022 00:19:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc: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=fm1; t=1667971170; x=1668057570; bh=v/esOLFUl3 8cwHVsl3B3SEG+2rz60tEbauJO4hE6RQU=; b=sGDKR8Fy7hZNHRwax+PSoN2o5U OW0X11cgfAKn7Hem9F4NCok4NDVEIwXsWLyvqNr0axQoTuHGfnlOqmF1LawtYtm1 HFcOUiSBGePzOqaY3Z8N4l1YJstmHGDOfy529q/eds/8CO/jDdctRP0Bb94Zgx25 6KPI11jZ/yodaqK8Lzg97CEC07S5cqjNigoojEsG+JNH27CjDQkPpQzt3itCC0jX RmEwTIOsljRGZA+MEZLmRdVK2K7u6j9g1cviDVeEv4kvLZewPlrvGzOVzYOsdmAn tUloGBoCk5tObIvsIkqqJIfkwNXmebM/lcErl5DBjLEx/KrWNmORvTQAO4nA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc: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=1667971170; x=1668057570; bh=v/esOLFUl38cwHVsl3B3SEG+2rz6 0tEbauJO4hE6RQU=; b=hwV3ji6VEUz5BxPXQIHsXJ0Ol7M3tylD4YAJM7vKuC3V 5q6xlM8iu+Bl3SnmeNEPPqYpr9QYnsptFiMy34Fv2tbq/nRkeqTRpdGEsaMOzwNl /5D/gjTlZcHVprkupOopXLO+oMqKkjpufChdoTbkabp3tUlk504FFO3cDVtnM5wG dU5EjNdrJS41NCo8sPhkPG54gzSyIyGc5qUkjam97DiZEs8eA+DNtIymuU8TnxF1 4a0LCYlUkdTLznHTWXhtk9FANq9Oh2YwcjET2tmBME8a7bivoaG+SMNoR0D3Sj1m HKtzDGap1hFSFLmc2bSDGwQkFORj3MdgNRDbMnr7yQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrfedugdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdefhedmnecujfgurhepfffhvf evuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpeejieegheevjedvgeektdegveejueegheeljeeggeffvdfhjeefffeigfejjedvfeen ucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdr giihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Nov 2022 00:19:29 -0500 (EST) Date: Wed, 9 Nov 2022 14:19:26 +0900 From: Michael Paquier To: Albrecht =?iso-8859-1?Q?Dre=DF?= Cc: pgsql-general@lists.postgresql.org Subject: Re: Q: pg_hba.conf separate database names file format Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jEOmsrcVtX1BUL7Y" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jEOmsrcVtX1BUL7Y Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 08, 2022 at 02:16:03PM +0100, Albrecht Dre=C3=9F wrote: > However, I could not find a specification of the format for this > file=E2=80=A6 It appears as if simply giving each database name on a > separate line does the job. Is this correct? May the file contain > comments (i.e. lines starting with =E2=80=9C#=E2=80=9D) or empty lines? = May the > file be specified including a path (e.g. =E2=80=9C@/some/path/databases= =E2=80=9D)? I have been playing with this code for the last couple of days, and the answer is that you can use an absolute path or a relative path. In the case of a relative path, the code considers the base directory as the parent directory of the file this is included in. For example, /data/pg/pg_hba.conf including a @databases.conf resolves as /data/pg/databases.conf, and a @conf/databases.conf resolves as /data/pg/conf/databases.conf. The parsing of these files uses the same rules as what's done for pg_hba.conf and pg_ident.conf, so you can specify a list of user names separated by commas or even spaces, or put one name per line. Comments beginning with '#' are ignored. If you want to play with your file and see the results, I would recommend to tweak the files, and then look at the contents generated in the system view pg_hba_file_rules. Querying pg_hba_file_rules loads directly the configuration files from disk, so there is no need to reload or restart the server to see the effects any modifications would have. The documentation has already some descriptions, that you've missed, perhaps: https://www.postgresql.org/docs/15/auth-pg-hba-conf.html "Files included by @ constructs are read as lists of names, which can be separated by either whitespace or commas. Comments are introduced by #, just as in pg_hba.conf, and nested @ constructs are allowed. Unless the file name following @ is an absolute path, it is taken to be relative to the directory containing the referencing file." -- Michael --jEOmsrcVtX1BUL7Y Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmNrOF4ACgkQnvQgOdby QH0Bvw//UI9jE73psQl1S5oVHWv8QhcXFkvQ62FfCR3rZh1IxJuY5W4PlkG1C2aP +ayClxiME1J3WhXVv1rxm6DZIs6bgaqkPDFnlfbJZnK11WdDfO/mSKVTUvW8kzy+ MkPjK5KVqMGZpf+TXEbVs8VRPOl3ZrDzZuQL2clbN9ZmaSOsqsAevPsv3XYewBCV 4/4OPio9u9Oyu8S1O9a94anAA/nv7UZzI2kwLJKn35WDtalrNg5gSVaSMvmmwVPI Hl0yDe8VgasbFdVFgxxjy929EHcKgPaWE5CYpTlReoHYYYc+7/SPhVUcRAUWurmW TYZW3g9ihTquSmzYBg9whxz+k37JQSFHUVbcSw48fm5glylvwmApEnoSte0+F8oL Cb/jU0tRzl1eEhUisI1jnsOTg33TmqAk1X7RdkdvdJXOOsWkNTmXywycFkSHyHbO sokkHkx9Tfu9K57VSJZEeLlfGmT63/WPwBHUKghkb2VOMDEG1qGK/pAtnV6IE3a8 Vb0FOx2quvXs+t0bMjxmmAgwHixB02i79W9FNYUw8n/nmyp2eysSCqFvg+/T2fue g44wLHxGCCXTvV0fgI0kYWoNriUvuuaptyJMZRJbDatrfGStWGwwIv6LsCP/Ezae 3Kx/eIhTlBNvWT520pwPRPs9pY1FVUO3M4yL/6Xmyy9MWNEEtpQ= =qrGZ -----END PGP SIGNATURE----- --jEOmsrcVtX1BUL7Y--