Unix Technical Forum

Verifying SSL Certificate on the Client Side

This is a discussion on Verifying SSL Certificate on the Client Side within the Pgsql General forums, part of the PostgreSQL category; --> Hello, I am trying to harden my application against man-in-the-middle attacks. The application, written in PHP, communicates with the ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 09:34 PM
Atkins-Trimnell, Angus Black
 
Posts: n/a
Default Verifying SSL Certificate on the Client Side

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.

Thanks for any guidance.

Sincerely,

Angus Atkins-Trimnell


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 09:34 PM
Bruce Momjian
 
Posts: n/a
Default Re: Verifying SSL Certificate on the Client Side

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/s...libpq-ssl.html

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:21 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com