Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id E22E74760EC for ; Wed, 22 Jan 2003 09:57:54 -0500 (EST) Received: from jive.SoftHome.net (jive.SoftHome.net [66.54.152.27]) by postgresql.org (Postfix) with SMTP id 48166476427 for ; Wed, 22 Jan 2003 09:54:23 -0500 (EST) Received: (qmail 20608 invoked by uid 417); 22 Jan 2003 14:54:27 -0000 Received: from shunt-smtp-out-0 (HELO softhome.net) (172.16.3.12) by shunt-smtp-out-0 with SMTP; 22 Jan 2003 14:54:27 -0000 Received: from supercable ([217.216.221.248]) (AUTH: LOGIN adriantineo@softhome.net) by softhome.net with esmtp; Wed, 22 Jan 2003 07:54:04 -0700 Message-ID: <007101c2c226$391ddf40$f8ddd8d9@supercable.es> From: "Adrian Tineo" To: "Luke Woollard" , "Matthew Horoschun" Cc: pgsql-php@postgresql.org References: Subject: Re: Password Encryption to replicate MySQL PASSWORD function Date: Wed, 22 Jan 2003 15:54:38 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/46 X-Sequence-Number: 1791 >We decided that the > safest method was to create real users in the PostgreSQL system user > table, and then let Postgres worry about authenticating users. Then, > even if your PHP code is flawed, the SQL commands still execute with > only the users permissions. I thought that way too but now I think it is better to create users and do the encrypting in the application layer and store logins and passwords in regular tables. The reason is that if, by any means, someone enters the database as user postgres or any other with total priviledges then you can see in the pg_shadow table the paswords in clear, this is a bigger risk than having your passwords encrypted in PHP and store them as encrypted TEXT in any table. Besides if you move from one postgresql server to another you have to worry a lot about how postgresql is configured (permissions and such). If you put it all in the application and regular tables you can go to any typical postgresql installation and install the database and application quickly and safely. At least that's what I think. Adrian Tineo