From: James Morris <jmorris@namei.org>
To: Catherine Zhang <cxzhang@watson.ibm.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jmorris@redhat.com,
chrisw@osdl.org, herbert@gondor.apana.org.au, sds@tycho.nsa.gov,
tjaeger@cse.psu.edu, akpm@osdl.org, latten@austin.ibm.com,
sergeh@us.ibm.com, gcwilson@us.ibm.com, czhang.us@gmail.com
Subject: Re: [Patch 1/1] AF_UNIX Datagram getpeersec (with minor fix)
Date: Sun, 18 Jun 2006 04:04:06 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0606180313320.22401@d.namei> (raw)
In-Reply-To: <20060618061753.GA27681@jiayuguan.watson.ibm.com>
On Sun, 18 Jun 2006, Catherine Zhang wrote:
> Patch purpose:
>
> This patch enables a security-aware application to retrieve the
> security context of the peer of a Unix datagram socket. The application
> can then use this security context to determine the security context for
> processing on behalf of the peer who sent the packet.
I'd also mention here that this is to complement the SO_PEERSEC option for
stream sockets.
There's an implementation issue, which I'm sure has been mentioned
previously. This code should not be calling SELinux API functions.
> @@ -62,6 +70,12 @@ static __inline__ void scm_recv(struct s
> if (test_bit(SOCK_PASSCRED, &sock->flags))
> put_cmsg(msg, SOL_SOCKET, SCM_CREDENTIALS, sizeof(scm->creds), &scm->creds);
>
> + if (test_bit(SOCK_PASSSEC, &sock->flags)) {
> + err = selinux_ctxid_to_string(scm->sid, &scontext, &scontext_len);
The above is SELinux-specific code sitting in core networking code.
Look at the peersec stuff, it calls out to LSM hooks:
socket_getpeersec_stream
socket_getpeersec_dgram
These are the abstractions to be used for this in the core kernel, and the
SELinux code can then figure out specifically what to do based on the
protocol. Have a look at selinux_socket_getpeersec_stream() and see how
it behaves based on the protocol, to get an idea of the changes needed for
_dgram().
This needs to be reworked.
Look at ip_cmsg_recv_security() to see how this is done cleanly via an LSM
hook, without modifying core networking structures.
- James
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2006-06-18 8:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-18 6:17 [Patch 1/1] AF_UNIX Datagram getpeersec (with minor fix) Catherine Zhang
2006-06-18 8:04 ` James Morris [this message]
2006-06-19 16:39 ` Xiaolan Zhang
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=Pine.LNX.4.64.0606180313320.22401@d.namei \
--to=jmorris@namei.org \
--cc=akpm@osdl.org \
--cc=chrisw@osdl.org \
--cc=cxzhang@watson.ibm.com \
--cc=czhang.us@gmail.com \
--cc=davem@davemloft.net \
--cc=gcwilson@us.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=jmorris@redhat.com \
--cc=latten@austin.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=sds@tycho.nsa.gov \
--cc=sergeh@us.ibm.com \
--cc=tjaeger@cse.psu.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox