Re: libpq: system-wide root.crt

Lists: pgsql-bugs
From: Martin Pitt <mpitt(at)debian(dot)org>
To: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>
Cc: Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: libpq: system-wide root.crt
Date: 2010-08-17 04:49:50
Message-ID: 20100817044950.GB2190@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello PostgreSQL developers,

I received a request to support system-wide root certificates in
libpq. Right now it only looks in ~/.postgresql/root.crt, but since
such certificates are usually set up system wide and be maintained by
the sysadmins, it would be very convenient if there was a fallback
lookup in /etc/postgresql/ or similar.

Would you accept a patch which adds a configure option for the path of
a system wide root certificate?

Thank you,

Martin

--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org>, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-08-17 09:05:31
Message-ID: AANLkTi=4DS_iDW+qbdj3yeVEqR=Jyz4LyC61nzLUBfPP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Tue, Aug 17, 2010 at 6:49 AM, Martin Pitt <mpitt(at)debian(dot)org> wrote:
> Hello PostgreSQL developers,
>
> I received a request to support system-wide root certificates in
> libpq. Right now it only looks in ~/.postgresql/root.crt, but since
> such certificates are usually set up system wide and be maintained by
> the sysadmins, it would be very convenient if there was a fallback
> lookup in /etc/postgresql/ or similar.
>
> Would you accept a patch which adds a configure option for the path of
> a system wide root certificate?

That seems like a good feature to me. Obviously, it would have to come
with support for the CRL as well, since it goes together with the root
cert ;)

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Martin Pitt <mpitt(at)debian(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Cc: Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-08-19 21:11:12
Message-ID: 20100819211112.GB2194@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hello PostgreSQL developers,

Martin Pitt [2010-08-17 6:49 +0200]:
> I received a request to support system-wide root certificates in
> libpq. Right now it only looks in ~/.postgresql/root.crt, but since
> such certificates are usually set up system wide and be maintained by
> the sysadmins, it would be very convenient if there was a fallback
> lookup in /etc/postgresql/ or similar.

Patch attached against current git head. I tested it with both the
default case (new option not specified), as well as with
--with-ssl-root-cert-dir=/etc/postgresql-common, and confirm that in
the latter case root.crt gets picked up from
/etc/postgresql-common/ if it's not in ~/.postgresql/.

Thank you for considering,

Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

Attachment Content-Type Size
0001-Add-system-wide-fallback-directory-for-SSL-root-cert.patch text/x-diff 4.8 KB

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-08-20 13:07:14
Message-ID: AANLkTinUXZf7KC1kSUuY1=UAYuysYqy4co5577WrQQrW@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thu, Aug 19, 2010 at 23:11, Martin Pitt <mpitt(at)debian(dot)org> wrote:
> Hello PostgreSQL developers,
>
> Martin Pitt [2010-08-17  6:49 +0200]:
>> I received a request to support system-wide root certificates in
>> libpq. Right now it only looks in ~/.postgresql/root.crt, but since
>> such certificates are usually set up system wide and be maintained by
>> the sysadmins, it would be very convenient if there was a fallback
>> lookup in /etc/postgresql/ or similar.
>
> Patch attached against current git head. I tested it with both the
> default case (new option not specified), as well as with
> --with-ssl-root-cert-dir=/etc/postgresql-common, and confirm that in
> the latter case root.crt gets picked up from
> /etc/postgresql-common/ if it's not in ~/.postgresql/.

Hi!

Please add this to https://commitfest.postgresql.org/action/commitfest_view/open

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Martin Pitt <mpitt(at)debian(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: libpq: system-wide root.crt
Date: 2010-08-20 13:20:07
Message-ID: 20100820132007.GG2406@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Magnus Hagander [2010-08-20 15:07 +0200]:
> Please add this to https://commitfest.postgresql.org/action/commitfest_view/open

Done, thanks!

https://commitfest.postgresql.org/action/patch_view?id=364

Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-09-23 06:36:41
Message-ID: AANLkTikjaJJVfCBR8vY5GhQQcwiuTwZu8SX=Moq_dTHb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Thu, Aug 19, 2010 at 23:11, Martin Pitt <mpitt(at)debian(dot)org> wrote:
> Hello PostgreSQL developers,
>
> Martin Pitt [2010-08-17  6:49 +0200]:
>> I received a request to support system-wide root certificates in
>> libpq. Right now it only looks in ~/.postgresql/root.crt, but since
>> such certificates are usually set up system wide and be maintained by
>> the sysadmins, it would be very convenient if there was a fallback
>> lookup in /etc/postgresql/ or similar.
>
> Patch attached against current git head. I tested it with both the
> default case (new option not specified), as well as with
> --with-ssl-root-cert-dir=/etc/postgresql-common, and confirm that in
> the latter case root.crt gets picked up from
> /etc/postgresql-common/ if it's not in ~/.postgresql/.

I wonder if we want to have a default value for this rather than
disabling it when it's not specified by configure. But is there any
kind of reasonable default that's not going to be
platform/distribution specific?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-09-23 16:31:33
Message-ID: 9721.1285259493@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> On Thu, Aug 19, 2010 at 23:11, Martin Pitt <mpitt(at)debian(dot)org> wrote:
>>> I received a request to support system-wide root certificates in
>>> libpq.

> I wonder if we want to have a default value for this rather than
> disabling it when it's not specified by configure. But is there any
> kind of reasonable default that's not going to be
> platform/distribution specific?

Given the potential security issues, I would argue very strenuously
that this should NOT be enabled by default. It should happen only
if the option is requested at configure time, and configure should
be told the exact path where to look for certs.

regards, tom lane


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-09-23 22:41:39
Message-ID: 1285281699.27917.19.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On tor, 2010-09-23 at 08:36 +0200, Magnus Hagander wrote:
> I wonder if we want to have a default value for this rather than
> disabling it when it's not specified by configure. But is there any
> kind of reasonable default that's not going to be
> platform/distribution specific?

I would like for us to find a way to do it without configure options.
Compiling in stuff is always weird.

I'm thinking, libpq could really use a global (and, for that matter, a
per-user) configuration file, where you could set defaults for some of
the things that you currently have to use environment variables for,
e.g., sslmode. And then you can configure the system-wide root.crt
location there.

Alternatively, if you think that that is overkill, then using an
environment variable to configure this feature would be consistent with
the existing mechanisms.


From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-09-24 07:50:43
Message-ID: AANLkTikt9v2ntHY0mkU1R5G-TKzoat+P18r6_K5X+L4r@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Fri, Sep 24, 2010 at 00:41, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On tor, 2010-09-23 at 08:36 +0200, Magnus Hagander wrote:
>> I wonder if we want to have a default value for this rather than
>> disabling it when it's not specified by configure. But is there any
>> kind of reasonable default that's not going to be
>> platform/distribution specific?
>
> I would like for us to find a way to do it without configure options.
> Compiling in stuff is always weird.

I think the compile-time default really is designed for distributions
- in this case debian, right? I would assume debian would prefer a
combination of a compile-time default and the below, rather than just
the default?

> I'm thinking, libpq could really use a global (and, for that matter, a
> per-user) configuration file, where you could set defaults for some of
> the things that you currently have to use environment variables for,
> e.g., sslmode.  And then you can configure the system-wide root.crt
> location there.

We already have this - pg_service.conf - no?

> Alternatively, if you think that that is overkill, then using an
> environment variable to configure this feature would be consistent with
> the existing mechanisms.

So in this case, a "sslfallbackroot=/etc/somewhere" parameter, that
you could then stick in etc/pg_service.conf, or in any of the other
places you can specify it? The one thing I think would be really
needed for that to work is to support wildcard database names in
pg_service.conf?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-09-25 19:38:38
Message-ID: 1285443518.5571.3.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On fre, 2010-09-24 at 09:50 +0200, Magnus Hagander wrote:
> > I'm thinking, libpq could really use a global (and, for that matter, a
> > per-user) configuration file, where you could set defaults for some of
> > the things that you currently have to use environment variables for,
> > e.g., sslmode. And then you can configure the system-wide root.crt
> > location there.
>
> We already have this - pg_service.conf - no?

Indeed.

> > Alternatively, if you think that that is overkill, then using an
> > environment variable to configure this feature would be consistent with
> > the existing mechanisms.
>
> So in this case, a "sslfallbackroot=/etc/somewhere" parameter, that
> you could then stick in etc/pg_service.conf, or in any of the other
> places you can specify it? The one thing I think would be really
> needed for that to work is to support wildcard database names in
> pg_service.conf?

Yes.


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-bugs(at)postgresql(dot)org, Stephen Gran <sgran(at)debian(dot)org>, DSA list <debian-admin(at)lists(dot)debian(dot)org>
Subject: Re: libpq: system-wide root.crt
Date: 2010-10-14 00:58:47
Message-ID: AANLkTiny7nrrLoHRhLE02hWtSMv90M4joyXCzYr04bwp@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Sat, Sep 25, 2010 at 3:38 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> On fre, 2010-09-24 at 09:50 +0200, Magnus Hagander wrote:
>> > I'm thinking, libpq could really use a global (and, for that matter, a
>> > per-user) configuration file, where you could set defaults for some of
>> > the things that you currently have to use environment variables for,
>> > e.g., sslmode.  And then you can configure the system-wide root.crt
>> > location there.
>>
>> We already have this - pg_service.conf - no?
>
> Indeed.
>
>> > Alternatively, if you think that that is overkill, then using an
>> > environment variable to configure this feature would be consistent with
>> > the existing mechanisms.
>>
>> So in this case, a "sslfallbackroot=/etc/somewhere" parameter, that
>> you could then stick in etc/pg_service.conf, or in any of the other
>> places you can specify it? The one thing I think would be really
>> needed for that to work is to support wildcard database names in
>> pg_service.conf?
>
> Yes.

What I gather from the discussion on this thread is that this patch
needs to be revised before it can be considered for commit, so I'm
going to mark it as Returned with Feedback in the CommitFest
application. Hopefully, it will be revised and resubmitted for the
then-current open CommitFest, which can always be found at:

https://commitfest.postgresql.org/action/commitfest_view/open

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