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 F3859D1EA15 for ; Sat, 1 May 2004 09:07:47 -0300 (ADT) 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 69262-07 for ; Sat, 1 May 2004 09:07:29 -0300 (ADT) Received: from lamb.mcmillan.net.nz (218-101-45-219.paradise.net.nz [218.101.45.219]) by svr1.postgresql.org (Postfix) with ESMTP id A1C8BD1C9C4 for ; Sat, 1 May 2004 09:07:24 -0300 (ADT) Received: from lamb.mcmillan.net.nz (lamb.mcmillan.net.nz [127.0.0.1]) by lamb.mcmillan.net.nz (Postfix) with ESMTP id 9288DAD98596 for ; Sun, 2 May 2004 00:07:26 +1200 (NZST) Subject: Re: securing PHP/Postgresql (was: MD5 in pg and php) From: Andrew McMillan To: pgsql-php@postgresql.org In-Reply-To: <20040429165723.GA18588@localhost.localdomain> References: <20040429070716.GA6918@localhost.localdomain> <20040429101129.GC26489@wolff.to> <20040429165723.GA18588@localhost.localdomain> Content-Type: text/plain Message-Id: <1083413245.6439.43.camel@lamb.mcmillan.net.nz> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.5.7 Date: Sun, 02 May 2004 00:07:26 +1200 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/1 X-Sequence-Number: 2720 On Thu, 2004-04-29 at 18:57 +0200, Joolz wrote: > > I have to think about it long and hard :-), the extra "layer" makes > things more secure, I would only have to register username (for > auditing purposes) plus the "role" in session variables, which could > be md5()'d. Still, the extra layer is from a logical point of view > redundant and thus errorprone. > > Still, it might be a good idea. If anyone cares to share their opinion > on the matter (or discuss how you handled this), TIA! For myself, I handle security roughly as follows: Password is stored as a salted md5, which means that two users with the same password have different on-disk records of it. Logged in user gets a session cookie which is an md5 of random data plus a session id. The session id is looked up, and the random data (which is only known server-side) is validated. Of course the session id is predictable, but the random data is not. I use a general user-id to access the database, rather than database users and permissions. I generally find that the database permissions model is not a good fit to the permissions I want for my website. Hope this is of interest, Andrew McMillan. ------------------------------------------------------------------------- Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267 -------------------------------------------------------------------------