Re: strange problem with not existing roles

From: "ludwig(at)kni-online(dot)de" <ludwig(at)kni-online(dot)de>
To: "Adrian Klaver" <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: strange problem with not existing roles
Date: 2014-09-18 11:12:48
Message-ID: trinity-52f8ef48-0d1f-497e-8639-b05379ddb958-1411038768282@3capp-1and1-bs01
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div>Hi Adrian,</div>

<div>data got into the database with normal update/insert-queries from logged-in database-users using &quot;normal&quot; PG-Users/roles,</div>

<div>the &quot;ghost-roles&quot; (with these unusual numerical role-names) were never created by me, I don&#39;t know where they come from.</div>

<div>&nbsp;</div>

<div>The query</div>

<div>[SNIP]</div>

<div>SELECT * FROM pg_catalog.pg_auth_members WHERE member in (&#39;243683&#39;,&#39;243666&#39;,&#39;243689&#39;,&#39;482499&#39;,&#39;482499&#39;,&#39;17708&#39;);</div>

<div>[/SNIP]</div>

<div>&nbsp;</div>

<div>has the following result:</div>

<div>[SNIP]</div>

<div>roleid;member;grantor;admin_option;</div>

<div>
<div>17699;17708;10;f<br/>
17699;482499;17687;f<br/>
17701;243666;17687;f<br/>
17699;243683;17687;f<br/>
17710;243689;17687;f</div>
</div>

<div>[/SNIP]</div>

<div>&nbsp;</div>

<div>Yust a thought:</div>

<div>In some schemas the public user has full default-privileges (it&#39;s for uploading GIS-data from Shapefiles, each uploaded file generates a new table).</div>

<div>[SNIP]</div>

<div>ALTER DEFAULT PRIVILEGES IN SCHEMA user_data<br/>
&nbsp;&nbsp;&nbsp; GRANT INSERT, SELECT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER ON TABLES<br/>
&nbsp;&nbsp;&nbsp; TO public;</div>

<div>
<div>[/SNIP]</div>

<div>&nbsp;</div>

<div>Another thought:</div>

<div>Each &quot;normal&quot; DB-user has *one* granted role, but some of theses roles themselves can have mutliple granted subroles.</div>

<div>&nbsp;</div>

<div>Perhaps a reason for my problems?</div>

<div>&nbsp;</div>

<div>Ludwig</div>

<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"><b>Gesendet:</b>&nbsp;Mittwoch, 17. September 2014 um 17:33 Uhr<br/>
<b>Von:</b>&nbsp;&quot;Adrian Klaver&quot; &lt;adrian(dot)klaver(at)aklaver(dot)com&gt;<br/>
<b>An:</b>&nbsp;&quot;ludwig(at)kni-online(dot)de&quot; &lt;ludwig(at)kni-online(dot)de&gt;, pgsql-general(at)postgresql(dot)org<br/>
<b>Betreff:</b>&nbsp;Re: [GENERAL] strange problem with not existing roles</div>

<div name="quoted-content">On 09/17/2014 08:08 AM, ludwig(at)kni-online(dot)de wrote:<br/>
&gt; Hi list,<br/>
&gt; I have a strange problem in postgres (PostgreSQL 9.3.1, compiled by<br/>
&gt; Visual C++ build 1600, 64-bit), there are granted privileges on schemas,<br/>
&gt; tables, columns for roles that don&#39;t exist.<br/>
<br/>
So how did the data get into the database?<br/>
<br/>
&gt;<br/>
&gt; Example:<br/>
&gt; In pgAdmin for schema user_data the follwing wrong grants are reported:<br/>
&gt; ...<br/>
&gt; GRANT ALL ON SCHEMA user_data TO &quot;482499&quot;;<br/>
&gt; GRANT ALL ON SCHEMA user_data TO &quot;17708&quot;;<br/>
<br/>
Where these actual roles at some point in time?<br/>
<br/>
&gt; ...<br/>
&gt;<br/>
&gt; Problem is:<br/>
&gt; - these roles don&#39;t exist,<br/>
&gt; - they can&#39;t be dropped (DROP ROLE &quot;482499&quot;; =&gt; FEHLER: Rolle &bdquo;482499&ldquo;<br/>
&gt; existiert nicht)<br/>
&gt; - grants can&#39;t be revoked (REVOKE ALL ON SCHEMA &quot;user_data&quot; FROM<br/>
&gt; &quot;482499&quot;; =&gt; FEHLER: Rolle &bdquo;482499&ldquo; existiert nicht)<br/>
&gt; - ROLES can be recreated and dropped afterwards, but the grants persists:<br/>
&gt; CREATE ROLE &quot;482499&quot;;<br/>
&gt; DROP OWNED BY &quot;482499&quot;;<br/>
&gt; REVOKE CONNECT ON DATABASE &quot;wver_ims&quot; FROM &quot;482499&quot;;<br/>
&gt; REVOKE ALL ON SCHEMA &quot;user_data&quot; FROM &quot;482499&quot;;<br/>
&gt; DROP ROLE &quot;482499&quot;;<br/>
&gt; - new tables can&#39;t be created in schemas with these grants<br/>
&gt; CREATE TABLE user_data.test<br/>
&gt; (<br/>
&gt; id serial,<br/>
&gt; PRIMARY KEY (id)<br/>
&gt; );<br/>
&gt; =&gt; FEHLER: Rolle 17708 wurde gleichzeitig gel&ouml;scht<br/>
&gt;<br/>
&gt;<br/>
&gt; The roles are not listed in any catalog<br/>
&gt; SELECT * FROM information_schema.xxxxxxx WHERE grantee in<br/>
&gt; (&#39;243683&#39;,&#39;243666&#39;,&#39;243689&#39;,&#39;482499&#39;,&#39;482499&#39;,&#39;17708&#39;);<br/>
&gt;<br/>
&gt; Only in pg_auth_members there is a set for each of these roles:<br/>
&gt; SELECT * FROM pg_catalog.pg_auth_members WHERE member in<br/>
&gt; (&#39;243683&#39;,&#39;243666&#39;,&#39;243689&#39;,&#39;482499&#39;,&#39;482499&#39;,&#39;17708&#39;);<br/>
<br/>
What does pg_auth_members show for the problem roles?<br/>
<br/>
&gt; What can I do to get rid of these roles and grants?<br/>
&gt; Ludwig<br/>
<br/>
<br/>
--<br/>
Adrian Klaver<br/>
adrian(dot)klaver(at)aklaver(dot)com<br/>
<br/>
<br/>
--<br/>
Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)<br/>
To make changes to your subscription:<br/>
<a href="http://www.postgresql.org/mailpref/pgsql-general" target="_blank">http://www.postgresql.org/mailpref/pgsql-general</a></div>
</div>
</div>
</div></div></body></html>

Attachment Content-Type Size
unknown_filename text/html 4.9 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dev Kumkar 2014-09-18 12:50:59 Re: [GENERAL] pg_multixact issues
Previous Message Andres Freund 2014-09-18 10:33:38 Re: [SQL] pg_multixact issues