pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Apache authentication & PostgreSQL
7+ messages / 6 participants
[nested] [flat]

* Apache authentication & PostgreSQL
@ 1999-06-11 04:02  Fomichev Michael <fomichev@null.ru>
  0 siblings, 4 replies; 7+ messages in thread

From: Fomichev Michael @ 1999-06-11 04:02 UTC (permalink / raw)
  To: pgsql-sql; +Cc: pgsql-admin@postgresql.org

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.

Thanks for any suggestions.

@------------------+-----------------------------------------------@
| Fomichev Mikhail | The Government of Kamchatka region.           |
| Vladimirovich    | The Labour and Social Development Department. |
|<fomichev@null.ru>|                                               |
@------------------+-----------------------------------------------@




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [SQL] Apache authentication & PostgreSQL
@ 1999-06-11 06:13  Remigiusz Sokolowski <rems@gdansk.sprint.pl>
  parent: Fomichev Michael <fomichev@null.ru>
  3 siblings, 0 replies; 7+ messages in thread

From: Remigiusz Sokolowski @ 1999-06-11 06:13 UTC (permalink / raw)
  To: Fomichev Michael <fomichev@null.ru>; +Cc: pgsql-sql; pgsql-admin@postgreSQL.org

> 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.
> 
> Thanks for any suggestions.

I'm not a good guy at programming, so my advice is rather simple
-try do it using php (You need compile it as Apache module with Postgres
support) - there is then very nice way to get user password and login.
If You do it this way I can give You some tips or examples of code in php
	Rem

-------------------------------------------------------------------*------------
Remigiusz Sokolowski      e-mail: rems@gdansk.sprint.pl           * *		
-----------------------------------------------------------------*****----------




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* RE: [SQL] Apache authentication & PostgreSQL
@ 1999-06-11 07:32  Volker Hess <Volker.Hess@avmz.uni-siegen.de>
  parent: Fomichev Michael <fomichev@null.ru>
  3 siblings, 0 replies; 7+ messages in thread

From: Volker Hess @ 1999-06-11 07:32 UTC (permalink / raw)
  To: Fomichev Michael <fomichev@null.ru>; +Cc: pgsql-admin@postgreSQL.org; pgsql-sql


On 11-Jun-99 Fomichev Michael 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.
> 
> Thanks for any suggestions.
> 
Perhaps try to use mod_perl with Apache::AuthenDBI and Apache::Authz ?!

Ciao...
--
E-Mail: Volker Hess <Volker.Hess@avmz.uni-siegen.de> 
Uni-GH Siegen . Medienzentrum
57068 Siegen
MZ:     http://www.avmz.uni-siegen.de/    - SINFO:     http:/www.uni-siegen.de/
MEDIAS: http://medias.avmz.uni-siegen.de/ - UNI-MEDIA: http://www.uni-media.de/




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [ADMIN] Apache authentication & PostgreSQL
@ 1999-06-11 09:53  Giuseppe Tanzilli <g.tanzilli@eurolink.it>
  parent: Fomichev Michael <fomichev@null.ru>
  3 siblings, 0 replies; 7+ messages in thread

From: Giuseppe Tanzilli @ 1999-06-11 09:53 UTC (permalink / raw)
  To: Fomichev Michael <fomichev@null.ru>; +Cc: pgsql-sql; pgsql-admin@postgreSQL.org

Hello,
try to use the apache/postgresql authentication module
ftp://ftp.eurolink.it/pub/linux/postgreSQL

bye

Fomichev Michael 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.
>
> Thanks for any suggestions.
>
> @------------------+-----------------------------------------------@
> | Fomichev Mikhail | The Government of Kamchatka region.           |
> | Vladimirovich    | The Labour and Social Development Department. |
> |<fomichev@null.ru>|                                               |
> @------------------+-----------------------------------------------@

--
-----------------------------------------------------------------
 Giuseppe Tanzilli               Flashnet S.p.A. Telecomunicazioni
 mailto: g.tanzilli@flashnet.it  Sede di Frosinone
 Eurolink S.r.l.                 mailto: info.frosinone@flashnet.it
 Tel: +39-0775-830012            http://www.flashnet.it
 Fax: +39-0775-201321            EUnet Business Partner
 http://www.eurolink.it          AIIP and ANFOV associated
 PGP Key: finger giuseppe@king.fr.flashnet.it
-------------------------------------------------------------------





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [ADMIN] Apache authentication & PostgreSQL
@ 1999-06-11 09:58  Jan Wieck <wieck@debis.com>
  parent: Fomichev Michael <fomichev@null.ru>
  3 siblings, 1 reply; 7+ messages in thread

From: wieck@debis.com @ 1999-06-11 09:58 UTC (permalink / raw)
  To: fomichev@null.ru; +Cc: pgsql-sql; pgsql-admin@postgreSQL.org

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) #





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [ADMIN] Apache authentication & PostgreSQL
@ 1999-06-15 03:38  Fomichev Michael <fomichev@null.ru>
  parent: Jan Wieck <wieck@debis.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Fomichev Michael @ 1999-06-15 03:38 UTC (permalink / raw)
  To: Jan Wieck <jwieck@debis.com>; +Cc: pgsql-sql; pgsql-admin@postgreSQL.org



On Fri, 11 Jun 1999, Jan Wieck wrote:

> 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.
> 
I'm using 1.3.3 version.

>     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?
> 
I want to give different access rights to the database for different
users (for select, for update, etc.). I can't do this using a pseudo user
to contact the database. In CGI script I can connect to the database with 
another username/password then a pseudo user, but I don't know the 
password of authenticated user. May be there is another way to do this ?




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: [SQL] Re: [ADMIN] Apache authentication & PostgreSQL
@ 1999-06-18 22:01  Christophe Labouisse <labouiss@cybercable.fr>
  parent: Fomichev Michael <fomichev@null.ru>
  0 siblings, 0 replies; 7+ messages in thread

From: Christophe Labouisse @ 1999-06-18 22:01 UTC (permalink / raw)
  To: pgsql-sql

Fomichev Michael <fomichev@null.ru> writes:

> I want to give different access rights to the database for different
> users (for select, for update, etc.). I can't do this using a pseudo user
> to contact the database. In CGI script I can connect to the database with 
> another username/password then a pseudo user, but I don't know the 
> password of authenticated user. May be there is another way to do this ?

Do you really need to set up password on the database level? As Jan
told you since an authentification is made on the apache level you
know when your CGI is executed that the user entered the right
password so you can create on the database level the same users you
use in apache but with no passwd or with dummy passwords.


-- 
Christophe Labouisse : Cinéma, typographie, Unix
christophe.labouisse@dial.oleane.com http://www.multimania.com/gabuzo/
Le cinéma en Lumière : http://www.lumiere.org/



^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~1999-06-18 22:01 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-06-11 04:02 Apache authentication & PostgreSQL Fomichev Michael <fomichev@null.ru>
1999-06-11 06:13 ` Remigiusz Sokolowski <rems@gdansk.sprint.pl>
1999-06-11 07:32 ` Volker Hess <Volker.Hess@avmz.uni-siegen.de>
1999-06-11 09:53 ` Giuseppe Tanzilli <g.tanzilli@eurolink.it>
1999-06-11 09:58 ` Jan Wieck <wieck@debis.com>
1999-06-15 03:38   ` Fomichev Michael <fomichev@null.ru>
1999-06-18 22:01     ` Christophe Labouisse <labouiss@cybercable.fr>

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