Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVLuT-0008Cr-Uf for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Dec 2017 18:31:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eVLuR-0005Ul-2X for pgsql-bugs@arkaria.postgresql.org; Sat, 30 Dec 2017 18:31:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eVLuQ-0005US-Le for pgsql-bugs@lists.postgresql.org; Sat, 30 Dec 2017 18:31:02 +0000 Received: from kilimanjaro.scorpionshops.com ([82.118.24.84]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eVLuN-00060I-CX for pgsql-bugs@postgresql.org; Sat, 30 Dec 2017 18:31:01 +0000 Received: from [192.168.1.168] (78-82-173-199.tn.glocalnet.net [78.82.173.199]) by kilimanjaro.scorpionshops.com (Postfix) with ESMTPSA id 4F7647BC1B4; Sat, 30 Dec 2017 19:30:55 +0100 (CET) Subject: Re: psql cannot read client SSL private key from a pipe To: Tony Finch , pgsql-bugs@postgresql.org References: From: Andreas Karlsson Message-ID: Date: Sat, 30 Dec 2017 19:30:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 12/21/2017 06:40 PM, Tony Finch wrote: > PostgreSQL version: 10.1 > OS: Debian Stretch 9.3 > > I would like to be able to pass my SSL private key to psql via a pipe. > This is so that I can use the gpg agent to decrypt my key without retyping > my passphrase each time. (There isn't an agent for OpenSSL's own key > decryption routines.) For example, > > $ psql 'host=db1 port=5432 sslmode=verify-full user=postgres \ > sslcert=postgres.crt sslkey='<(gpg -d postgres.pem.asc) Hm, this does sound like a useful feature. Not sure if it counts as a bug though, so the hackers list is probably more suited for this patch. > I think it would be better to remove the check - with the patch below I > can log in using the command quoted above. > > Alternatively you could only exclude S_ISDIR() and S_ISBLK() - the other > cases allow getting keys from interesting placesq. I do not know why this check was added in the first place so I am not entirely sure what the right behavior should be. Maybe it would be enough with an S_ISDIR() check. Andreas