Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWgzg-00Glk7-Qo for pgsql-admin@arkaria.postgresql.org; Wed, 24 Jul 2024 18:45:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sWgzf-007dn4-Bh for pgsql-admin@arkaria.postgresql.org; Wed, 24 Jul 2024 18:45:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWgze-007dmt-HB for pgsql-admin@lists.postgresql.org; Wed, 24 Jul 2024 18:45:43 +0000 Received: from omta001.cacentral1.a.cloudfilter.net ([3.97.99.32]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sWgzb-001H06-Ua for pgsql-admin@lists.postgresql.org; Wed, 24 Jul 2024 18:45:41 +0000 Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTPS id WVipscJv5kYKFWgzasvazE; Wed, 24 Jul 2024 18:45:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=shaw.ca; s=s20231031; t=1721846738; bh=HUdH2qZcZtfWGdRzK1YWymPu2KQgxL0j1XkyJRiomCs=; h=Message-ID:Date:Subject:To:Cc:From; b=5a7Y86OThB4a9KN7CEJt5cvPl1nkl4xxPFjw2VrXB9L+cvg8jTqVdchEqHwYrgRqJ GUAy4ssZXW1SPn0qmnr6BC8Fo7dtnq4sAz4pe0SL4rI34eN/Ic/fXPH8/t5p5YY7zM i9DM7JK/SKweF0GhU7DQ8mlkjyTdPijoTOi4ckCsUWPz7/JnfEknL+48K+FUX21b80 nE7gd9KnWDHUEvq2lOyoEA3tzGHm2n5V/HhRHxLBCJAMc1PRxjGeocTY29g2o24pjv yjb9Q4hnWv6HwxtIdtsLcOrKcGbpx/RPPYaEA5/MuH1oykjEhbZVq7//2hb44WAhHv jvz8wXNxH/tlQ== Received: from [192.168.2.11] ([142.161.62.170]) by cmsmtp with ESMTPSA id WgzYsz6jV2M9qWgzZsspSv; Wed, 24 Jul 2024 18:45:38 +0000 Authentication-Results: ; auth=pass (PLAIN) smtp.auth=gweaver@shaw.ca X-Auth-User: gweaver X-Authority-Analysis: v=2.4 cv=ce5xrWDM c=1 sm=1 tr=0 ts=66a14bd2 a=ZMt2Fn/+eO0oV/ZMl6lE+Q==:117 a=ZMt2Fn/+eO0oV/ZMl6lE+Q==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=G4YRQ5B4mivdQUsl17QA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=mLhU8Pjo0_GGBegq-1MA:9 a=cVjw5BYuUTFp41Jz:21 a=_W_S_7VecoQA:10 a=GU0tDtCOKLaCbZBcCgMB:22 Content-Type: multipart/alternative; boundary="------------IOQv8BqSQf0tXbXMCKjX2br8" Message-ID: Date: Wed, 24 Jul 2024 13:45:36 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [EXTERNAL] Re: Detect who ran DROP schema Content-Language: en-US To: Alvaro Herrera References: <202407241722.yigc7p4tnajc@alvherre.pgsql> Cc: pgsql-admin@lists.postgresql.org From: George Weaver Organization: Cleartag Software, Inc. In-Reply-To: <202407241722.yigc7p4tnajc@alvherre.pgsql> X-CMAE-Envelope: MS4xfFzLQxbpCylSbdBsHKgKBIsx+Q6TZOGrKsPsqPm3th0JvTqp9lNMqT/flZonqaZ2UpAJHeovd+gI4fqNNpcEhAodm0u8VI/da62sDDFWBPbYXzZoDmKT jcOBdDj3/yy84ba3qToXAf75DfbhGUfF6HB0khW9qluIrOsDGl8OyfLcxKaCHPycuKMNRq/FXsrVWH2mBZY/QuT8vNfuhBog3cCEfP641wHHfsd15zSvCWnv M4kHPsdN3169H8dnmw8s8Q== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------IOQv8BqSQf0tXbXMCKjX2br8 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit >It's better to have one elevated user _without login privs_, to which people can SET ROLE when they require it. This sounds interesting, but I'm not sure how to do it. Would you mind sharing an example? Thanks, George On 24/07/2024 12:22 p.m., Alvaro Herrera wrote: > On 2024-Jul-24, Wetmore, Matthew (CTR) wrote: > >> This is a major issue in the DBA world as enterprise management lawyers get more popular. >> >> At a large company I was at, there was only one elevated user, (which several people had user/pass) and then our personal accounts cannot do much due to modern corporate governance. This is how it was set up. >> >> As the DBA I couldn’t even log into the linux box where postgres was installed. >> >> I couldn’t even change any logging without a two day ticket to do the work. >> >> Not specifically this issue, but this is more the norm now-a-days then not. > Yeah. This is an important if there are any potential attackers at all, > which given today's Internet, you can be pretty sure is always the case. > > A database where people are allowed to connect as superuser is a sure > way to get in trouble sooner rather than later. Having layered security > is one of the first things you should be thinking about. > > FWIW I think even that one elevated user to which several people have > user/pass is a bad idea; forensics would require to know who used the > password when. It's better to have one elevated user _without login privs_, > to which people can SET ROLE when they require it. This leaves a better > trail. > > If you add something like pgAudit to the mix and direct its logs (or all > Postgres logs) to a remote server where they can't easily be tampered > with by attackers, you'll have a better trail of who did what, when, > with what credentials. > -- 972 McMillan Avenue Winnipeg, MB R3M 0V7 (204) 284-9839 phone/cell --------------IOQv8BqSQf0tXbXMCKjX2br8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

>It's better to have one elevated user _without login privs_, to which people can SET ROLE when they require it.

This sounds interesting, but I'm not sure how to do it. Would you mind sharing an example?

Thanks,

George

On 24/07/2024 12:22 p.m., Alvaro Herrera wrote:
On 2024-Jul-24, Wetmore, Matthew  (CTR) wrote:

This is a major issue in the DBA world as enterprise management lawyers get more popular.

At a large company I was at, there was only one elevated user, (which several people had user/pass) and then our personal accounts cannot do much due to modern corporate governance.  This is how it was set up.

As the DBA I couldn’t even log into the linux box where postgres was installed.

I couldn’t even change any logging without a two day ticket to do the work.

Not specifically this issue, but this is more the norm now-a-days then not.
Yeah.  This is an important if there are any potential attackers at all,
which given today's Internet, you can be pretty sure is always the case.

A database where people are allowed to connect as superuser is a sure
way to get in trouble sooner rather than later.  Having layered security
is one of the first things you should be thinking about.

FWIW I think even that one elevated user to which several people have
user/pass is a bad idea; forensics would require to know who used the
password when.  It's better to have one elevated user _without login privs_,
to which people can SET ROLE when they require it.  This leaves a better
trail.

If you add something like pgAudit to the mix and direct its logs (or all
Postgres logs) to a remote server where they can't easily be tampered
with by attackers, you'll have a better trail of who did what, when,
with what credentials.

-- 
972 McMillan Avenue
Winnipeg, MB
R3M 0V7
(204) 284-9839 phone/cell
--------------IOQv8BqSQf0tXbXMCKjX2br8--