agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Kellerer <shammat@gmx.net>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Pragma autonomous transactions in Postgres/ Certification based authentication in DB Links
Date: Fri, 17 Dec 2021 12:58:55 -0500
Message-ID: <1364139.1639763935@sss.pgh.pa.us> (raw)
In-Reply-To: <b1c37523-c7ec-1643-4958-e7c8f400e3a8@gmx.net>
References: <CAN0SRDEGsXnULFzB+X7FNzwO4iT27G=rDhe9GgvMnhsj98KKPw@mail.gmail.com>
	<A0E82030-D418-4596-A6E5-87016B0CCCE7@excoventures.com>
	<1355149.1639758450@sss.pgh.pa.us>
	<b1c37523-c7ec-1643-4958-e7c8f400e3a8@gmx.net>

Thomas Kellerer <shammat@gmx.net> writes:
> Tom Lane schrieb am 17.12.2021 um 17:27:
>> No, that won't help.  Like postgres_fdw, dblink will only let you use
>> non-password auth methods if you're superuser [1][2].  The problem is
>> that making use of any credentials stored in the server's filesystem
>> amounts to impersonating the OS user that's running the server.  It'd
>> be nice to find a less confining solution, but I'm not sure what one
>> would look like.

> What about using a .pgpass file?

Still amounts to impersonating the server (and yeah, we do prevent
that if you're not superuser).

It might make sense to have a superuser-owned SECURITY DEFINER
function that's responsible for creating the desired connection,
and could make use of the server's .pgpass credentials.  As long
as you restrict what that function is willing to do, and restrict
who can execute it, this'd probably be adequately secure.

			regards, tom lane





view thread (8+ messages)

Message-ID: <1364139.1639763935@sss.pgh.pa.us>
Permalink:  ../1364139.1639763935@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1364139.1639763935@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, shammat@gmx.net, pgsql-sql@lists.postgresql.org
  Subject: Re: Pragma autonomous transactions in Postgres/ Certification based authentication in DB Links
  In-Reply-To: <1364139.1639763935@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox