All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Moore <paul.moore@hp.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Venkat Yekkirala <vyekkirala@TrustedCS.com>,
	selinux@tycho.nsa.gov, eparis@redhat.com, jmorris@namei.org,
	Steve Grubb <sgrubb@redhat.com>
Subject: Re: [PATCH v4 1/2] NetLabel: secid reconciliation support
Date: Wed, 04 Oct 2006 16:52:15 -0400	[thread overview]
Message-ID: <45241EFF.2000108@hp.com> (raw)
In-Reply-To: <1159993643.19176.256.camel@moss-spartans.epoch.ncsc.mil>

Stephen Smalley wrote:
> (also dropping netdev, as this isn't relevant there)
> 
> On Wed, 2006-10-04 at 16:08 -0400, Paul Moore wrote:
> 
>>Venkat Yekkirala wrote:
>>
>>>>On Wed, 2006-10-04 at 15:27 -0400, Paul Moore wrote:
>>>>
>>>>
>>>>>Venkat Yekkirala wrote:
>>>>>
>>>>>
>>>>>>>* XFRM present
>>>>>>>
>>>>>>> xfrm_sid = <full context from xfrm>
>>>>>>> loc_sid = SECINITSID_NETMSG
>>>>>>> nlbl_sid = SECSID_NULL/0
>>>>>>> ext_sid = xfrm_sid
>>>>>>> final skb->secmark = avc_ok : ext_sid ? unchanged
>>>
>>>
>>>As noted subsequently, I actually meant to refer to the below
>>>instead of the XFRM case above:
>>>
>>> * Nothing
>>>
>>>   xfrm_sid = SECSID_NULL/0
>>>   loc_sid = SECSID_NULL/0
>>>   nlbl_sid = SECSID_NULL/0
>>>   ext_sid = xfrm_sid
>>>   final skb->secmark = avc_ok : ext_sid ? unchanged
>>>
>>>
>>>
>>>>>>>* NetLabel present
>>>>>>>
>>>>>>> xfrm_sid = SECSID_NULL/0
>>>>>>> loc_sid = SECSID_NULL/0
>>>>>>> nlbl_sid = <SECINITSID_NETMSG te ctx, netlabel mls ctx>
>>>>>>> ext_sid = nlbl_sid
>>>>>>> final skb->secmark = avc_ok : ext_sid ? unchanged
>>>>>>
>>>>>>I was referring to the differences in what getpeercon would
>>>>>>return in the above 2 scenarios.
>>>>>>
>>>>>>In the xfrm case:     final skb->secmark would be 0 
>>>>
>>>>resulting in getpeercon
>>>>
>>>>
>>>>>>to return EPROTONOOPT
>>>>>
>>>>>In the "XFRM present" case above if the access is allowed (avc_ok is
>>>>>true) then the final skb->secmark value is going to be set 
>>>>
>>>>to the value
>>>>
>>>>
>>>>>of ext_sid which is the xfrm_sid.  Any calls made to 
>>>>
>>>>getpeercon() would
>>>>
>>>>
>>>>>return success with the context matching xfrm_sid.
>>>>>
>>>>>I have a hunch we are still on different pages here ...
>>>>>
>>>>>
>>>>>
>>>>>>In the NetLabel case: final skb->secmark would be 
>>>>
>>>>network_t resulting in
>>>>
>>>>
>>>>>>getpeercon to return network_t
>>>>>
>>>>>Yep, and I understand you would like to see it as 
>>>>
>>>>unlabeled_t.  I think
>>>>
>>>>
>>>>>we both have valid arguments for either case and we are 
>>>>
>>>>just waiting to
>>>>
>>>>
>>>>>hear from others.
>>>>
>>>>I don't understand the argument for network_t, and it seems to violate
>>>>our goals of 1) having consistent policy regardless of 
>>>>network labeling
>>>>mechanism, and 2) having getpeercon() always return a subject 
>>>>label that
>>>>can be used as a basis for avc_has_perm() and setexeccon() calls.
>>>
>>>But in the case where there's no domain info, but a cipso label,
>>>getpeercon will fail (EPROTONOOPT). Do I rememember that Paul was
>>>trying to use a special SID to use as a base sid in this case?
>>
>>[I'm replying to both Stephen and Venkat here as the email is coming in
>>faster than I can type :)]
>>
>>In the current non-secid world, if the connection is NetLabel labeled,
>>the sock_rcv_skb() LSM hook uses SECINITSID_NETMSG as the base_sid and
>>the recvfrom permission to control access.  Calls to getpeercon() on a
>>NetLabel connection use the socket's SID as the base_sid and the network
>>traffic's MLS label.
> 
> So if xinetd calls getpeercon(), it gets a context with type
> "xinetd_t" (from its own socket) and the MLS label of the client?

