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 1ow7fK-0004Pk-UD for pgsql-general@arkaria.postgresql.org; Fri, 18 Nov 2022 20:08:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ow7fJ-0006PJ-3R for pgsql-general@arkaria.postgresql.org; Fri, 18 Nov 2022 20:08:45 +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 1ow7fI-0006P9-Mc for pgsql-general@lists.postgresql.org; Fri, 18 Nov 2022 20:08:44 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ow7fD-0005jz-Eq for pgsql-general@lists.postgresql.org; Fri, 18 Nov 2022 20:08:43 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id CA466826B; Fri, 18 Nov 2022 21:08:35 +0100 (CET) Date: Fri, 18 Nov 2022 21:08:35 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Seeking practice recommendation: is there ever a use case to have two or more superusers? Message-ID: <20221118200835.sgva7b6wgg4w7py7@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <290EF7B8-D150-4AE1-8FFE-A38912CD1A8B@yugabyte.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wletlz5ot6f4iqld" Content-Disposition: inline In-Reply-To: <290EF7B8-D150-4AE1-8FFE-A38912CD1A8B@yugabyte.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wletlz5ot6f4iqld Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2022-11-17 11:36:15 -0800, Bryn Llewellyn wrote: > The detail below leads to a simply stated question: >=20 > Given that the bootstrap superuser must exist, is there ever a reason to = create > another role with "superuser"? >=20 > My intuition tells me that the answer is a resounding "No!". Is there ever a reason? Yes. Does that reason apply to you? I don't know. Maybe, maybe not. > =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2= =80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80= =94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 = =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2=80=94 =E2= =80=94=20 > I wondered, at first, if it might be a good practice to create a > second superuser, say "super" with "login", to alter the bootstrap > superuser with "nologin", and then to use "super" on an "ordinary" > daily basis for tasks that might need this. The thought was that this > practice might protect the artifacts that the bootstrap superuser owns > from damage. But this thought dissolved into thin air, before it was > fully formed, on the realization that the unstoppable "super" could > anyway do arbitrary damage to the bootstrap superuser's artifacts. You could create additional superusers and restrict those to certain databases and/or IP ranges. That probably won't stop an attacker (I can think of at least one way to get around that and it's probably even easier than I think) but it might prevent accidental damage. > The implication is clear: you should allow a cluster to have just a single > superuser, the inevitable bootstrap superuser, and you should think very > carefully indeed before ever starting a session as this role because of t= he > risks that doing so brings. Rather, you should realize that there are har= dly > any tasks that cannot be carried out by an appropriately configured role = with > "nosuperuser". One important task that can AFAIK only be performed by superusers is the creation of functions in untrusted languages like plpython3u and plperlu. If your application uses functions in those languages you need a superuser to install or upgrade it. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --wletlz5ot6f4iqld Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmN35j4ACgkQ8g5IURL+ KF3fXA//UU31xtM1AKEsMmMDL8XVojwnePvr1MRuA9jW/KXJXbt2nPbtLSQ6T51V BZTgo1RtX/WXO6cQ8KgfsQ7vdg6I/Uv9q0c3l8JxWOQLwGczcmY/q7JTEJeTxuo3 /ORcyQJuWD+972/r95su7SbhQ1Apm/eeUSyh3ecYNnpS5/n+w9WNpbXsO/qXuhw0 OjJZEsLJhP7x5d/0ya6xZbPM2//7uOSVs0IHdS5GIb28Jas7vwayOgKe6xqi/w1y IEYSuWqWDVEjjB/Jeq+wLXGdeg1C+5sFWMaH7bxm2n3pLhuj8Y/YLvosGfaaobjY xtY9tgLilVPvxTmblDBvuPmOvPo/O3krfWbXMvFixWG1/u31uRV9D4NuXe8ayWxK jQjgjuIfKdVG+V0Qu6Dp6B961Y5nHH5j14snyS8ih5A/fniykNS0LtL66odHA7wp VDiyrlClt/Ivo8DGVv7JuRS9uAm/QgM8QzZwCBDKhbHwdqYhyY1WB2nEub4MPYK0 aIOI3isrxDySkIRERoQju97/7meczinrwO/1zWIz+k7s5iJaXHL4z6YDxAk9nfqN FPYzm4jOMFvxBpMdFT2R09LXN9bv8FkuIO2zSHqNS7B8rlWErenrSzPyv04kL9fG B+M0TvtOMBf+qGkmdnrRagn9XBQ3upeSyv7donITvtwoig2OZiE= =idN+ -----END PGP SIGNATURE----- --wletlz5ot6f4iqld--