X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 82E9DD1B54F for ; Tue, 11 Nov 2003 13:31:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 39768-04 for ; Tue, 11 Nov 2003 09:31:09 -0400 (AST) Received: from bramble.mmrd.com (unknown [65.217.53.66]) by svr1.postgresql.org (Postfix) with ESMTP id 1D6FDD1B4F6 for ; Tue, 11 Nov 2003 09:31:05 -0400 (AST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by bramble.mmrd.com (8.12.8/8.12.8) with ESMTP id hABCZPcM023156; Tue, 11 Nov 2003 07:35:26 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id hABDUul05237; Tue, 11 Nov 2003 08:30:57 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id V3JRTC3K; Tue, 11 Nov 2003 08:30:55 -0500 Subject: Re: client authentication towards postgresql in php? From: Robert Treat To: Daniel Struck Cc: pgsql-php@postgresql.org In-Reply-To: <20031109165228.45503144.struck.d@retrovirology.lu> References: <20031109165228.45503144.struck.d@retrovirology.lu> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 11 Nov 2003 08:30:56 -0500 Message-Id: <1068557456.10942.14684.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/31 X-Sequence-Number: 2424 On Sun, 2003-11-09 at 10:52, Daniel Struck wrote: > Hello, > > > I am searching for a secure way to handle client authentication in php towards postgresql. > > Let me explain what I like to setup: > > Client will connect to the application via Apache. > The authentication of the clients will be done over ssl and the certificates of the clients will be stored on smartcards. > (I have written a small documentation how to setup this at www.opensc.org). > Next I will read in the PHP application environment variables of apache to know if the user was correctly authenticated by apache. > > In postgresql I would like to create for every client a user. > Purpose: automatically log every action like update/delete of users by rules without requiring scripts in php. > > The problem I have is to authenticate the client to postgresql. If your actually creating a user inside the database for each user, authentication is handled inside the database and passwords are held inside the database. When your php login script fires off, save the user name/ password into a session and then use that info to build your pg_connect strings. Or maybe I've missed something because this sounds a lot easier to do than your making it out to be. Robert Treat -- Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL