Re: [sepgsql 2/3] Add db_schema:search permission checks - Mailing list pgsql-hackers

From Kohei KaiGai
Subject Re: [sepgsql 2/3] Add db_schema:search permission checks
Date
Msg-id CADyhKSX5K14wiMa8mavbb8-NC9s-jQ=W_gUjBpEbOyAfqKdL4Q@mail.gmail.com
Whole thread Raw
In response to Re: [sepgsql 2/3] Add db_schema:search permission checks  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: [sepgsql 2/3] Add db_schema:search permission checks
List pgsql-hackers
2013/1/29 Simon Riggs <simon@2ndquadrant.com>:
> On 15 January 2013 20:28, Kohei KaiGai <kaigai@kaigai.gr.jp> wrote:
>
>> This patch adds sepgsql support for permission checks equivalent
>> to the existing SCHEMA USE privilege.
>>
>> This feature is constructed on new OAT_SCHEMA_SEARCH event
>> type being invoked around pg_namespace_aclcheck().
>
> Can you explain the exact detailed rationale behind this patch? Like
> URLs or other info that explains *why* we are doing this, what
> problems it causes if we don't, etc?
>
Sorry for this inconvenient. The second and third sepgsql patch try to
add permission checks on the places being not covered by sepgsql,
even though we defined related permissions; search of db_schema
and execute of db_procedure.

It is unavailable to control user's access towards these objects from
perspective of selinux policy, without these patches, even though
existing DAC mechanism well controls.

Right now, sepgsql applies no checks when users tried to lookup
an object name underlying a particular schema. It is inconvenient
to set up an environment that enforces per-domain namespace
according to the selinux basis, because current sepgsql ignores
searching schema, thus, it means all the schema is allowed to
search from viewpoint of selinux.
What we want to do is almost same as existing permission checks
are doing when users tried to search a particular schema, except
for its criteria to make access control decision.

Also, sepgsql applies no checks when users tries to execute
functions, right now. It makes unavailable to control execution of
functions from viewpoint of selinux, and here is no way selinux
to prevent to execute functions defined by other domains, or
others being not permitted.
Also, what we want to do is almost same as existing permission
checks, except for its criteria to make access control decision.

SELinux model requires client domain has db_schema:{search}
permission when it tries to search its underlying objects, and
client domain has db_procedure:{execute} permission when
it tries to execute the function and db_procedure:{entrypoint}
additionally if this execution performs as entrypoint of trusted-
procedures.

These are the problems behind of these patches.
In short, I'd like to give sepgsql configuration more flexibility
as existing DAC doing. That helps use cases of typical SaaS
applications that shares a database with multiple clients but
to be separated each other.

It is the motivation why I'd like to add these permissions here.

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



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_ctl idempotent option
Next
From: Stephen Frost
Date:
Subject: Re: Hm, table constraints aren't so unique as all that