Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e59si-00020P-Mg for pgsql-general@arkaria.postgresql.org; Thu, 19 Oct 2017 12:25:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e59si-0000R7-9a for pgsql-general@arkaria.postgresql.org; Thu, 19 Oct 2017 12:25:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e59qC-0003O4-Sd for pgsql-general@postgresql.org; Thu, 19 Oct 2017 12:22:24 +0000 Received: from mail-yw0-x234.google.com ([2607:f8b0:4002:c05::234]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e59q9-00008K-L4 for pgsql-general@postgresql.org; Thu, 19 Oct 2017 12:22:24 +0000 Received: by mail-yw0-x234.google.com with SMTP id q1so3295999ywh.5 for ; Thu, 19 Oct 2017 05:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=5tIG839zK3/6D12f97Z6e7nfICWH7xfHb8sTRk5WexI=; b=RKO6uGBbK5CfbHliuFbF5OG89HCsvJAQt1b+DElvlxotXex9O9dpa0HY6+zo0KnRoQ DOptJvClLU0Sy0uLwe0g2u0lr1Ts4BrSAQo8DoQ8Xj3Bl1QuCmkZF94cSlhJrYHgthSi 4e+XKRsz8UPr+u5VIoBVz4ZfjRiCiPvEsnCZr34+6kKiduOdsS/BBIUMhfMP6IExKuJ/ zcpQVEirlFzNMyaevjcuKCfH4jDe7kXfiCU/rKMaPguznlzkQNLwPYmYzLLeoo6AyoZJ TNdUSIW+YWll6Q2J6NjG4/vD0e/4HMFtqLHbzE1jLlDPWIkrHx+jFojoj+lNq/W2a2Be 1htA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5tIG839zK3/6D12f97Z6e7nfICWH7xfHb8sTRk5WexI=; b=W6y7bH7uMRmqr4Fzy+UvBZKY4x/JMt/Vq8fTBVxG8lEzkiWUCMl5RPad7TNs9WNZ0y sDxjSX1dsQ5UIQcI0yh2yJ71EUkYjewW1JgZYBmf4e8kqqW+IvcM0I5o3oDfQJziDw5v zIAEoaF5LE55kLcPpagJY2ANmPAq6xy+MkVA7Zy98RoxePr4LHhR5GPFYL74qD6fWomf rmVGgJcUTVa/A+WPmdn6xGN6Fa3ZPPnGlhFDoz9b7FsNNuyNT4Glg4bL72j2zax//IuW 0UO87SJiantBPVrJU44XpZGVpjbaNwts0wyer83Gw1ShPQ6+wX1k90Muh41dPIyfP57x wODQ== X-Gm-Message-State: AMCzsaUPRDyP0Mc30cKn32Fk/m1aXPo1CqSkIsKvhGTPo98P3emzIV4W GBs6JztenWla/QzQuSUQhLaO9G1Q4zqL2u0kGZBV3E1YRdEeOHcVlMsDi8qBRZgPH6mpYquVUvP GIAxATZtBg+OQLVvl/45sWZV28cOyLxPIdQuS/xM71nAVZ69drsTqvG2KfSkYeRmSY+zbBX38yg tlWyc4FplY4PvF X-Google-Smtp-Source: ABhQp+Q8b+EOdQQUnYNujjcgdySr9DQ8tXBTNdV6uoPTjeeZqenMvWto8RL1D0FH+2yuqF1PJogDIw== X-Received: by 10.129.57.66 with SMTP id g63mr926699ywa.211.1508415739700; Thu, 19 Oct 2017 05:22:19 -0700 (PDT) Received: from [192.168.10.146] ([98.122.175.38]) by smtp.gmail.com with ESMTPSA id r188sm6310258ywd.25.2017.10.19.05.22.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2017 05:22:19 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: pgpass file type restrictions To: Tom Lane , Desidero Cc: pgsql-general@postgresql.org References: <11556.1508393575@sss.pgh.pa.us> Message-ID: Date: Thu, 19 Oct 2017 08:22:18 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <11556.1508393575@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-MW List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On 10/19/2017 02:12 AM, Tom Lane wrote: > Desidero writes: >> I=E2=80=99m running into problems with the restriction on pgpass file ty= pes. When >> attempting to use something like an anonymous pipe for a passfile, psql >> throws an error stating that it only accepts plain files. >> ... >> Does anyone know why it=E2=80=99s set up to avoid using things like anon= ymous pipes >> (or anything but "plain files")? > A bit of digging in the git history says that the check was added here: > > commit 453d74b99c9ba6e5e75d214b0d7bec13553ded89 > Author: Bruce Momjian > Date: Fri Jun 10 03:02:30 2005 +0000 >=20=20=20=20=20 > Add the "PGPASSFILE" environment variable to specify to the passw= ord > file. >=20=20=20=20=20=20=20=20=20 > Andrew Dunstan >=20=20=20=20=20 > and poking around in the mailing list archives from that time finds > what seems to be the originating thread: > > https://www.postgresql.org/message-id/flat/4123BF8C.5000909%40pse-consult= ing.de > > There's no real discussion there of the check for plain-file-ness. > My first guess would have been that the idea was to guard against > symlink attacks; but then surely the stat call needed to have been > changed to lstat? So I'm not quite sure of the reasoning. Perhaps > Andrew remembers. That was written 13 years ago. I'm afraid my memory isn't that good. > >> If it matters, >> I'm trying to use that so I can pass a decrypted pgpassfile into postgres >> since my company is not allowed to have unencrypted credentials on disk >> (yes, I know that it's kind of silly to add one layer of abstraction, but >> it's an industry rule we can't avoid). > I cannot get excited about that proposed use-case, though. How is a pipe > any more secure than a plain file with the same permissions? If it's not allowed to reside on disk, put it on a RAM disk? > > My thought is that you shouldn't be depending on passwords at all, but > on SSL credentials or Kerberos auth, both of which libpq supports fine. > Yeah, we need to be convincing people with high security needs to get out of the password game. It's a losing battle. cheers andrew --=20 Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --=20 Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general