Skip to contentSkip to conversation

labelling with genfscon

DISCUSSION run zhang 2 participants 5 messages Apr 23, 2008 – Apr 25, 2008 SELinux security module

lore
Share & tools
lore

run zhang

author
#0 lore raw

In the NSA example policy package, the genfs_contexts explains that except /proc, all other filesystems without xattr support are limited to a single entry /. Can I specify the subdirs of a filesystem with different lables with genfscon just like /proc?
More specifically, I am using NFS and cramfs, where I specify
genfscon nfs / root_t
genfscon nfs /bin bin_t

However, after boot and load the result policy, still every dir in rootfs is labelled with root_t. It seems the same result for cramfs. According this thread: http://marc.info/?l=selinux&m=102587231814793&w=2, it seems that this should be doable. Please give hand, thanks very much!

--Run

---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

#1 lore raw
Quoted 8 lines · run zhang

In the NSA example policy package, the genfs_contexts explains that except /proc, all other filesystems without xattr support are limited to a single entry /. Can I specify the subdirs of a filesystem with different lables with genfscon just like /proc?
More specifically, I am using NFS and cramfs, where I specify
genfscon nfs / root_t
genfscon nfs /bin bin_t

Quoted 6 lines

However, after boot and load the result policy, still every dir in rootfs is labelled with root_t. It seems the same result for cramfs. According this thread:
http://marc.info/?l=selinux&m=102587231814793&w=2, it seems that this should be doable.
Please give hand, thanks very much!

At the time of that thread, SELinux did support use of genfs_contexts for other filesystem types. However, that support was dropped because
a) we couldn't provide strong guarantees about such labeling for other filesystem types (in the case of proc, we can generate an unambiguous and immutable pathname from the internal kernel data structures to use as a key; most other filesystem types would suffer from aliasing and userspace-manipulation issues), and b) it was frowned upon by the vfs folks as unacceptable for merging selinux into mainline. It was nonetheless a relatively simple patch to SELinux to support it if you are willing to patch your kernel.

For NFS, you are currently limited to per-mount granularity (using the mount context= option) or the default genfscon label. There is ongoing work on labeled NFSv4 support to provide native support for per-file labeling.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#2 lore raw

Thanks Stephen for the clarifying.
So where can I find the patch you mentioned? I want to try it. Also, I will try with the new feature of NFSv4.

Stephen Smalley <[email protected]> wrote:

Quoted 8 lines · run zhang

In the NSA example policy package, the genfs_contexts explains that except /proc, all other filesystems without xattr support are limited to a single entry /. Can I specify the subdirs of a filesystem with different lables with genfscon just like /proc?
More specifically, I am using NFS and cramfs, where I specify genfscon nfs / root_t
genfscon nfs /bin bin_t

Quoted 6 lines

However, after boot and load the result policy, still every dir in rootfs is labelled with root_t. It seems the same result for cramfs. According this thread:
http://marc.info/?l=selinux&m=102587231814793&w=2, it seems that this should be doable.
Please give hand, thanks very much!

At the time of that thread, SELinux did support use of genfs_contexts for other filesystem types. However, that support was dropped because
a) we couldn't provide strong guarantees about such labeling for other filesystem types (in the case of proc, we can generate an unambiguous and immutable pathname from the internal kernel data structures to use as a key; most other filesystem types would suffer from aliasing and userspace-manipulation issues), and b) it was frowned upon by the vfs folks as unacceptable for merging selinux into mainline. It was nonetheless a relatively simple patch to SELinux to support it if you are willing to patch your kernel.

For NFS, you are currently limited to per-mount granularity (using the mount context= option) or the default genfscon label. There is ongoing work on labeled NFSv4 support to provide native support for per-file labeling.

Signature · 13 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
#3 lore raw
Quoted 2 lines · run zhang

Thanks Stephen for the clarifying.
So where can I find the patch you mentioned? I want to try it.

It will have to be re-based as it no longer applies to a current kernel. What kernel version are you using as your baseline?

