Re: Access restriction

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: GH <grasshacker(at)over-yonder(dot)net>
Cc: Jeff Davis <jdavis(at)wasabimg(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Access restriction
Date: 2000-11-29 15:50:00
Message-ID: 27427.975513000@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

GH <grasshacker(at)over-yonder(dot)net> writes:
>> I think you want "sameuser" in pg_hba.conf.

> Would you mind elaborating on that a bit for me?
> i.e. Where should it go in pg_hba.conf?
> I don't think I saw this in the docs...

It's right in pg_hba.conf:

# Format:
#
# host DBNAME IP_ADDRESS ADDRESS_MASK AUTHTYPE [AUTH_ARGUMENT]
#
# DBNAME is the name of a PostgreSQL database, or "all" to indicate all
# databases, or "sameuser" to restrict a user's access to a database with
# the same name as the user.

One thing this doesn't make too clear is that the "restriction" really
means that this record *matches* if the username and the database name
are the same. Else the postmaster moves on, looking for another
matching record. A possibly useful example:

localhost sameuser ident
localhost all passwd passfile

This would mean that a user would get let into his own database on
the basis of IDENT checking, and would get let into other databases
on the basis of password checking using passwords in $PGDATA/passfile.
Since you'd control the contents of this last file, this would allow
you to grant access to all databases to only selected users.
You want some sort of escape hatch like that, at least for the DBA ---
else he couldn't get into any database but his own, either. Superusers
aren't super as far as the postmaster is concerned... they have to pass
the authentication tests the same as mere mortals.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Kislo 2000-11-29 16:03:24 Unanswered questions about Postgre
Previous Message Bryan White 2000-11-29 15:11:26 Re: insertion times ..