Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D1B621337B54 for ; Thu, 3 Mar 2011 17:59:31 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 40605-03 for ; Thu, 3 Mar 2011 21:59:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D3A4E1337B3E for ; Thu, 3 Mar 2011 17:59:23 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p23LxGZK008296; Thu, 3 Mar 2011 16:59:16 -0500 (EST) To: Christian Kastner cc: pgsql-bugs@postgresql.org Subject: Re: Possible regression: libpq + SSL aborts when user has no home directory In-reply-to: <4D6FF05E.1050201@kvr.at> References: <4D6FF05E.1050201@kvr.at> Comments: In-reply-to Christian Kastner message dated "Thu, 03 Mar 2011 20:47:42 +0100" Date: Thu, 03 Mar 2011 16:59:15 -0500 Message-ID: <8295.1299189555@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/78 X-Sequence-Number: 29588 Christian Kastner writes: > Using libpq 9.0.3, when an SSL connection is attempted from a client > whose EUID is not in a password database, the connection fails because > the home directory cannot be determined. With libpq 8.4.7, everything is > fine. > I encountered this issue on my mail host, where I use virtual users. > When mail is delivered, parameters such as UID, home directory, etc. are > retrieved using multiple queries against a Postgres DB. > As soon as the virtual user's UID (which does not exist in any local > password database) is determined, exim setuid()s to it. All further > queries then fail with an error similar to this one: > PGSQL connection failed: could not get home directory to locate client > certificate files > FATAL: no pg_hba.conf entry for host "1.2.3.4", user "exim4", database > "fake_name", SSL off > Looking at interfaces/libpq/fe-secure.c, it seems that such a failure > previously only occurred when sslmode was "verify-*", otherwise the > missing home dir was ignored. Now, it always fails. Hmm. Offhand I agree that that seems like an unnecessary regression. It should act just the same as if it could not find any of those files. A quick look with git blame suggests that this got broken in my commit 4ed4b6c54e5fab24ab2624d80e26f7546edc88ad, and I don't think that it was intentional. One small problem is that if the sslmode is "verify-ca" or "verify-full", failure to find the root cert file is an error, and that error message normally includes the pathname at which the cert file was sought. What shall we print if we couldn't identify the home directory? regards, tom lane