Quoted 1 line

Also, I will try with the new feature of NFSv4.

Those changes aren't upstreamed yet; the labeled NFS work is still in progress.

Quoted 72 lines

Stephen Smalley <[email protected]> wrote:

On Wed, 2008-04-23 at 12:07 -0700, run zhang wrote:
> In the NSA example policy package, the genfs_contexts explains that
> except /proc, all other filesystems without xattr support are limited
> to a single entry /. Can I specify the subdirs of a filesystem with
> different lables with genfscon just like /proc?
> More specifically, I am using NFS and cramfs, where I specify
> genfscon nfs / root_t
> genfscon nfs /bin bin_t
>
> However, after boot and load the result policy, still every dir in
> rootfs is labelled with root_t. It seems the same result for cramfs.
> According this thread:
> http://marc.info/?l=selinux&m=102587231814793&w=2, it seems that this
> should be doable.
> Please give hand, thanks very much!

At the time of that thread, SELinux did support use of genfs_contexts
for other filesystem types. However, that support was dropped because
a) we couldn't provide strong guarantees about such labeling for other
filesystem types (in the case of proc, we can generate an unambiguous
and immutable pathname from the internal kernel data structures to use
as a key; most other filesystem types would suffer from aliasing and
userspace-manipulation issues), and b) it was frowned upon by the vfs
folks as unacceptable for merging selinux into mainline. It was
nonetheless a relatively simple patch to SELinux to support it if you
are willing to patch your kernel.

For NFS, you are currently limited to per-mount granularity (using the
mount context= option) or the default genfscon label. There is ongoing
work on labeled NFSv4 support to provide native support for per-file
labeling.

--
Stephen Smalley
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

______________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
author
#4 lore raw

I am working on 2.6.21.1.
Thanks!

Stephen Smalley <[email protected]> wrote:

Quoted 2 lines · run zhang

Thanks Stephen for the clarifying.
So where can I find the patch you mentioned? I want to try it.

It will have to be re-based as it no longer applies to a current kernel. What kernel version are you using as your baseline?

Quoted 1 line

Also, I will try with the new feature of NFSv4.

Those changes aren't upstreamed yet; the labeled NFS work is still in progress.

Quoted 72 lines

Stephen Smalley wrote:

Quoted 1 line · run zhang

In the NSA example policy package, the genfs_contexts

explains that

Quoted 1 line

except /proc, all other filesystems without xattr support

are limited

Quoted 1 line

to a single entry /. Can I specify the subdirs of a

filesystem with

Quoted 2 lines

different lables with genfscon just like /proc? More specifically, I am using NFS and cramfs, where I

specify

Quoted 4 lines

genfscon nfs / root_t
genfscon nfs /bin bin_t

However, after boot and load the result policy, still every

dir in

Quoted 1 line

rootfs is labelled with root_t. It seems the same result for

cramfs.

Quoted 2 lines

According this thread:
http://marc.info/?l=selinux&m=102587231814793&w=2, it seems

that this

Quoted 2 lines

should be doable.
Please give hand, thanks very much!

At the time of that thread, SELinux did support use of genfs_contexts
for other filesystem types. However, that support was dropped because
a) we couldn't provide strong guarantees about such labeling for other
filesystem types (in the case of proc, we can generate an unambiguous
and immutable pathname from the internal kernel data structures to use
as a key; most other filesystem types would suffer from aliasing and
userspace-manipulation issues), and b) it was frowned upon by the vfs
folks as unacceptable for merging selinux into mainline. It was
nonetheless a relatively simple patch to SELinux to support it if you
are willing to patch your kernel.

For NFS, you are currently limited to per-mount granularity (using the
mount context= option) or the default genfscon label. There is ongoing
work on labeled NFSv4 support to provide native support for per-file
labeling.

Signature · 17 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux
mailing list.
If you no longer wish to subscribe, send mail to
[email protected] with
the words "unsubscribe selinux" without quotes as the message.




______________________________________________________________________
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
Signature · 15 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.




       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.