Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D09E49FBADE for ; Tue, 20 Feb 2007 13:55:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 32246-08 for ; Tue, 20 Feb 2007 13:55:29 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from svr2.hagander.net (svr2.hagander.net [88.198.128.226]) by postgresql.org (Postfix) with ESMTP id CFF969FB958 for ; Tue, 20 Feb 2007 13:55:28 -0400 (AST) Received: from [192.168.199.196] (c213-100-160-41.swipnet.se [213.100.160.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by svr2.hagander.net (Postfix) with ESMTP id B2083DCC5C0; Tue, 20 Feb 2007 18:55:27 +0100 (CET) Message-ID: <45DB3617.9040107@hagander.net> Date: Tue, 20 Feb 2007 18:55:35 +0100 From: Magnus Hagander User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: Shane Ambler CC: Bruce Momjian , Michael Schmidt , PostgreSQL General Subject: Re: Password issue revisited References: <200702201521.l1KFLL823218@momjian.us> <45DB34BD.9070406@Sheeky.Biz> In-Reply-To: <45DB34BD.9070406@Sheeky.Biz> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.044 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200702/1069 X-Sequence-Number: 109559 >>> The default on *all* windows versions since NT 4.0 (which is when the >>> directory we use was added) will put this file in a protected directory. >>> The only case when it's not protected by default is if you're usnig FAT >>> filesystem, in which case there is nothing you can do about it anyway. >>> On unix, the file will often be created in outside-readable mode by >>> default, depending on how your OS is set up. > > I believe that .pgpass on *nix won't be used if it is readable by anyone > except the current user. No, root can always read it. On unix, there is one "root". On windows, the concept of administrator is less clear. > From the docs - > The permissions on .pgpass must disallow any access to world or group; > achieve this by the command chmod 0600 ~/.pgpass. If the permissions are > less strict than this, the file will be ignored. (The file permissions > are not currently checked on Microsoft Windows, however.) > > I would think that if they are using FAT filesystem (which is only > partially supported for developers benefit) then they can't use pgpass. If they are using FAT, the obviously don't care about the security of the system anyway, so it's not a problem, IMHO. So we only have to care about people who use NTFS. >>> So to reach a situation where the file lives in an unprotected >>> directory, you must actively open up the directory in question. Which is >>> hidden from default view, so you really need to know what you're >>> doing to >>> get there. >>> >>> Not to mention it's a pain to define what permissions are ok and what >>> are not. We're talking ACLs and not filemodes - so how do you decide >>> which accounts are ok to have access, and which are not? > > I would say the same as the *nix version - if it is readable or writable > by anyone except the current user it is potentially at risk, the current > user connecting to pgsql is the only use for this file. > Which I believe is the whole point of the TODO entry, stop anyone using > the pgpass file without proper security. Again, it's a lot harder to actually define it on Windows. What if your user has access only through a group? What about DENY permissions. Things like that. > The other thing to consider is that pgpass is the file referenced by > PGPASSFILE - the user can set this to point to a file anywhere on any > drive available. That's a very valid point though, didn't think about that. Still doesn't take away the "how" part, though, but it does take away part of the "why" part. //Magnus