All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christopher J. PeBenito" <cpebenito@tresys.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: HarryCiao <harrytaurus2002@hotmail.com>,
	paul.moore@hp.com, selinux-mailing-list <selinux@tycho.nsa.gov>,
	refpolicy-mailing-list <refpolicy@oss1.tresys.com>
Subject: Re: Separate type for AF_UNIX socket created by syslogd_t
Date: Thu, 24 Feb 2011 10:52:26 -0500	[thread overview]
Message-ID: <4D667EBA.3060205@tresys.com> (raw)
In-Reply-To: <1298554512.31953.38.camel@moss-pluto>

On 02/24/11 08:35, Stephen Smalley wrote:
> On Thu, 2011-02-24 at 10:44 +0000, HarryCiao wrote:
>> Since syslogd_t runs at mls_systemhigh, both the /dev/log file and the
>> unix_dgram_socket object bond to it are of mls_systemhigh, rendering
>> that other application domain such as klogd_t running at lower
>> security level failed to "sendto" it. One possible solution is to add
>> syslogd_t to mlstrustedobject attribute since the unix_dgram_socket
>> object inherits the creator's SID by default.
>>
>> However, the side effect is that syslogd_t is also the label for the
>> entire syslogd's procfs entries. The attached two patches are aimed to
>> resolve this problem while eliminating such side effect, by declaring
>> a separate type, syslogd_s_t,  for the unix_dgram_socket object
>> created by syslogd_t which alone could be added to the
>> mlstrustedobject attribute.
>>
>> Thanks to Stephen's suggestion security_transition_sid() would be
>> called in socket_sockcreate_sid() to query the relevant
>> type_transition rule say in logging.pp for any newly created socket.
>>
>> After applying th! ese two patches below errors don't exist any more:
>>
>> type=1400 audit(1298535101.654:868): avc:  denied  { sendto } for
>> pid=385 comm="klogd" path="/dev/log"
>> scontext=system_u:object_r:klogd_t:s0
>> tcontext=system_u:object_r:syslogd_t:s15:c0.c1023
>> tclass=unix_dgram_socket
>>
>> BTW, do we have a way to actually display the label for the
>> unix_dgram_socket that bond to /dev/log?
>>
[cut]
> Unfortunately my original "simple" suggestion turns out to have side
> effects. At present, the socket gets the same exact security context as
> the creating process by default, including the role and MLS range, since
> we just assign the SID directly.  But when using security_transition_sid
> -> security_compute_sid, the new security context uses object_r as the
> role for all objects and mls_compute_sid degrades the full MLS range to
> the low level for objects. This is based on the desired behavior for
> files and didn't take into account sockets.  Thus with your patch,
> sockets will no longer be labeled identically to their creating process,
> which will affect labeled networking and the network access controls.
> 
> To preserve existing behavior when there are no type transition rules
> configured for sockets, I think security_compute_sid and mls_compute_sid
> need logic handling the socket classes differently than other objects
> (files).  And given that we are using dynamic class mappings now, those
> socket class values would have to be looked up just like the process
> class upon policy load.  Maybe we can come up with some generalized
> solution that will be more flexible going forward for configuring how
> different parts of the context are assigned for different classes.  We
> have talked previously about using the role field even for files rather
> than just making them all object_r.

It certainly would be nice to have all objects get the role of their
creator so we can bring role-based policy separations back using RBAC
features and not rely on 1:1 user:role mapping + UBAC.


-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.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.

WARNING: multiple messages have this Message-ID (diff)
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] Separate type for AF_UNIX socket created by syslogd_t
Date: Thu, 24 Feb 2011 10:52:26 -0500	[thread overview]
Message-ID: <4D667EBA.3060205@tresys.com> (raw)
In-Reply-To: <1298554512.31953.38.camel@moss-pluto>