Yep.

>>In the latest secid world, when there is only NetLabel labeling present
>>on the connection SECINITSID_NETMSG is used as the base_sid for the
>>final skb->secmark value as determined by the flow_in() LSM hook with
>>the MLS label being set to match the NetLabel on the packet.  Calls to
>>getpeercon() will use the secmark value of the packet when the
>>connection is establishes (in *all* cases) so getpeercon() in the
>>NetLabel only case will succeed and return the value determined above.
> 
> So if xinetd calls getpeercon(), it gets a context with type
> "network_t" (if using netmsg) or "unlabeled_t" (if using unlabeled) and
> the MLS label of the client?

Yep.

> So what's the issue with using SECINITSID_UNLABELED instead?  It isn't
> equivalent to SECSID_NULL.  Is that the source of confusion?

My only concern with using SECINITSID_UNLABELED was that the string
context representation would show up as "unlabeled_t" which I think is
somehwat misleading.  Venkat and I have had several discussions about
this on the mailing lists and we were just waiting for someone else to
comment on the issue.

> Note btw that the current xinetd patch won't work well with any of the
> above, e.g. ftpd shouldn't run in any of xinetd_t, network_t, or
> unlabeled_t.  And if xinetd takes the alternative approach I suggested,
> then the TE portion of the peer context is completely irrelevant.

I think we are all in agreement that the current xinetd patch is broken.
 Hopefully Steve Grubb will have fix it soon (I just added him as a CC).

> Meanwhile, for e.g. a networked policy management daemon, none of these
> domains is likely to get past the avc_has_perm() check.  Which is what
> we'd want, since we don't know anything about the real domain of the
> client.  But the first case (return local socket's domain) is a bit
> frightening - I can see policy allowing a domain to act on itself, and
> not expecting that to permit arbitrary clients of unknown domain to do
> likewise.

Okay, I'll change NetLabel to use the SECINITSID_UNLABELED SID as the
base_sid for pretty much everything when there is no TE information
available from SECMARK or XFRM.

-- 
paul moore
linux security @ hp

--
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:[~2006-10-04 20:52 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-04 19:53 [PATCH v4 1/2] NetLabel: secid reconciliation support Venkat Yekkirala
2006-10-04 19:53 ` Venkat Yekkirala
2006-10-04 20:08 ` Paul Moore
2006-10-04 20:08   ` Paul Moore
2006-10-04 20:27   ` Stephen Smalley
2006-10-04 20:52     ` Paul Moore [this message]
2006-10-04 21:12       ` Steve Grubb
2006-10-04 22:03         ` Joe Nall
2006-10-04 22:43           ` Paul Moore
2006-10-05 12:15           ` xinetd SELinux support (Was: Re: [PATCH v4 1/2] NetLabel: secid reconciliation support) Stephen Smalley
2006-10-04 22:18         ` [PATCH v4 1/2] NetLabel: secid reconciliation support Linda Knippers
2006-10-04 20:12 ` Stephen Smalley
  -- strict thread matches above, loose matches on Subject: below --
2006-10-04 19:37 Venkat Yekkirala
2006-10-04 19:37 ` Venkat Yekkirala
2006-10-04 19:52 ` Paul Moore
2006-10-04 19:52   ` Paul Moore
2006-10-04 20:09   ` Stephen Smalley
2006-10-04 20:21     ` Paul Moore
2006-10-04 20:39       ` Stephen Smalley
2006-10-04 20:53         ` Paul Moore
2006-10-04 19:02 Venkat Yekkirala
2006-10-04 19:02 ` Venkat Yekkirala
2006-10-04 19:27 ` Paul Moore
2006-10-04 19:27   ` Paul Moore
2006-10-04 19:45   ` Stephen Smalley
2006-10-04 19:45     ` Stephen Smalley
2006-10-04 17:09 Venkat Yekkirala
2006-10-04 17:09 ` Venkat Yekkirala
2006-10-04 16:59 Venkat Yekkirala
2006-10-04 16:59 ` Venkat Yekkirala
2006-10-04 18:45 ` Paul Moore
2006-10-04 18:45   ` Paul Moore
2006-10-04 15:46 [PATCH 0/2] [PATCH 0/2] Updated NetLabel/secid-reconciliation bits and a bugfix paul.moore
2006-10-04 15:46 ` [PATCH v4 1/2] NetLabel: secid reconciliation support paul.moore
2006-10-04 15:46   ` paul.moore

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=45241EFF.2000108@hp.com \
    --to=paul.moore@hp.com \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    --cc=sgrubb@redhat.com \
    --cc=vyekkirala@TrustedCS.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.