pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: C. Bensend <benny@bennyvision.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Restricting user -> database access.
Date: Wed, 22 Aug 2001 00:14:17 -0400
Message-ID: <13993.998453657@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.BSO.4.33L2.0108212233390.51-100000@fusion.bennyvision.com>
References: <Pine.BSO.4.33L2.0108212233390.51-100000@fusion.bennyvision.com>

"C. Bensend" <benny@bennyvision.com> writes:
> local        all                                           crypt
> host         all         127.0.0.1     255.255.255.255     crypt

> hostssl      bobsdb    a.b.c.d   255.255.255.255   ident   sameuser

> In response to "you have additional pg_hba lines that you're
> not showing us", that's all I have.  Honestly.

The above lines say that anyone coming from the local machine (over
either a Unix socket or loopback IP) can get into any database if they
supply a valid Postgres userid and password.  Anyone coming from a.b.c.d
(I assume this is *not* your local machine) can get into only bobsdb,
and only if the Postgres userid they specify matches what ident reports
as their Unix userid.

Perhaps you want "sameuser" instead of "all" in the first two lines.

You're correct that psql's \c doesn't re-prompt for the password if the
one originally given is still accepted.  Offhand that does not strike me
as a security lapse.

> hostssl      balmer      a.b.c.d    255.255.255.255     ident  sameuser
> hostssl      ertz        a.b.c.d    255.255.255.255     ident  sameuser

> As user 'balmer' from the client machine, I can connect to
> the 'balmer' database.  Yay.  :)  And now, as balmer, I can
> "\c ertz" and connect to the ertz database.  Not so good.  :(

Sure enough, that's what the config file says is allowed.  Try
replacing these two lines with

hostssl      sameuser      a.b.c.d    255.255.255.255     ident  sameuser

which I think is closer to the behavior you are looking for.

			regards, tom lane



view thread (4+ messages)

Message-ID: <13993.998453657@sss.pgh.pa.us>
Permalink:  ../13993.998453657@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13993.998453657@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, benny@bennyvision.com
  Subject: Re: Restricting user -> database access.
  In-Reply-To: <13993.998453657@sss.pgh.pa.us>
  References: <Pine.BSO.4.33L2.0108212233390.51-100000@fusion.bennyvision.com> <13993.998453657@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox