Re: BUG #1963: SSL certificate permission check is too strict

Lists: pgsql-bugs
From: "Martin Pitt" <mpitt(at)debian(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1963: SSL certificate permission check is too strict
Date: 2005-10-13 16:26:38
Message-ID: 20051013162638.E8B56F1311@svr2.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1963
Logged by: Martin Pitt
Email address: mpitt(at)debian(dot)org
PostgreSQL version: 8.1beta3
Operating system: Debian
Description: SSL certificate permission check is too strict
Details:

Currently the postmaster requires the private SSL key file to have the same
owner as the postmaster, and no permissions for group and others. However,
this is too strict to sensibly use the certificate with ACLs, which permits
other server processes to share it.

In Debian I applied a patch which relaxes the check a bit: in addition to
the currently allowed permissions, the file might be:
- owned by root
- group-readable if the file is in group root or the postmaster group.

Since this likely affects non-Debian server installations as well, do you
consider adopting this?

Thanks!

Martin

Original Debian bug report:
http://bugs.debian.org/327901

Debian patch against 8.1beta3:
http://people.debian.org/~mpitt/09-relax-sslkey-permscheck.patch


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Martin Pitt" <mpitt(at)debian(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1963: SSL certificate permission check is too strict
Date: 2005-10-14 15:38:38
Message-ID: 10226.1129304318@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Martin Pitt" <mpitt(at)debian(dot)org> writes:
> Currently the postmaster requires the private SSL key file to have the same
> owner as the postmaster, and no permissions for group and others. However,
> this is too strict to sensibly use the certificate with ACLs, which permits
> other server processes to share it.

> In Debian I applied a patch which relaxes the check a bit: in addition to
> the currently allowed permissions, the file might be:
> - owned by root
> - group-readable if the file is in group root or the postmaster group.

This was proposed and rejected before --- it's not clear why it's a good
idea to share a private key file with other servers, and even less clear
why it'd be a good idea to have such a file be group-readable by a large
group.

regards, tom lane


From: Martin Pitt <mpitt(at)debian(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1963: SSL certificate permission check is too strict
Date: 2005-10-14 17:13:35
Message-ID: 20051014171335.GB20581@piware.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi Tom!

Tom Lane [2005-10-14 11:38 -0400]:
> "Martin Pitt" <mpitt(at)debian(dot)org> writes:
> > Currently the postmaster requires the private SSL key file to have the same
> > owner as the postmaster, and no permissions for group and others. However,
> > this is too strict to sensibly use the certificate with ACLs, which permits
> > other server processes to share it.
>
> > In Debian I applied a patch which relaxes the check a bit: in addition to
> > the currently allowed permissions, the file might be:
> > - owned by root
> > - group-readable if the file is in group root or the postmaster group.
>
> This was proposed and rejected before --- it's not clear why it's a good
> idea to share a private key file with other servers,

On my own boxes I usually create one certificate per box, not per
server. This keeps certificate management easy and avoids redundancy -
why should I create separate certifictates for each server I run? I
want to validate the identity computers with the certificates, nothing
more. This seems to be a common practice.

> and even less clear why it'd be a good idea to have such a file be
> group-readable by a large group.

The group does not need to be big; for sharing certificates, you
basically have two options:

- Use ACLs; this is a clean way, but not supported by all file
systems, and even by less backup systems. It does not require
groups, though.

- Create a "sslkey" group and add all servers to it that need read
permission to the certificate.

AIUI this check should prevent admins from accidentially shooting
themselves in the foot, not make it totally impossible to configure
stuff as the admin wants. Or is that wrong?

At least the certificate could be permitted to be owned/in group root.
I cannot see how this should weaken the certificate's security.

Thanks and have a nice weekend!

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

In a world without walls and fences, who needs Windows and Gates?


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martin Pitt <mpitt(at)debian(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1963: SSL certificate permission check is too strict
Date: 2005-10-16 04:41:04
Message-ID: 4893.1129437664@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Martin Pitt <mpitt(at)debian(dot)org> writes:
> At least the certificate could be permitted to be owned/in group root.
> I cannot see how this should weaken the certificate's security.

Postgres doesn't run as root, hence could not use such a certificate
unless it was world-readable.

Or should I infer from this that you've also patched out that safety
check?

regards, tom lane


From: Martin Pitt <mpitt(at)debian(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1963: SSL certificate permission check is too strict
Date: 2005-10-16 09:45:20
Message-ID: 20051016094520.GC20451@box79162.elkhouse.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Hi Tom!

Tom Lane [2005-10-16 0:41 -0400]:
> Martin Pitt <mpitt(at)debian(dot)org> writes:
> > At least the certificate could be permitted to be owned/in group root.
> > I cannot see how this should weaken the certificate's security.
>
> Postgres doesn't run as root, hence could not use such a certificate
> unless it was world-readable.

Please see my original mail. If you use ACLs, postgres can very well
be able to read the certificate.

The point was that a key's security is not weakened if it is owned by
root instead of "postgres" - to the contrary. So I don't see the point
of the check that actively prohibits a key being owned by root.

Martin

--
Martin Pitt http://www.piware.de
Ubuntu Developer http://www.ubuntulinux.org
Debian Developer http://www.debian.org