Skip to contentSkip to conversation

policy problem with nfs mounting

DISCUSSION Chris PeBenito 3 participants 5 messages Dec 8, 2003 – Dec 17, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

I was merging in the 1.4 policy changes into the Gentoo policy, when I experienced some odd nfs breakage. NFS wouldn't mount on my 2.6 machine (cant try on 2.4, since its PPC):

nfs warning: mount version older than kernel
SELinux: initialized (dev , type rpc_pipefs), not configured for labeling
avc: denied { mount } for pid=3123 exe=/bin/mount name=/ dev= ino=3189 scontext=system_u:system_r:mount_t tcontext=system_u:object_r:unlabeled_t tclass=filesystem

avc: denied { search } for pid=3123 exe=/bin/mount dev= ino=3189 scontext=system_u:system_r:mount_t tcontext=system_u:object_r:unlabeled_t tclass=dir
SELinux: initialized (dev 0:b, type nfs), uses genfs_contexts

At first I thought it was NFS itself, but it turns out to be rpc_pipefs, as there are no denials on successive NFS mounts. I set rpc_pipefs to be nfs_t in genfscon, and then the denials are cleared. However, I'm not sure if this is the best choice of type. Comments?

Signature · 13 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243

--
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.
#1 lore raw
Quoted 9 lines · Chris PeBenito

I was merging in the 1.4 policy changes into the Gentoo policy, when I experienced some odd nfs breakage. NFS wouldn't mount on my 2.6 machine (cant try on 2.4, since its PPC):

nfs warning: mount version older than kernel
SELinux: initialized (dev , type rpc_pipefs), not configured for labeling
avc: denied { mount } for pid=3123 exe=/bin/mount name=/ dev= ino=3189 scontext=system_u:system_r:mount_t tcontext=system_u:object_r:unlabeled_t tclass=filesystem

Quoted 8 lines

avc: denied { search } for pid=3123 exe=/bin/mount dev= ino=3189 scontext=system_u:system_r:mount_t tcontext=system_u:object_r:unlabeled_t tclass=dir
SELinux: initialized (dev 0:b, type nfs), uses genfs_contexts

At first I thought it was NFS itself, but it turns out to be rpc_pipefs, as there are no denials on successive NFS mounts. I set rpc_pipefs to be nfs_t in genfscon, and then the denials are cleared. However, I'm not sure if this is the best choice of type. Comments?

I'd expect that you would want a different type for rpc_pipefs, as you likely want to control access to this userland/kernel interface differently than to the files on the NFS filesystem. It may even be desirable to support finer-grained labeling for rpc_pipefs, to support least privilege for userspace access to it, but we haven't looked into that yet.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.
#2 lore raw

Well I made a mistake on this; I wouldn't have seen this had I not missed merging in the two rules at the bottom of mount.te to allow mounting of unlabeled fs's. But since it looks like these other interfaces are going to be worked on soon, I put in a rpc_pipefs_t anyway, see attached patch.

Quoted 10 lines · Stephen Smalley
Quoted 3 lines · Chris PeBenito

I was merging in the 1.4 policy changes into the Gentoo policy, when I experienced some odd nfs breakage. NFS wouldn't mount on my 2.6 machine (cant try on 2.4, since its PPC):

I'd expect that you would want a different type for rpc_pipefs, as you likely want to control access to this userland/kernel interface differently than to the files on the NFS filesystem. It may even be desirable to support finer-grained labeling for rpc_pipefs, to support least privilege for userspace access to it, but we haven't looked into that yet.

Signature · 8 lines
Chris PeBenito
<[email protected]>
Developer,
Hardened Gentoo Linux
Embedded Gentoo Linux
 
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243
Key fingerprint = B0E6 877A 883F A57A 8E6A  CB00 BC8E E42D E6AF 9243
domains/program/mount.te +1 -0
diff -urN policy-1.4.orig/domains/program/mount.te policy-1.4/domains/program/mount.te
@@ -55,6 +55,7 @@
 can_udp_send(mount_t, portmap_t)
 can_udp_send(portmap_t, mount_t)
 allow mount_t resolv_conf_t:file { getattr read };
+allow mount_t rpc_pipefs_t:dir search;
 ')
 
 allow mount_t unlabeled_t:filesystem { mount unmount };
genfs_contexts +1 -0
diff -urN policy-1.4.orig/genfs_contexts policy-1.4/genfs_contexts
@@ -84,3 +84,4 @@
 genfscon bdev / system_u:object_r:bdev_t
 genfscon usbfs / system_u:object_r:usbfs_t
 genfscon nfsd / system_u:object_r:nfsd_fs_t
+genfscon rpc_pipefs / system_u:object_r:rpc_pipefs_t
types/file.te +1 -0
diff -urN policy-1.4.orig/types/file.te policy-1.4/types/file.te
@@ -31,6 +31,7 @@
 type bdev_t, fs_type;
 type usbfs_t, fs_type;
 type nfsd_fs_t, fs_type;
+type rpc_pipefs_t, fs_type;
 
 #
 # file_t is the default type of an unlabeled
#3 lore raw
Quoted 5 lines · Chris PeBenito

Well I made a mistake on this; I wouldn't have seen this had I not missed merging in the two rules at the bottom of mount.te to allow mounting of unlabeled fs's.  But since it looks like these other interfaces are going to be worked on soon, I put in a rpc_pipefs_t anyway, see attached patch.

I've put that in my tree. It seems like a good interim measure at least until/unless Steve determines that something better is needed.

Signature · 11 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page



--
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.
#4 lore raw
In reply to Chris PeBenito
Quoted 5 lines · Chris PeBenito

Well I made a mistake on this; I wouldn't have seen this had I not missed merging in the two rules at the bottom of mount.te to allow mounting of unlabeled fs's. But since it looks like these other interfaces are going to be worked on soon, I put in a rpc_pipefs_t anyway, see attached patch.

Thanks, also merged into our CVS tree.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.