pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric McKeown <ericm@palaver.net>
To: D'Arcy J.M. Cain <darcy@druid.net>
Cc: PGsql <pgsql-sql@postgreSQL.org>
Subject: Re: [SQL] connecting with password
Date: Fri, 11 Sep 1998 13:12:05 -0500 (EST)
Message-ID: <Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net> (raw)
In-Reply-To: <m0zHJcB-00006FC@druid.net>

On Thu, 10 Sep 1998, D'Arcy J.M. Cain wrote:

> Date: Thu, 10 Sep 1998 23:11:15 -0400 (EDT)
> From: "D'Arcy J.M. Cain" <darcy@druid.net>
> To: Eric McKeown <ericm@palaver.net>
> Cc: PGsql <pgsql-sql@postgreSQL.org>
> Subject: Re: [SQL] connecting with password
> 
> Thus spake Eric McKeown
> > Is there any way to set up special password protections for a Postgres
> > database, so that I can force someone to present a username and password
> > when connecting from a PHP script?  I've combed the docs for something on
> > this, and I may just be completely off base on the feasibility.
> 
> What I do is run the page as the database owner (I run a separate Apache
> on a different port) and use the Apacher server password protections.
> Just remember to check who the remote user is every time you do any
> operation where the specific user is important.  If you just need to
> make a general restriction on a database for a group then the protection
> in the config files (or .htaccess) should be fine.

I have no problems restricting access to pages where important db-related
things happen.  I simply protect these pages using HTTP or PHP
authentication, and for now, that suffices to protect those pages that
perform db-sensitive operations from the "Bad Guys".

However, what I'm trying to do is this:  I want to prevent users on my
system from writing PHP scripts on our local system that can connect to
any db and wipe out all the records in that database.  Under the current
scheme, with PHP/Apache connecting to Postgres as nobody and nobody having
permissions on the tables in my database, anybody on the system could
write and install a script that would blow nobody-accessible database out
of the water.

So, on the PHP mailing list, I had seen it was possible to specify a
username and password when connecting to Postgres from Apache/PHP, and I'm
trying to figure out how to give users in my database passwords so that I
can quit giving nobody permissions on my dbs and start using passwords
instead.  Does that make any sense?  If I chown the db-connection files to
the uid of the web server and then make those files readable only by the
web server uid, then that will give me a much higher level of security.

Does that make any sense??  Does anyone know whether it's possible to set
up new users in Postgres databases and give them passwords for protection
purposes??

TIA for all input on this problem...

eric

> 
> How you do this in PHP is up to you.  I do it all in Python.
> 
> -- 
> D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
> 

_______________________
Eric McKeown
ericm@palaver.net
http://www.palaver.net




view thread (4+ messages)

Message-ID: <Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net>
Permalink:  ../Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net/
Also on:    postgresql.org/message-id/Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net

 · 

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-sql@postgresql.org
  Cc: ericm@palaver.net, darcy@druid.net
  Subject: Re: [SQL] connecting with password
  In-Reply-To: <Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net>
  References: <m0zHJcB-00006FC@druid.net> <Pine.LNX.3.96.980911130613.8051B-100000@farout.palaver.net>

* 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