All of lore.kernel.org
 help / color / mirror / Atom feed
From: KaiGai Kohei <kaigai@ak.jp.nec.com>
To: Eamon Walsh <ewalsh@tycho.nsa.gov>
Cc: Joshua Brindle <method@manicmethod.com>,
	Andy Warner <warner@rubix.com>, selinux <selinux@tycho.nsa.gov>
Subject: Re: Some ideas in SE-PostgreSQL enhancement (Re: The status of SE-PostgreSQL)
Date: Thu, 07 May 2009 10:34:56 +0900	[thread overview]
Message-ID: <4A023AC0.9080207@ak.jp.nec.com> (raw)
In-Reply-To: <49FA80A2.7060804@tycho.nsa.gov>

Sorry for late reply due to the spring vacation season in Japan.

>>> But let's step back and take a look at how the file system uses file
>>> contexts. Files are labeled in three ways:
>>>
>>> 1. The normal, preferred way, through a type transition on a subject
>>> (domain) and target (parent directory). The database analog to this:
>>> through a type transition on a subject (domain) and target (parent
>>> table, schema, or other object).
>>>     
>> Yes, we can basically cover all the database object which have its
>> parent object. But the root database obejct does not have its parent.
>> It is the first issue.
>>   
> 
> How are databases stored on disk? Is there a file or directory that
> could serve as the parent object?

In PostgreSQL, all the database files are indeed stored in a single root
directory ($PGDATA), however, it depends on the current implementation.

>>> 2. For files that are NOT persistent, such as /proc and /sys, by
>>> genfscon rules, which are basically the same as file_contexts. So if
>>> there are non-persistent database objects (such as the pg_temp
>>> mentioned) and there really is no parent object to label from in a type
>>> transition, using selabel lookups could make sense.
>>>     
>> I think the setfscreatecon is better analogy than the genfscon.
>>   
> 
> I don't agree here - setfscreatecon is analogous to SECURITY_LABEL=xxx,
> where the client (not the object manager) can override the default
> context for its own purposes. Label lookups, on the other hand, come
> from a fixed configuration file in /etc/selinux and they are done by the
> object manager, not the client. It's more like a matchpathcon() or a
> genfscon.
> 
> That said, I don't have a strong objection to this and I do think the
> selabel support has some valid uses for Postgres.

Hmm... it seems to me you are correct.
This behavior of selbalel_lookup() may not have appropriate analogy in
filesystem.

>> A schema object is deployed under a database object, so we can compute
>> a default security context using type transition rules, but I also want
>> to set a characteristic default on pg_temp due to its feature.
>> It is the second issue how individual security contexts can be set on
>> objects within same object class.
>> 
> 
> SE-Postgres should be able to detect when a temp table is being created
> and only do the selabel lookup in that case.
> 
> Actually, if the temp tables are visible to other clients you may need
> to do an selabel lookup followed by a type transition. Such as
> temp_schema_t (from lookup) -> type transition -> user_temp_schema_t.
> Otherwise the temp table could be accessible to other domains. Another
> alternative would be to use UBAC. If the temp table is not shared
> between sessions then it doesn't matter.

It seems to me this kind of special case handling can give us confusion...

>> (Or, defines db_schema_temp class? I'm not sure whether other DBMSs
>> shares the concept of schamas to store temporary objects.)
>>   
> 
> This may work. Whether to define a separate object class depends on the
> complexity it would add to the policy writing and object manager code,
> versus looking it up in selabel. I wouldn't worry about whether other
> DBMS would use the class. If they don't need it they can simply ignore it.

Indeed, we discussed about differences between SE-PostgreSQL and
RUBIX before, and agreed to ignore db_catalog class in SE-PostgreSQL.

At least, it has a benefit compared to selabel in UBAC handling,
so it might be necessary to consider the option.

>> The selabel_lookup(3) for database tries to solve two issues in same time.
>> The one is the default to the root of database objects which does not have
>> any parent object. The other is also the default to certain characteristic
>> objects.
>> If we can consider the selabel as analogy of setfscreatecon (automatically
>> set up) for the second issue, I don't think its priority should be moved
>> to the behind of type transition.
>>
>> An aside, the pg_temp schema is implicitly created when CREATE TEMP TABLE
>> statement is given, so we cannot apply SECURITY_LABEL=xxx here. :(
>>   
> 
> Understood.
> 
> I'll probably push the patch next week sometime, unless I hear otherwise.

Please wait for a while.

As I noted before, the selabel patch tries to solve two matters.
 - The default label for db_database class.
 - The default label for temporary schame.

If we can have db_schema_temp class, the only remaining matter is the default
in db_database class. It can be solved using a file which store a default label
for SE-PostgreSQL's db_database objects, as if run_init uses initrc_context.

It makes sense for me, and clear its behavior from the viewpoint of the analogy.

Thanks,
-- 
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2009-05-07  1:34 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 10:37 The status of SE-PostgreSQL KaiGai Kohei
2009-03-23 10:37 ` [refpolicy] " KaiGai Kohei
2009-03-23 14:56 ` Shaz
2009-03-23 14:57   ` Shaz
2009-03-23 15:19 ` Andy Warner
2009-03-24  2:14   ` KaiGai Kohei
2009-03-24  2:14     ` [refpolicy] " KaiGai Kohei
2009-03-25  6:54     ` Some ideas in SE-PostgreSQL enhancement (Re: The status of SE-PostgreSQL) KaiGai Kohei
2009-03-25  6:54       ` [refpolicy] " KaiGai Kohei
2009-03-25  7:45       ` Andy Warner
2009-03-25  8:20         ` KaiGai Kohei
2009-03-25  8:59           ` Andy Warner
2009-03-25 12:00             ` KaiGai Kohei
2009-03-25 17:02               ` Andy Warner
2009-03-26  0:13                 ` KaiGai Kohei
2009-03-25 17:43         ` Joshua Brindle
2009-03-25 19:42           ` Andy Warner
2009-03-27 15:43             ` Joshua Brindle
2009-03-27 16:25               ` Andy Warner
2009-03-27 17:15                 ` Joshua Brindle
2009-03-27 17:54                   ` Andy Warner
2009-03-27 18:12                     ` Joshua Brindle
2009-03-27 18:48                       ` Andy Warner
2009-03-27 19:53                         ` Joshua Brindle
2009-03-27 20:04                           ` Andy Warner
2009-03-27 23:59                           ` KaiGai Kohei
2009-03-28  7:17                             ` Andy Warner
2009-03-30  0:56                               ` KaiGai Kohei
2009-03-30  8:21                                 ` KaiGai Kohei
2009-03-30  9:58                                   ` Andy Warner
2009-03-30 13:22                                     ` KaiGai Kohei
2009-04-22  0:08                                   ` Eamon Walsh
2009-04-22  3:59                                     ` KaiGai Kohei
2009-05-01  4:54                                       ` Eamon Walsh
2009-05-07  1:34                                         ` KaiGai Kohei [this message]
2009-05-07  7:24                                           ` KaiGai Kohei
2009-03-30  9:49                                 ` Andy Warner
2009-03-26  5:50       ` [PATCH] Expose avc_netlink_loop() for applications (Re: Some ideas in SE-PostgreSQL enhancement) KaiGai Kohei
2009-03-26 23:28         ` Eamon Walsh
2009-03-26 23:41         ` Eamon Walsh
2009-03-27  0:35           ` KaiGai Kohei
2009-03-28  0:54             ` Eamon Walsh
2009-03-28  2:00               ` KaiGai Kohei
2009-03-30  4:56                 ` KaiGai Kohei
2009-03-26  6:11       ` [PATCH] database audit integration " KaiGai Kohei
2009-03-26  6:11         ` KaiGai Kohei
2009-03-26 21:45         ` John Dennis
     [not found]         ` <49CB313B.7020507@redhat.com>
2009-03-27  2:34           ` KaiGai Kohei
2009-03-27  2:34             ` KaiGai Kohei
2009-03-26  8:29       ` [PATCH] Permissive domain in userspace " KaiGai Kohei
2009-03-28  2:41         ` Eamon Walsh
2009-03-30  2:55           ` KaiGai Kohei
2009-03-31  1:45             ` KaiGai Kohei
2009-03-31 16:46               ` Stephen Smalley
2009-04-01  1:07                 ` [PATCH] Permissive domain in userspace object manager KaiGai Kohei
2009-04-01  1:41                   ` KaiGai Kohei
2009-04-01 12:34                   ` Stephen Smalley
2009-04-01 20:07                     ` Eric Paris
2009-04-01 22:53                   ` James Morris
2009-03-27  8:18       ` [PATCH] Policy rework for SE-PostgreSQL (Re: Some ideas in SE-PostgreSQL enhancement) KaiGai Kohei
2009-03-27  8:18         ` [refpolicy] " KaiGai Kohei
2009-03-27  9:44         ` Andy Warner
2009-03-27 11:20           ` KaiGai Kohei
2009-03-27 11:20             ` [refpolicy] " KaiGai Kohei
2009-03-27 11:45             ` Andy Warner
2009-03-27 11:45               ` [refpolicy] " Andy Warner
2009-03-27 12:17               ` KaiGai Kohei
2009-03-27 12:17                 ` [refpolicy] " KaiGai Kohei
2009-04-01  7:26       ` Correct manner to handler undefined classes/permissions? " KaiGai Kohei
2009-04-01 12:45         ` Stephen Smalley
2009-04-02  0:28           ` KaiGai Kohei
2009-03-23 15:25 ` The status of SE-PostgreSQL Stephen Smalley
2009-03-23 15:25   ` [refpolicy] " Stephen Smalley
2009-03-24  1:13   ` KaiGai Kohei
2009-03-24  1:13     ` [refpolicy] " KaiGai Kohei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A023AC0.9080207@ak.jp.nec.com \
    --to=kaigai@ak.jp.nec.com \
    --cc=ewalsh@tycho.nsa.gov \
    --cc=method@manicmethod.com \
    --cc=selinux@tycho.nsa.gov \
    --cc=warner@rubix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.