Re: allowing privileges on untrusted languages - Mailing list pgsql-hackers

From Kohei KaiGai
Subject Re: allowing privileges on untrusted languages
Date
Msg-id CADyhKSUXXVbswozzfP7ZCAyfx9La6q-HWvnu43Xemjz4Z+XOxQ@mail.gmail.com
Whole thread Raw
In response to Re: allowing privileges on untrusted languages  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: allowing privileges on untrusted languages
List pgsql-hackers
2013/1/20 Tom Lane <tgl@sss.pgh.pa.us>:
> Robert Haas <robertmhaas@gmail.com> writes:
>> Yeah.  We'd need to think a little bit about how to make this work,
>> since I think that adding a gajillion booleans to pg_authid will not
>> make anyone very happy.  But I like the idea.  GRANT
>> kill_sessions_of_other_users TO bob?  GRANT install_untrusted_pls TO
>> any_database_owner?  GRANT install_an_extension_called(hstore) TO
>> any_database_owner?  I know there are other ways of doing all of these
>> things, so don't take the specific proposals too seriously, but we
>> clearly have a need to parcel out controlled bits of the superuser
>> mojo to individual users in a nice, clean, convenient way.  Getting
>> agreement on the details is likely to be difficult, but it seems like
>> a good concept from 10,000 feet.
>
> The traditional answer to that, which not only can be done already in
> all existing releases but is infinitely more flexible than any
> hard-wired scheme we could implement, is that you create superuser-owned
> security-definer functions that can execute any specific operation you
> want to allow, and then GRANT EXECUTE on those functions to just the
> people who should have it.
>
I also agree it is a right solution to provide unprivileged users a trusted
way to handle privileged operations, as set-uid programs are widely
utilized for same purpose on operating system, however, it needs to
satisfy an assumption these trusted procedures have to be free from
bugs and vulnerabilities. In general, it is not an easy assumption.
Thus, it is the reason why fine-grained capability is preferred than
root as single-point-of-failure on security. For example, now /bin/ping
has no set-uid bit on recent Fedora system, to avoid a risk when this
program has any vulnerability.
 [kaigai@iwashi ~]$ ls -l /bin/ping -rwxr-xr-x. 1 root root 40880 Dec  7 15:19 /bin/ping [kaigai@iwashi ~]$ getcap
/bin/ping/bin/ping = cap_net_admin,cap_net_raw+ep
 

I think, our situation is similar. If DBA is not 100% certain on safeness
of self-defined functions, I believe he want unprivileged users to call
security-definer functions owned by limited capable user, instead of
fully capable superuser.

I'm not positive to over-interpret this concept, like hundred of capabilities
being nightmare of maintenance. However, it is worthwhile as basis
of self-defined security-definer functions.
I'd like people to imagine a case when trusted procedures were buggy.

Thanks,
-- 
KaiGai Kohei <kaigai@kaigai.gr.jp>



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Re: COPY FREEZE has no warning
Next
From: "Karl O. Pinc"
Date:
Subject: Re: Doc patch, normalize search_path in index