From: Paul Moore <pmoore@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
selinux@tycho.nsa.gov, mst@redhat.com
Subject: Re: [RFC PATCH v2 3/3] tun: fix LSM/SELinux labeling of tun/tap devices
Date: Thu, 06 Dec 2012 10:36:11 -0500 [thread overview]
Message-ID: <10346047.LWlqqejLmO@sifl> (raw)
In-Reply-To: <9040763.QsllgCP7TP@jason-thinkpad-t430s>
On Thursday, December 06, 2012 06:29:54 PM Jason Wang wrote:
> On Wednesday, December 05, 2012 03:26:19 PM Paul Moore wrote:
> > This patch corrects some problems with LSM/SELinux that were introduced
> > with the multiqueue patchset. The problem stems from the fact that the
> > multiqueue work changed the relationship between the tun device and its
> > associated socket; before the socket persisted for the life of the
> > device, however after the multiqueue changes the socket only persisted
> > for the life of the userspace connection (fd open). For non-persistent
> > devices this is not an issue, but for persistent devices this can cause
> > the tun device to lose its SELinux label.
> >
> > We correct this problem by adding an opaque LSM security blob to the
> > tun device struct which allows us to have the LSM security state, e.g.
> > SELinux labeling information, persist for the lifetime of the tun
> > device. In the process we tweak the LSM hooks to work with this new
> > approach to TUN device/socket labeling and introduce a new LSM hook,
> > security_tun_dev_create_queue(), to approve requests to create a new
> > TUN queue via TUNSETQUEUE.
> >
> > The SELinux code has been adjusted to match the new LSM hooks, the
> > other LSMs do not make use of the LSM TUN controls. This patch makes
> > use of the recently added "tun_socket:create_queue" permission to
> > restrict access to the TUNSETQUEUE operation. On older SELinux
> > policies which do not define the "tun_socket:create_queue" permission
> > the access control decision for TUNSETQUEUE will be handled according
> > to the SELinux policy's unknown permission setting.
> >
> > Signed-off-by: Paul Moore <pmoore@redhat.com>
...
> > @@ -4425,20 +4452,19 @@ static void selinux_tun_dev_post_create(struct
> > sock
> > *sk) * cause confusion to the TUN user that had no idea network labeling *
> > protocols were being used */
> >
> > - /* see the comments in selinux_tun_dev_create() about why we ...
> > -
> > - sksec->sid = current_sid();
> > + sksec->sid = tunsec->sid;
>
> Since both tun_set_iff() and tun_set_queue() would call this. I wonder when
> it is called by tun_set_queue() we need some checking just like what we
> done in v1, otherwise it's unconditionally in TUNSETQUEUE. Or we can add
> them in selinux_tun_dev_create_queue()?
In all the cases that call tun_attach() we have a new socket which needs to be
labeled based on the tun->security label, yes? That is what the
security_tun_dev_attach() code does, there is no need for access control at
this point as the operation has already been authorized by either
security_tun_dev_create() (new device), security_tun_dev_create_queue() (new
queue), or security_tun_dev_open() (opening persistent device).
I think we are all set, or am I missing something?
> > sksec->sclass = SECCLASS_TUN_SOCKET;
> >
> > +
> > + return 0;
> >
> > }
--
paul moore
security and virtualization @ redhat
--
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.
next prev parent reply other threads:[~2012-12-06 15:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 20:25 [RFC PATCH v2 0/3] Fix some multiqueue TUN problems Paul Moore
2012-12-05 20:26 ` [RFC PATCH v2 1/3] tun: correctly report an error in tun_flow_init() Paul Moore
[not found] ` <2215330.qi9iHRh0XG@jason-thinkpad-t430s>
2012-12-06 15:46 ` Paul Moore
2012-12-05 20:26 ` [RFC PATCH v2 2/3] selinux: add the "create_queue" permission to the "tun_socket" class Paul Moore
2012-12-05 20:26 ` [RFC PATCH v2 3/3] tun: fix LSM/SELinux labeling of tun/tap devices Paul Moore
[not found] ` <9040763.QsllgCP7TP@jason-thinkpad-t430s>
2012-12-06 15:36 ` Paul Moore [this message]
[not found] ` <20121206103325.GG10837@redhat.com>
2012-12-06 15:46 ` Paul Moore
[not found] ` <20121206161200.GA4340@redhat.com>
2012-12-06 16:56 ` Paul Moore
[not found] ` <20121206205716.GA6576@redhat.com>
2012-12-06 21:09 ` Paul Moore
[not found] ` <20121207122516.GA16577@redhat.com>
2012-12-10 17:04 ` Paul Moore
[not found] ` <20121210172656.GA30775@redhat.com>
2012-12-10 17:33 ` Paul Moore
[not found] ` <20121210175035.GA31856@redhat.com>
2012-12-10 18:42 ` Eric Paris
2012-12-10 22:21 ` Paul Moore
2012-12-10 22:43 ` Paul Moore
[not found] ` <20121212092236.GB4354@redhat.com>
2012-12-12 18:49 ` 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=10346047.LWlqqejLmO@sifl \
--to=pmoore@redhat.com \
--cc=jasowang@redhat.com \
--cc=linux-security-module@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--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.