Skip site navigation (1) Skip section navigation (2)

Re: hacker help: PHP-4.2.3 patch to allow restriction of database access

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Mercer <jim(at)reptiles(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org,Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Subject: Re: hacker help: PHP-4.2.3 patch to allow restriction of database access
Date: 2002-09-27 03:42:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Jim Mercer <jim(at)reptiles(dot)org> writes:
> as best i can understand, there is no way to get apach/php/pgsql configured
> (using "PostgreSQL's native access mappings") that would disallow php code
> in one virtual host from connecting to any database on the system.

Betraying my ignorance of PHP here: what does a server supporting
multiple virtual hosts look like from the database's end?  Can we
tell the difference at all between connections initiated on behalf
of one virtual host from those initiated on behalf of another?

If we can tell 'em apart (for instance, if they differ in apparent
client IP address) then it'd make sense to put enforcement on the
database side.  If we can't tell 'em apart, then we need some help
from the PHP interface code so that we can tell 'em apart.

Proceeding on the assumption that we do need some help ...

> this patch adds the config variable pgsql.allowed_dblist
> by default it has no value, meaning all databases are accessible
> it can contain a colon delimited list of databases that are accessible.

Seems like this hard-wires a rather narrow view of what sorts of
protection restrictions you need.  Might I suggest instead that
an appropriate config variable would be a list of Postgres user ids
that the virtual host is allowed to connect as?  Then the database's
usual protection mechanisms could be used to allow/disallow connection
to particular databases, if that's what you want.  But this does more:
it lets different virtual hosts connect to the same database as
different users, and then access within that DB can be controlled using
the regular Postgres access-control mechanisms.

Essentially, the idea here is to ensure that the DB can tell virtual
hosts apart as different users.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2002-09-27 03:47:08
Subject: Re: Cascaded Column Drop
Previous:From: Tom LaneDate: 2002-09-27 03:07:44
Subject: Re: [HACKERS] Performance while loading data and indexing

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group