Re: BUG #14543: libpq fails with group readable ssl keys

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: postgres(at)freigeist(dot)org
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14543: libpq fails with group readable ssl keys
Date: 2017-02-14 00:01:32
Message-ID: CAB7nPqTHHHFXbffdx97ZmbaPH-OSRmW7ucQDy_f5uADAVpkMRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 14, 2017 at 3:43 AM, <postgres(at)freigeist(dot)org> wrote:
> looks like libpq checks if a ssl key is group or world readable and aborts
> if that's the case:

This is not a bug.

> # pg_basebackup -R -d
> 'postgres://replication(at)db-rw?sslmode=verify-ca&sslcert=/etc/ssl/private/default.pem&sslkey=/etc/ssl/private/default-key.pem&sslrootcert=/etc/ssl/ca-trusted.pem'
> -D /var/lib/postgresql/9.5/main --xlog-method=stream
> pg_basebackup: could not connect to server: private key file
> "/etc/ssl/private/default-key.pem" has group or world access; permissions
> should be u=rw (0600) or less

This behavior comes from commit eb7afc14 of 2002.

> While I agree this is reasonable to do if the key is world readable, it's
> perfectly fine to make a SSL key group readable to share it with multiple
> users on the same system.

I don't disagree with that. Now it is hard to justify a change for a
14-year-old behavior as many users may rely on the current way things
work as well.

> Ubuntu (and probably most other distributions) even creates a group for
> exactly this scenario:

Hard to assume. Fedora does not have such a patch:
http://pkgs.fedoraproject.org/cgit/rpms/postgresql.git/tree/.
Archlinux also shows none:
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/postgresql.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Day 2017-02-14 04:01:26 Re: BUG #14231: logical replication wal sender process spins when using error traps in function
Previous Message jordal 2017-02-13 19:43:55 BUG #14544: libpq: specifying 'target_session_attrs=read-write' prevents use of PQsendQuery