Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crobs-00031P-TK for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2017 16:32:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1crobs-0002JJ-BQ for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2017 16:32:12 +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 1croaL-0005gK-1g for pgsql-hackers@postgresql.org; Sat, 25 Mar 2017 16:30:37 +0000 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1croaD-0003pu-De for pgsql-hackers@postgresql.org; Sat, 25 Mar 2017 16:30:35 +0000 Received: by mail-wr0-x236.google.com with SMTP id u108so10142243wrb.3 for ; Sat, 25 Mar 2017 09:30:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ElIntuBicwtTe5T9WQUegFt0DPYId1SNGoNJEyeZeIw=; b=HiHPnf2ZXSPUKs2Vn/iaWVxIBhU/xLU6olf3be7C/uvR3Pf7TYV7/DRKaEPlkRvbxx zjNpAjsG2nlCeUtKjkM7tHDq+paOuflBk9l8Ujsuv5lH/l9KqDs7XxMovgZ+fQqaCqsy Uv8mcXESqwFqdFm5ht2si2Aw671W/6C7eSevGtOKA5TlwzhQfpahHtSayzGW9o/Av4PP 9NWnj2CrsLBnPqk0WUFUcuD1NW2w22P0hXwAes3ku6ocfand0L9GBwVJXvzCFqLKTyan vziWvx0Ug0JASg8MdNrcIfE8fpf88IiB19fz7c2ioo1pzzOf37tuWYqqlVZQ/xXhj2Df 3+Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ElIntuBicwtTe5T9WQUegFt0DPYId1SNGoNJEyeZeIw=; b=h7pOdVkpPPsjLHcfAW5FzdAIfu4IPZ2ckBAoR3VJC1EKSbKAXfII9KahP+G/Fhr2ik H3V1IxwZv1eRgoepEDPT2oxF2j2KUKUwwRpOFjWt9pZ7smW1PUCRSw60gmAe7fDX95IE SklLGdQ6m/iVPwy9ZBE9BlO/9AcqzTCzAfN9YgFh/tBldEPQQOD4CJqo6774vqWnGMkZ Wr+pZ/3tSGfzNJlp+4LHUiy3tFAMPIta6KzXjmbbID2bTev4K27eTNNpTXjLtYmGtUTP tPr6yuDuuwWD8H07RyuZ2ppZNG1ziwew9C64vvGPGOPJnF1Wvf9+Im6bwixTPQ2fFiph cUZw== X-Gm-Message-State: AFeK/H0vwIrRUyxAqA0A8Ej/hRSpMXZ/LJ1qHkLZQG3sQa+D9se1kwLRfAoEf1tbov3Yuw== X-Received: by 10.223.161.78 with SMTP id r14mr13142129wrr.101.1490459426946; Sat, 25 Mar 2017 09:30:26 -0700 (PDT) Received: from [10.205.74.150] ([213.205.194.26]) by smtp.gmail.com with ESMTPSA id t21sm7110367wmd.19.2017.03.25.09.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Mar 2017 09:30:25 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: Monitoring roles patch From: Dave Page X-Mailer: iPhone Mail (14D27) In-Reply-To: <20170325155520.GW9812@tamriel.snowman.net> Date: Sat, 25 Mar 2017 16:30:24 +0000 Cc: Robert Haas , Peter Eisentraut , PostgreSQL Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <0C373C5B-2291-4608-A349-4F57D694F533@pgadmin.org> References: <20170322131730.GD9812@tamriel.snowman.net> <20170324123031.GD9812@tamriel.snowman.net> <20170325155520.GW9812@tamriel.snowman.net> To: Stephen Frost X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Hi > On 25 Mar 2017, at 15:55, Stephen Frost wrote: >=20 > Robert, >=20 > * Robert Haas (robertmhaas@gmail.com) wrote: >>> On Fri, Mar 24, 2017 at 12:46 PM, Dave Page wrote: >>>> On Fri, Mar 24, 2017 at 4:24 PM, Robert Haas w= rote: >>>> That's possible, but it really depends on the tool, not on core >>>> PostgreSQL. The tool should be the one providing the script, because >>>> the tool is what knows its own permissions requirements. Users who >>>> care about security won't want to grant every privilege given by a >>>> pg_monitor role to a tool that only needs a subset of those >>>> privileges. >>>=20 >>> The upshot of this would be that every time there's a database server >>> upgrade that changes the permissions required somehow, the user has to >>> login to every server they have and run a script. It is no longer a >>> one-time thing, which makes it vastly more painful to deal with >>> upgrades. >>=20 >> So, I might be all wet here, but I would have expected that changes on >> the TOOL side would be vastly more frequent. I mean, we do not change >> what a certain builtin permission does very often. If we add >> pg_read_all_settings, what is the likelihood that the remit of that >> role is ever going to change? I would judge that was is vastly more >> likely is that a new version of some tool would start needing that >> privilege (or some other) where it didn't before. If that happens, >> and the script is on the tool side, then you just add a new line to >> the script. If the script is built into initdb, then you've got to >> wait for the next major release before you can update the definition >> of pg_monitor - and maybe argue with other tool authors with different >> requirements. >=20 > The expectation here is that the pg_monitor role will include all of the > reasonable privileges in a given release that a monitor tool should be > using. Exactly. >=20 > While it's likely that monitoring tools will not all be able to work > with every function they would then have access to on day 1, I'm sure > the goal for all of them will be to reach the point where they are using > all of the functions and tables they then have access to. Right - and we have discussed here, in at least one developer meeting, and = with the tools team at EDB what should be included, so I'm confident we hav= e a solid starting point that would be generally useful. >=20 > Moving forward, the privileges being added in future versions of PG (the > ones you point out as happening at initdb-time) would be only those > which are associated with new features in those later versions of PG. > Those new features aren't going to be back-patched and therefore it > wouldn't be possible for the tool to provide a script to GRANT access to > those new features which would work on older versions of PG, meaning > that the script you suggest would necessairly be PG-version specific. Indeed. Another issue with having the admin run a script is that any new databases = created from template0 or the default template1, may all need the script to= be run at that point. Admin tools that can automatically and immediately s= tart monitoring new databases may need manual admin/dbowner intervention wh= ich could be extremely painful in large environments. I believe this and other reasons we've described are exactly why other DBMS= ' do what we're proposing. >=20 > In other words, I don't believe this is a valid concern. >=20 >> So I'm fine with this: >>=20 >> - if (tblspcOid !=3D MyDatabaseTableSpace) >> + if (tblspcOid !=3D MyDatabaseTableSpace && >> + !is_member_of_role(GetUserId(), DEFAULT_ROLE_READ_ALL_STATS)) >>=20 >> But I don't like this: >>=20 >> +GRANT EXECUTE ON FUNCTION pgstattuple(text) TO pg_read_all_stats; >=20 > I believe we understood that to be the case. I don't object to the > clarification, of course. >=20 >> My position is that execute permission on a function is already >> grantable, so granting it by default to a built-in role is just >> removing flexibility which would otherwise be available to the user. >=20 > To remove flexibility would require that we remove the ability to > independently GRANT that right. We are not doing that. Nor are we > taking anything away from the user by added a new default role- we > already claimed the pg_ namespace for roles in 9.6. Right - and if a user doesn't like it, they can easily just not use the def= ault role and create their own alternative instead. From a usability perspective, I cannot see any downsides to the default rol= es as proposed. They take nothing away from the users that don't want/need = them, and add significant convenience for those that do. --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers