All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eamon Walsh <ewalsh@tycho.nsa.gov>
To: KaiGai Kohei <kaigai@ak.jp.nec.com>
Cc: Joshua Brindle <jbrindle@tresys.com>,
	"Christopher J. PeBenito" <cpebenito@tresys.com>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	selinux@tycho.nsa.gov
Subject: Re: [PATCH]	libselinux:	add	support	for	/contexts/postgresql_contexts
Date: Thu, 05 Jun 2008 14:09:13 -0400	[thread overview]
Message-ID: <48482BC9.10708@tycho.nsa.gov> (raw)
In-Reply-To: <48473C35.4060102@ak.jp.nec.com>

KaiGai Kohei wrote:
> Joshua Brindle wrote:
>   
>> KaiGai Kohei wrote:
>>     
>>> Christopher J. PeBenito wrote:
>>>       
>> <snip>
>>
>>     
>>> In addition, I found an unclear point which came from my original policy. :(
>>>
>>>   allow sepgsql_unconfined_type postgresql_t:db_blob { import export };
>>>
>>> A blob import interface enables to read a file on a server host by the server
>>> process (postgresql_t), and import to database as several frames of largeobject.
>>> A export interface works for inversed direction.
>>>
>>> In the previous discussion, the meaning of these permission is to indicate
>>> server process to start importing or exporting.
>>> However, I'm now considering the following rules are more sensefull:
>>>
>>>   1. SE-PostgreSQL checks whether the client has db_blob:{import} for
>>>      the target large object.
>>>       
>
> db_blob:{write} is also checked here...
>
>   
>>>   2. SE-PostgreSQL checks whether the client has file:{read} for
>>>      the target file.
>>>   3. SELinux (kernel) checks whether postgresql_t has file:{read} for the
>>>      target file, because it uses read(2) system call.
>>>
>>> Could you tell me your opinion?
>>>       
>> Chris asked me to look at this for him. The access checks above seem completely
>> reasonable to me, much better than the previous check.
>>
>> I wonder though, how you'll do an export check between the client and file type,
>> since a compute_create between the client and the target directory may be different
>> than between postgresql_t and the directory? Which context would you attempt to use?
>>     
>
> In export case, the target file is labeled as a newly created one between
> postgresql_t and its parent directly, as SELinux attaches in default.
>
> We can understand the behavior as PostgreSQL owns this file and delivers
> its file descriptor to the client. Thus, the client should be checked
> the file:{write} permission for the result of compute_create between
> postgresql_t and the parent directly.
>   

Doesn't the kernel handle this automatically? Which is to say, if you
give a file descriptor to another process (I'm assuming it gets passed
through the local socket), the kernel still checks read and write on
every access.



> It does not give us any mismatching between DAC and MAC.
> So, I think it is more suitable than using setfscreatecon() to force the
> result between the client and the parent directly.
>
> In the conclusion, the following permissions will be checked for blob export.
>
> 1. SELinux (kernel) checks file:{write} between postgresql_t and the newly
>    created file which is labeled as the result between postgresql_t and
>    the parent directory.
>    This file is owned by PostgreSQL in DAC world.
> 2. SE-PostgreSQL checks db_blob:{export read} between the client and the target
>    large object.
> 3. SE-PostgreSQL checks file:{write} between the client and the target file.
>
> Thanks,
>   


-- 
Eamon Walsh <ewalsh@tycho.nsa.gov>
National Security Agency


--
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:[~2008-06-05 18:09 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-26 10:30 [PATCH] libselinux: add support for /contexts/postgresql_contexts KaiGai Kohei
2008-05-27 17:14 ` Stephen Smalley
2008-05-27 17:55   ` Christopher J. PeBenito
2008-05-27 18:34     ` Stephen Smalley
2008-05-27 18:55       ` Christopher J. PeBenito
2008-05-27 19:59         ` Stephen Smalley
2008-05-27 20:15         ` Eamon Walsh
2008-05-28 13:24           ` Christopher J. PeBenito
2008-05-29 18:05             ` Eamon Walsh
2008-05-29 18:20               ` Christopher J. PeBenito
2008-05-30  0:22                 ` Eamon Walsh
2008-05-30 12:27                   ` Christopher J. PeBenito
2008-06-02 10:27                     ` KaiGai Kohei
2008-06-02 17:31                       ` Eamon Walsh
2008-06-02 18:39                         ` Christopher J. PeBenito
2008-06-03 10:25                           ` KaiGai Kohei
2008-06-03 12:37                             ` Christopher J. PeBenito
2008-06-04  4:03                               ` KaiGai Kohei
2008-06-04 14:19                                 ` Joshua Brindle
2008-06-05  1:07                                   ` KaiGai Kohei
2008-06-05 18:09                                     ` Eamon Walsh [this message]
2008-06-06  5:32                                       ` KaiGai Kohei
2008-06-04 14:32                                 ` Christopher J. PeBenito
2008-06-05  1:18                                   ` KaiGai Kohei
2008-06-05 13:35                                     ` Chris PeBenito
2008-06-06  5:21                                       ` KaiGai Kohei
2008-06-09  3:07                                         ` KaiGai Kohei
2008-06-10 18:09                                           ` Christopher J. PeBenito
2008-06-13 10:39                                             ` KaiGai Kohei
2008-06-13 13:37                                               ` Christopher J. PeBenito
2008-06-18  6:53                                                 ` KaiGai Kohei
2008-06-18 13:41                                                   ` Christopher J. PeBenito
2008-06-20  6:48                                                     ` KaiGai Kohei
2008-06-23 12:35                                                       ` Christopher J. PeBenito
2008-06-23 12:48                                                         ` KaiGai Kohei
2008-06-23 12:56                                                           ` Christopher J. PeBenito
2008-06-24  2:35                                                             ` KaiGai Kohei
2008-06-24 12:56                                                               ` Christopher J. PeBenito
2008-05-28  1:49         ` KaiGai Kohei
2008-05-28 12:56           ` Christopher J. PeBenito
2008-05-28 16:12             ` KaiGai Kohei
2008-05-28  1:13       ` KaiGai Kohei
2008-05-28 15:12         ` Stephen Smalley
2008-05-28 16:18           ` KaiGai Kohei
2008-05-28  2:49   ` 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=48482BC9.10708@tycho.nsa.gov \
    --to=ewalsh@tycho.nsa.gov \
    --cc=cpebenito@tresys.com \
    --cc=jbrindle@tresys.com \
    --cc=kaigai@ak.jp.nec.com \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.