Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fmgNW-0005c5-FX for pgsql-admin@arkaria.postgresql.org; Mon, 06 Aug 2018 14:20:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fmgNU-0007hG-6s for pgsql-admin@arkaria.postgresql.org; Mon, 06 Aug 2018 14:20:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fmgGA-00076v-Gp; Mon, 06 Aug 2018 14:13:22 +0000 Received: from st14p37im-asmtp001.me.com ([17.41.209.30]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fmgG2-0003ex-Hr; Mon, 06 Aug 2018 14:13:21 +0000 Received: from process-dkim-sign-daemon.st14p37im-asmtp001.me.com by st14p37im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) id <0PD100J00M24BJ00@st14p37im-asmtp001.me.com>; Mon, 06 Aug 2018 14:13:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=04042017; t=1533564787; bh=JUQyv2TMDoNdjf/TE5CavbSF42QyYN0cjaE2XWyVu8k=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=celalun8nAJlw89QpY/Xk87jYgnHfkZtMAbNIxrKjhc1I4PmLfmV1Pvx6CnRGI+QY sVqlgRR31rj1E9j3H7boTLLKeQgfQY5TblM5F8NxTFJAAqHaSXO6ak6DmfhgptvuXv uLytrE+3g4qyWM0o4rjpMkclK3JZU+DigDmDAOXYYZhOaws2gYnID8H5MIeG/38JiA eY4AAQJ3Rqlq1xFMP/qAEZl6W4GyaG5bdOJ15yWw/UXdOoAt0oZ6j9QvlHk8DFqQQZ ZeCpbnvds7D1dg2k9AQbpZ+SNmRNgMXwiD4W7gdio/QPhnl5yDDQ3dpbThYTg2OjqG M0rkGdvz1+uPA== Received: from icloud.com ([127.0.0.1]) by st14p37im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPSA id <0PD1006DOM5RH020@st14p37im-asmtp001.me.com>; Mon, 06 Aug 2018 14:13:04 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-06_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1808060150 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: How to revoke privileged from PostgreSQL's superuser From: Evan Bauer In-reply-to: <26930.1533562986@sss.pgh.pa.us> Date: Mon, 06 Aug 2018 10:13:02 -0400 Cc: "pgsql-admin@lists.postgresql.org" , "pgsql-general@lists.postgresql.org" Content-transfer-encoding: quoted-printable Message-id: References: <913907.28546.qm@web103014.mail.kks.yahoo.co.jp> <26930.1533562986@sss.pgh.pa.us> To: bejita0409@yahoo.co.jp X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Bejita, I suggest you step back and think about the problem from the point of = view of the desired security outcome =E2=80=94 that of protecting data = from improper use by administrators. Some of the elements that (to my = mind) ought to be part of achieving that outcome are: 1. Determine and document your organizations data access policies. They = could be very simple, but it is important to document and share them. 2. Make use of a privileged access management scheme so that no one has = unfettered access to superuser (postgres, root, et al) passwords, but = has to check them out from an audited system for a specific task and = time period, with appropriate approval processes if needed. 3. Use pgaudit to maintain an independent record of all sensitive = access. The doc is at: = https://github.com/pgaudit/pgaudit/blob/master/README.md 4. Create a set of administrative roles privileged to only the needs of = the tasks required. Under normal circumstances, no one should use the = =E2=80=98postgres=E2=80=99 account for production access. This also = provides a means of enforcing compliance to your policies. Tom Vondra = wrote a good introduction here: = https://blog.2ndquadrant.com/auditing-users-and-roles-in-postgresql/ 5. Setup automated (I tend to use ELK or Splunk) examination of the = audit logs for violations and anomalies. Human review at regular = intervals will also make your regulators or security auditors happier = (they are never really happy.) 6. Make use of row-level access control and encryptions as appropriate = to protect your data. This blog post by Jonathan Katz is a good = introduction: = https://info.crunchydata.com/blog/a-postgresql-row-level-security-primer-c= reating-large-policies=20 There is a lot of thought and work that goes into executing the steps = above, but administering systems and databases that handle sensitive = data is a serious responsibility and requires requirements definition, = planning, architecture, execution, and then continuous monitoring and = improvement. As someone new to the DBA role, you should talk to your = architecture colleagues as you have some good and serious work ahead of = you. Cheers, - Evan > On Aug 6, 2018, at 09:43, Tom Lane wrote: >=20 > Bear Giles writes: >> In postgresql the equivalent user is 'postgres'. Nobody should ever = be >> logged in as that user once you've created the initial user(s). What >> postgresql calls a 'superuser' is just a user with a few permissions = set by >> default. It's easy to grant the same privileges to any user, or drop = them >> from someone created as a superuser. >=20 > Well, more to the point, a superuser is somebody with the rolsuper bit > set in their pg_authid entry. You can revoke the bootstrap = superuser's > superuserness if you have a mind to -- see ALTER USER. However, as > everyone has pointed out already, this is a bad idea and you will end > up undoing it. (Figuring out how to do that without a reinstall is = left > as penance for insisting on a bad idea. It is possible, and I think > even documented.) >=20 > However: a whole lot of what the bootstrap superuser can do is = inherent > in being the owner of all the built-in database objects, and that you > cannot get rid of. Objects have to be owned by somebody. >=20 > regards, tom lane >=20