pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Gibson <gibsonm@cromwell.co.uk>
To: pgsql-admin@postgresql.org
To: pgsql-php@postgresql.org
Subject: Kerberos, Apache2, mod_auth_kerb, PHP, and PostgreSQL in harmony! How?
Date: Tue, 17 Aug 2004 15:40:02 +0100
Message-ID: <44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk> (raw)

Hi,
    I've been trying to Kerberize our Apache and PostgreSQL servers for
our company's web applications.

Goal: To connect from a PHP web app to a PostgreSQL database
using the users credentials, so all authorization is managed via
privileges within the database.

Our IT dept has recently installed Windows 2003 Server to provide
authentication & directories via Kerberos and LDAP.

I've managed to configure Apache (2.0.49) to authenticate users using
mod_auth_kerb (5.0-rc6), and also PostgreSQL (7.4.3) to use Kerberos.
(Linux hosts use MIT KerberosV5 1.3.3 client libs, KDC is Windows 2003)

mod_auth_kerb is configured with:

KrbSaveCredentials on

So in PHP (4.3.8) we end up with the variables:

$_SERVER['REMOTE_USER']    (eg: 'gibsonm@OUR-REALM.CO.UK')
$_SERVER['KRB5CCNAME']     (eg: 'FILE:/tmp/krb5cc_apache_tVFJCd')

Even HTTP Negotiate works with Firefox/Linux (but not IE/XP yet!) :)

But this is where I get stuck.
How do I use the supplied credentials file to connect to PostgreSQL?

In the PostgreSQL docs it says:
(http://www.postgresql.org/docs/7.4/interactive/auth-methods.html#KERBEROS-AUTH)

 > If you use mod_auth_kerb from http://modauthkerb.sf.net and mod_perl
 > on your Apache web server, you can use AuthType
 > KerberosV5SaveCredentials with a mod_perl script. This gives secure
 > database access over the web, no extra passwords required.

I'm assuming this is out of date, or has changed with mod_auth_kerb 5.0,
and that the KrbSaveCredentials directive does this job instead.

Is there any examples of this mod_perl script?
Can the alleged mod_perl method be adapted to PHP?
Has anyone got this to work?
What are the alternatives to my goal stated above?

Cheers
-- 
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.



view thread (4+ messages)  latest in thread

Message-ID: <44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk>
Permalink:  ../44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk/
Also on:    postgresql.org/message-id/44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk

 · 

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-php@postgresql.org
  Cc: gibsonm@cromwell.co.uk, pgsql-admin@postgresql.org
  Subject: Re: Kerberos, Apache2, mod_auth_kerb, PHP, and PostgreSQL in harmony! How?
  In-Reply-To: <44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk>
  References: <44fffac5903f1d3c69d160878754ce2f41221776@cromwell.co.uk>

* 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