Fwd: SSL auth question

Lists: pgsql-hackers
From: carriingfate92(at)ya(dot)ru
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fwd: SSL auth question
Date: 2014-04-02 06:38:09
Message-ID: 1851471396420689@web5h.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello,

I set certificate auth on postgresql 9.3. I generate SSL certificate with my custom extension. So, OpenSSL read it, PostgreSQL accept it if this extension is not critical, but if I set this extension critical, PostgreSQL deny connection.

How can I prevent it? Where PostgreSQL try to read SSL extension?

Best regards,
Dmitry Voronin


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: carriingfate92(at)ya(dot)ru
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: SSL auth question
Date: 2014-04-03 00:12:36
Message-ID: CA+TgmoZyXyBtOZkjuJMMKRFRBUPGQH2NZC70p7tG7n0fnyvkzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 2, 2014 at 2:38 AM, <carriingfate92(at)ya(dot)ru> wrote:
> I set certificate auth on postgresql 9.3. I generate SSL certificate with my custom extension. So, OpenSSL read it, PostgreSQL accept it if this extension is not critical, but if I set this extension critical, PostgreSQL deny connection.
>
> How can I prevent it? Where PostgreSQL try to read SSL extension?

I don't know what it means to set an extension critical.

If you provide enough details for someone to reproduce the exact
scenario you tried, someone may be able to help. Otherwise, probably
not.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Wim Lewis <wiml(at)omnigroup(dot)com>
To: carriingfate92(at)ya(dot)ru
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fwd: SSL auth question
Date: 2014-04-03 00:32:51
Message-ID: 36134A5C-1883-4982-9BBE-C8E0DB6E6E81@omnigroup.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 1 Apr 2014, at 11:38 PM, carriingfate92(at)ya(dot)ru wrote:
> I set certificate auth on postgresql 9.3. I generate SSL certificate with my custom extension. So, OpenSSL read it, PostgreSQL accept it if this extension is not critical, but if I set this extension critical, PostgreSQL deny connection.

I think that is the correct behavior. The "critical" bit tells PostgreSQL (or other software) what to do if it does not understand the extension: if there's an unknown extension with the critical bit set, then the certificate can't be validated. If the critical bit is not set, then the unknown extension is ignored, and the certificate is processed as if the extension weren't there.

See this section of RFC 5280:
http://tools.ietf.org/html/rfc5280#section-4.2

The idea is that you can set the critical bit for extensions that are supposed *restrict* the usability of the certificate, so that the certificate won't be used in undesired ways by software that doesn't understand the extension.


From: Воронин Дмитрий <carriingfate92(at)yandex(dot)ru>
To: Wim Lewis <wiml(at)omnigroup(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: SSL auth question
Date: 2014-04-03 05:32:49
Message-ID: 99721396503169@web30h.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Thank you for answer!
I know it. So, my second questions is:
How can I add support of this extension in PostgreSQL. So, I want to do thing, that PostgreSQL accept connection with cert auth method and certificate has my extension with critical flag?

03.04.2014, 04:33, "Wim Lewis" <wiml(at)omnigroup(dot)com>:
> On 1 Apr 2014, at 11:38 PM, carriingfate92(at)ya(dot)ru wrote:
>
>>  I set certificate auth on postgresql 9.3. I generate SSL certificate with my custom extension. So, OpenSSL read it, PostgreSQL accept it if this extension is not critical, but if I set this extension critical, PostgreSQL deny connection.
>
> I think that is the correct behavior. The "critical" bit tells PostgreSQL (or other software) what to do if it does not understand the extension: if there's an unknown extension with the critical bit set, then the certificate can't be validated. If the critical bit is not set, then the unknown extension is ignored, and the certificate is processed as if the extension weren't there.
>
> See this section of RFC 5280:
>   http://tools.ietf.org/html/rfc5280#section-4.2
>
> The idea is that you can set the critical bit for extensions that are supposed *restrict* the usability of the certificate, so that the certificate won't be used in undesired ways by software that doesn't understand the extension.

----
Best regards, Dmitry Voronin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Воронин Дмитрий <carriingfate92(at)yandex(dot)ru>
Cc: Wim Lewis <wiml(at)omnigroup(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: SSL auth question
Date: 2014-04-03 22:58:04
Message-ID: 16920.1396565884@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

=?koi8-r?B?98/Sz87JziDkzcnU0snK?= <carriingfate92(at)yandex(dot)ru> writes:
> I know it. So, my second questions is:
> How can I add support of this extension in PostgreSQL. So, I want to do thing, that PostgreSQL accept connection with cert auth method and certificate has my extension with critical flag?

Seems like this is a question you should direct to OpenSSL people, not us.
Postgres itself knows nothing to speak of about SSL certificates; it just
delegates all that processing to openssl.

regards, tom lane