Re: dblink connection security

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Joe Conway" <mail(at)joeconway(dot)com>, "Stephen Frost" <sfrost(at)snowman(dot)net>, "Magnus Hagander" <magnus(at)hagander(dot)net>, "Robert Treat" <xzilla(at)users(dot)sourceforge(dot)net>, "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: dblink connection security
Date: 2007-07-01 22:13:18
Message-ID: 18042.1183327998@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> I think there are two problems with this:

> a) dblink still shouldn't allow arbitrary users to open arbitrary tcp/ip
> sockets or unix sockets from the server. That's still a security threat
> even if we close Postgres's vulnerability to it.

The only way we could enforce that would be to completely disallow
non-superuser use of dblink; ie, "if (!superuser()) elog(ERROR)",
nothing so weak as revoking public execute access. That's a good deal
further than I'm prepared to go, as it really does take away
functionality. And it does it in order to close someone else's security
problem, so I think it's a pretty bad tradeoff.

> b) For a situation like a homebrew replication system someone may want
> to have set up a second server which allows passwordless access
> from the first server. In which case it is entirely sane (though it
> doesn't seem to be the best idea imho) to use ident and requiring a
> password is removing functionality that has a perfectly legitimate
> use.

Neither of the proposed fixes prevent that; you can either grant execute
access to appropriate people in the original suggestion, or wrap
dblink_connect in a SECURITY DEFINER function in my new suggestion.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-07-02 01:45:44 Re: SPI-header-files safe for C++-compiler
Previous Message Joe Conway 2007-07-01 21:59:50 Re: dblink connection security