Re: [ADMIN] Secure DB Systems - How to

From: Daniel Struck <struck(dot)d(at)retrovirology(dot)lu>
To: Mitch Pirtle <mitchy(at)spacemonkeylabs(dot)com>
Cc: pgsql-php(at)postgresql(dot)org
Subject: Re: [ADMIN] Secure DB Systems - How to
Date: 2004-07-27 11:41:33
Message-ID: 20040727134133.676ab9cf@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-admin pgsql-hackers-win32 pgsql-php pgsql-sql

> Exactly. That is the only way to ensure that the data is never
> decrypted within the database or database server.

But then one will also lose the ability to make sql-queries with the encrypted columns . Something I wouldn't want to miss, or else it doesn't make sense to store this data in a database if one can't work with it.
I do send queries with the password within it, so I disabled the logging of sql-statements in postgresql to prevent the leakage of the password.
But the problem exists that the password is the available at several places.
As I am the only admin of the machine this shouldn't be such a big problem.

> Now, the 'client' IMHO is the PHP application. If the key for your
> encryption is stored in the user's session (on the webserver
> temporarily) then there is no log of that key or data (unless you store
> the session data in the database, then you got problems, see below).

I simply store a sha1 hash of the password in a configuration file, to verify that the user did enter the correct password, or else he would only see garbage ;-)

> I'm starting an article on doing just this for International PHP
> Magazine, and of course will use PostgreSQL as the back-end ;-)

Interesting, good that one can also order this editions online ;-)

> the data in the database encrypted at all times. Basically every record
> would be encrypted with the key for the user associated with that
> record, and there's a lot of work for anyone with a snapshot who is
> working on brute forcing all that data row by row... :)

I have a different scenario; a couple of common sensitive information several users must have access to. So I have to go with only one password.

(At last their is a second layer of protection if someone steals the server or hard drives: I will encrypt the postgres files with dm_crypt. Right now I am testing it, and it seems to work fine so far.)

> during transmission of that data back to the client. SSL would be the
> most common approach to solving this problem.

I have tested two-way ssl authentication. The certificates for the clients are stored on smartcards accessible to the mozilla browser.
(I have written a small howto, you can find it on http://www.opensc.org/files/doc/apache-client-authentication(v0.5.1).pdf, but I haven't yet tested it with the latest release of opensc)

> the database if this method were used, rendering your efforts pointless!

True, if you find the solution I hope to find it in your article ;-)

Daniel

--
Retrovirology Laboratory Luxembourg
Centre Hospitalier de Luxembourg
4, rue E. Barblé
L-1210 Luxembourg

phone: +352-44116105
fax: +352-44116113
web: http://www.retrovirology.lu
e-mail: struck(dot)d(at)retrovirology(dot)lu

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Andreas Pflug 2004-07-27 12:24:31 Re: compile problem
Previous Message babar haq 2004-07-27 10:42:46 Re: compile problem

Browse pgsql-admin by date

  From Date Subject
Next Message alvaro 2004-07-27 15:58:41 SOS ---- Could you help me with pg_resetxlog
Previous Message Tom Lane 2004-07-26 20:46:27 Re: How do I grant access to entire database at

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Merlin Moncure 2004-07-27 13:14:38 Re: Postres Beta Installer Error on W2K SP4
Previous Message Tom.Zschockelt 2004-07-27 09:28:34 pg_dumpall failed

Browse pgsql-php by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-27 19:49:05 Re: [ADMIN] Secure DB Systems - How to
Previous Message azah azah 2004-07-22 03:13:03 Re: date_format in postresql

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-07-27 19:49:05 Re: [ADMIN] Secure DB Systems - How to
Previous Message sad 2004-07-27 06:36:49 surrogate keys and replication.