Re: Verifying SSL Certificate on the Client Side

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Atkins-Trimnell, Angus Black" <trimnell(at)uic(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Verifying SSL Certificate on the Client Side
Date: 2008-04-14 19:43:23
Message-ID: 200804141943.m3EJhNm12833@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Atkins-Trimnell, Angus Black wrote:
> Hello,
>
> I am trying to harden my application against man-in-the-middle attacks.
> The application, written in PHP, communicates with the PostgreSQL server
> using the usual pg_* functions built on the libpq library. I have the
> proper postgresql.key and postgresql.crt files installed on the Web server
> (PostgreSQL client) and the server.key, server.crt and root.crt files
> installed on the PostgreSQL server. My understanding is that when PHP
> issues a pg_connect() function, libpq supplies the client certificate to
> the PostgreSQL server and the PostgreSQL server checks the signature on
> the certificate against the signature of the trusted CA in root.crt. If
> they match, it's go time!
>
> My concern is that an attacker could impersonate the PostgreSQL server,
> intercept the initial pg_connect() request, submit it's own certificate to
> the client and steal the log in credentials. Is this possible and, if so,
> is there a way for PHP, through libpq, to check the certificate supplied
> by the server to determine that it is submitted by a trusted CA?
>
> I have submitted the same question to the PHP-DB mailing list, but a
> respondent said that this would be handled by PostgreSQL not PHP. Of
> course, since I'm writing my code in PHP, I'm hoping to be able to handle
> this in the PHP code.

I think you need to read the Postgres 8.3 docs on the subject:

http://www.postgresql.org/docs/8.3/static/ssl-tcp.html
http://www.postgresql.org/docs/8.3/static/libpq-ssl.html

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas 'ads' Scherbaum 2008-04-14 20:04:24 Re: Unacceptable postgres performance vs. Microsoft sqlserver
Previous Message Atkins-Trimnell, Angus Black 2008-04-14 19:39:32 Verifying SSL Certificate on the Client Side