On 02/24/11 08:35, Stephen Smalley wrote:
> On Thu, 2011-02-24 at 10:44 +0000, HarryCiao wrote:
>> Since syslogd_t runs at mls_systemhigh, both the /dev/log file and the
>> unix_dgram_socket object bond to it are of mls_systemhigh, rendering
>> that other application domain such as klogd_t running at lower
>> security level failed to "sendto" it. One possible solution is to add
>> syslogd_t to mlstrustedobject attribute since the unix_dgram_socket
>> object inherits the creator's SID by default.
>>
>> However, the side effect is that syslogd_t is also the label for the
>> entire syslogd's procfs entries. The attached two patches are aimed to
>> resolve this problem while eliminating such side effect, by declaring
>> a separate type, syslogd_s_t,  for the unix_dgram_socket object
>> created by syslogd_t which alone could be added to the
>> mlstrustedobject attribute.
>>
>> Thanks to Stephen's suggestion security_transition_sid() would be
>> called in socket_sockcreate_sid() to query the relevant
>> type_transition rule say in logging.pp for any newly created socket.
>>
>> After applying th! ese two patches below errors don't exist any more:
>>
>> type=1400 audit(1298535101.654:868): avc:  denied  { sendto } for
>> pid=385 comm="klogd" path="/dev/log"
>> scontext=system_u:object_r:klogd_t:s0
>> tcontext=system_u:object_r:syslogd_t:s15:c0.c1023
>> tclass=unix_dgram_socket
>>
>> BTW, do we have a way to actually display the label for the
>> unix_dgram_socket that bond to /dev/log?
>>
[cut]
> Unfortunately my original "simple" suggestion turns out to have side
> effects. At present, the socket gets the same exact security context as
> the creating process by default, including the role and MLS range, since
> we just assign the SID directly.  But when using security_transition_sid
> -> security_compute_sid, the new security context uses object_r as the
> role for all objects and mls_compute_sid degrades the full MLS range to
> the low level for objects. This is based on the desired behavior for
> files and didn't take into account sockets.  Thus with your patch,
> sockets will no longer be labeled identically to their creating process,
> which will affect labeled networking and the network access controls.
> 
> To preserve existing behavior when there are no type transition rules
> configured for sockets, I think security_compute_sid and mls_compute_sid
> need logic handling the socket classes differently than other objects
> (files).  And given that we are using dynamic class mappings now, those
> socket class values would have to be looked up just like the process
> class upon policy load.  Maybe we can come up with some generalized
> solution that will be more flexible going forward for configuring how
> different parts of the context are assigned for different classes.  We
> have talked previously about using the role field even for files rather
> than just making them all object_r.

It certainly would be nice to have all objects get the role of their
creator so we can bring role-based policy separations back using RBAC
features and not rely on 1:1 user:role mapping + UBAC.


-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

  reply	other threads:[~2011-02-24 15:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 10:44 Separate type for AF_UNIX socket created by syslogd_t HarryCiao
2011-02-24 10:44 ` [refpolicy] " HarryCiao
2011-02-24 13:35 ` Stephen Smalley
2011-02-24 13:35   ` [refpolicy] " Stephen Smalley
2011-02-24 15:52   ` Christopher J. PeBenito [this message]
2011-02-24 15:52     ` Christopher J. PeBenito
2011-02-26  3:29     ` HarryCiao
2011-02-26  3:29       ` [refpolicy] " HarryCiao
2011-03-04 10:38     ` Further questions about configuring contexts differently for variant classes HarryCiao
2011-03-04 10:38       ` [refpolicy] " HarryCiao
2011-03-04 10:57       ` Russell Coker
2011-03-04 13:46       ` Christopher J. PeBenito
2011-03-04 13:46         ` [refpolicy] " Christopher J. PeBenito
2011-03-04 14:04       ` Stephen Smalley
2011-03-04 14:04         ` [refpolicy] " Stephen Smalley
2011-02-24 18:18 ` Separate type for AF_UNIX socket created by syslogd_t Stephen Smalley
2011-02-24 18:18   ` [refpolicy] " Stephen Smalley

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=4D667EBA.3060205@tresys.com \
    --to=cpebenito@tresys.com \
    --cc=harrytaurus2002@hotmail.com \
    --cc=paul.moore@hp.com \
    --cc=refpolicy@oss1.tresys.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.