Skip to contentSkip to conversation

policy to allow upgrade of nfs-utils

PATCH Russell Coker 2 participants 8 messages Jul 8, 2004 – Jul 12, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The attached policy patch is needed to allow nfs-utils to be upgraded to the latest version on a rawhide system.

Signature · 4 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
domains/program/unused/rpcd.te +2 -0
diff -ru policy/domains/program/unused/rpcd.te ./domains/program/unused/rpcd.te
@@ -51,6 +51,8 @@
 
 ifdef(`rpm.te', `
 allow rpcd_t self:capability { chown dac_override setgid setuid };
+# for /etc/rc.d/init.d/nfs to create /etc/exports
+allow initrc_t etc_t:file rw_file_perms;
 ')
 
 allow rpcd_t self:file { getattr read };
domains/program/unused/rpm.te +6 -1
diff -ru policy/domains/program/unused/rpm.te ./domains/program/unused/rpm.te
@@ -69,6 +69,9 @@
 # for a bug in rm
 dontaudit initrc_t pidfile:file write;
 
+# bash tries to access a block device in the initrd
+dontaudit initrc_t unlabeled_t:blk_file getattr;
+
 # bash tries ioctl for some reason
 dontaudit initrc_t pidfile:file ioctl;
 
@@ -93,7 +96,9 @@
 allow rpm_t sysfs_t:filesystem getattr;
 allow rpm_t tmpfs_t:filesystem getattr;
 dontaudit rpm_t domain:{ socket unix_dgram_socket udp_socket unix_stream_socket tcp_socket fifo_file rawip_socket packet_socket } getattr;
-allow rpm_t fs_type:dir getattr;
+# needs rw permission to the directory for an rpm package that includes a mount
+# point
+allow rpm_t fs_type:dir { setattr rw_dir_perms };
 allow rpm_t fs_type:filesystem getattr;
 
 # allow compiling and loading new policy
#1 lore raw
Quoted 2 lines · Russell Coker

The attached policy patch is needed to allow nfs-utils to be upgraded to the latest version on a rawhide system.

Should /etc/exports get its own type?

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
Quoted 5 lines · Stephen Smalley
Quoted 2 lines · Russell Coker

The attached policy patch is needed to allow nfs-utils to be upgraded to the latest version on a rawhide system.

Should /etc/exports get its own type?

I guess so. nfsd_etc_t or exports_t?

Signature · 9 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.
#3 lore raw
Quoted 8 lines · Russell Coker
Quoted 5 lines · Stephen Smalley
Quoted 2 lines · Russell Coker

The attached policy patch is needed to allow nfs-utils to be upgraded to the latest version on a rawhide system.

Should /etc/exports get its own type?

I guess so. nfsd_etc_t or exports_t?

Doesn't matter to me, but it could be problematic to preserve the type on the file, given that it is directly edited. But directly allowing initrc_t to write to etc_t violates an assertion (unless you have unlimitedServices enabled, which renders the allow rule duplicative anyway).

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.
#4 lore raw
Quoted 6 lines · Stephen Smalley
Quoted 5 lines · Russell Coker
Quoted 4 lines · Stephen Smalley
Quoted 2 lines · Russell Coker

The attached policy patch is needed to allow nfs-utils to be upgraded to the latest version on a rawhide system.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Should /etc/exports get its own type?

I guess so. nfsd_etc_t or exports_t?

Doesn't matter to me, but it could be problematic to preserve the type on the file, given that it is directly edited.

A patched version of vi should solve that. In any case if the file gets etc_t then it is just readable to everyone which isn't so bad. The only potential problem is if you edit the file with an unpatched editor and delete all content so that initrc_t will want to append "#" to it.

What do you think of the attached patch?

Signature · 4 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
domains/program/unused/rpcd.te renamed from usr/src/se/policy/domains/program/unused/rpcd.te +4 -0
diff -ru /usr/src/se/policy/domains/program/unused/rpcd.te ./domains/program/unused/rpcd.te
@@ -23,6 +23,8 @@
 allow $1_t var_lib_nfs_t:file create_file_perms;
 ')
 
+type exports_t, file_type, sysadmfile;
+
 # rpcd_t is the domain of rpc daemons.
 # rpcd_exec_t is the type of rpc daemon programs.
 #
@@ -51,6 +53,8 @@
 
 ifdef(`rpm.te', `
 allow rpcd_t self:capability { chown dac_override setgid setuid };
+# for /etc/rc.d/init.d/nfs to create /etc/exports
+allow initrc_t exports_t:file rw_file_perms;
 ')
 
 allow rpcd_t self:file { getattr read };
file_contexts/program/rpcd.fc renamed from usr/src/se/policy/file_contexts/program/rpcd.fc +1 -0
diff -ru /usr/src/se/policy/file_contexts/program/rpcd.fc ./file_contexts/program/rpcd.fc
@@ -6,3 +6,4 @@
 /usr/sbin/rpc\.mountd	--	system_u:object_r:nfsd_exec_t
 /var/run/rpc.statd.pid	--	system_u:object_r:rpcd_var_run_t
 /var/run/rpc.statd(/.*)?	system_u:object_r:rpcd_var_run_t
+/etc/exports		--	system_u:object_r:exports_t
#5 lore raw
Quoted 6 lines · Russell Coker

A patched version of vi should solve that. In any case if the file gets etc_t then it is just readable to everyone which isn't so bad. The only potential problem is if you edit the file with an unpatched editor and delete all content so that initrc_t will want to append "#" to it.

What do you think of the attached patch?

Looks ok, but is it sufficient, i.e. does it only require permission to write to the existing /etc/exports, or does it need to be able to unlink and re-create the file?

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.
#6 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 6 lines · Russell Coker

A patched version of vi should solve that. In any case if the file gets etc_t then it is just readable to everyone which isn't so bad. The only potential problem is if you edit the file with an unpatched editor and delete all content so that initrc_t will want to append "#" to it.

What do you think of the attached patch?

Looks ok, but is it sufficient, i.e. does it only require permission to write to the existing /etc/exports, or does it need to be able to unlink and re-create the file?

The init script only requires append permission. Of course other programs need read access which my patch didn't grant, so it's not complete in that regard.

Signature · 9 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.
#7 lore raw
In reply to Russell Coker
Quoted 6 lines · Russell Coker

A patched version of vi should solve that. In any case if the file gets etc_t then it is just readable to everyone which isn't so bad. The only potential problem is if you edit the file with an unpatched editor and delete all content so that initrc_t will want to append "#" to it.

What do you think of the attached patch?

Ok, merged.

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.