pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wieck@debis.com
To: fomichev@null.ru
Cc: pgsql-sql@postgreSQL.org
Cc: pgsql-admin@postgreSQL.org
Subject: Re: [ADMIN] Apache authentication & PostgreSQL
Date: Fri, 11 Jun 1999 11:58:16 +0200 (MET DST)
Message-ID: <m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <Pine.LNX.4.04.9906111645240.9699-100000@ns.region.utsr>

Fomichev Mikhail wrote:

> Hi, all !
> I'm trying to show data from the PostgreSQL database to the Web page,
> using WWW-SQL. I want the users to get an access to the database from the
> browsers under their own names. To achieve this I configured Apache so
> that it would authenticate an user when the user enters the directory with
> CGI-scripts. I'd like that the name and the password of the user having
> been authenticated, will be used in CGI-script for the access to the
> database.
> I can get the user's name via environment variable $REMOTE_USER, wich is
> set by Apache.
>
> Now the question: is it possible to get the password, which the user has
> entered by the authentication ?
>
> I know one solution. But it requires hacking of Apache.

    Generally  it's  not such a bad idea to tell which version of
    Apache you're using.

    Anyway, if you have a 1.3.3, you must compile it with

        -D SECURITY_HOLE_PASS_AUTHORIZATION

    In  that  case,  Apache  will  set  an  environment  variable
    HTTP_AUTHORIZATON   whenever  it  sets  AUTH_TYPE.  That  is,
    whenever a cgi is accessed that is  protected  by  a  require
    directive so you need username/password to get it.

    The  variable  HTTP_AUTHORIZATION  contains the auth type and
    for "Basic" authentication "username:password" b64 encoded.

    As the define clearly states, it's a security hole.  If users
    are  allowed  to  use selfmade cgi's in their homepage, these
    can potentially steel passwords. And users might  also  steel
    passwords using 'ps -e'.

    Thus,  having  the username:password passed down into the cgi
    script is really only a last  resort.  In  general  your  CGI
    scripts  should use a pseudo user to contact the database. If
    someone can call a CGI script but  should  not  have  the  db
    access  permissions  required therein, something's wrong with
    the entire design - back to drawing board.  If  the  user  is
    already authenticated by Apache, why let PostgreSQL check the
    password again?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #





view thread (7+ messages)  latest in thread

Message-ID: <m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de

 · 

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: wieck@debis.com, fomichev@null.ru, pgsql-admin@postgreSQL.org
  Subject: Re: [ADMIN] Apache authentication & PostgreSQL
  In-Reply-To: <m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de>
  References: <Pine.LNX.4.04.9906111645240.9699-100000@ns.region.utsr> <m10sO4m-0003kGC@orion.SAPserv.Hamburg.dsh.de>

* 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