Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7M4EUP13663 for ; Wed, 22 Aug 2001 00:14:30 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f7M4EHY13996; Wed, 22 Aug 2001 00:14:17 -0400 (EDT) To: "C. Bensend" cc: pgsql-admin@postgresql.org Subject: Re: Restricting user -> database access. In-reply-to: References: Comments: In-reply-to "C. Bensend" message dated "Tue, 21 Aug 2001 22:55:05 -0500" Date: Wed, 22 Aug 2001 00:14:17 -0400 Message-ID: <13993.998453657@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/98 X-Sequence-Number: 2034 "C. Bensend" 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