Skip to contentSkip to conversation

ssh policy

PATCH Russell Coker 5 participants 10 messages Sep 8, 2004 – Sep 13, 2004

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

The attached patch restores the functionality of sshd_extern_t after the recent can_exec change.

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/ssh.te renamed from usr/src/se/policy/domains/program/ssh.te +2 -2
@@ -26,6 +26,8 @@
 # privfd is for passing the terminal file handle to the user process
 # auth_chkpwd is for running unix_chkpwd and unix_verify.
 type $1_t, domain, privuser, privrole, privlog, privowner, privfd, auth_chkpwd, nscd_client_domain;
+can_exec($1_t, sshd_exec_t)
+r_dir_file($1_t, self)
 role system_r types $1_t;
 dontaudit $1_t shadow_t:file { getattr read };
 uses_shlib($1_t)
@@ -147,8 +149,6 @@
 # sshd_extern_t is the domain for ssh from outside our network
 #
 sshd_program_domain(sshd)
-can_exec(sshd_t, sshd_exec_t)
-r_dir_file(sshd_t, self)
 if (ssh_sysadm_login) {
 sshd_spawn_domain(sshd, userdomain, { sysadm_devpts_t userpty_type })
 } else {
#1 lore raw

Merged.

Quoted 2 lines · Russell Coker

The attached patch restores the functionality of sshd_extern_t after the recent can_exec change.

Signature · 7 lines
James Carter <[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

Latest policy. More stuff for dbus. Added media file. Changes for udev on tmpfs.

appconfig/media +3 -0
diff --exclude-from=exclude -N -u -r nsapolicy/appconfig/media policy-1.17.13/appconfig/media
@@ -0,0 +1,3 @@
+cdrom system_u:object_r:removable_device_t
+floppy system_u:object_r:removable_device_t
+disk system_u:object_r:fixed_disk_device_t
domains/program/ifconfig.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/ifconfig.te policy-1.17.13/domains/program/ifconfig.te
@@ -24,7 +24,7 @@
 domain_auto_trans(sysadm_t, ifconfig_exec_t, ifconfig_t)
 
 # for /sbin/ip
-allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
+allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write setopt };
 allow ifconfig_t self:tcp_socket { create ioctl };
 allow ifconfig_t etc_t:file { getattr read };
 
domains/program/initrc.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/initrc.te policy-1.17.13/domains/program/initrc.te
@@ -317,5 +317,5 @@
 allow initrc_t security_t:dir { getattr search };
 allow initrc_t security_t:file { getattr read };
 ifdef(`dbusd.te', `
-allow initrc_t system_dbusd_t:dbus { send_msg };
+allow initrc_t system_dbusd_t:dbus { send_msg acquire_svc };
 ')
domains/program/unused/cups.te +5 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/cups.te policy-1.17.13/domains/program/unused/cups.te
@@ -161,3 +161,8 @@
 
 dontaudit cupsd_t selinux_config_t:dir search;
 dontaudit cupsd_t selinux_config_t:file { getattr read };
+
+ifdef(`hald.te', `
+allow cupsd_t hald_t:dbus { send_msg };
+allow hald_t cupsd_t:dbus { send_msg };
+')
domains/program/unused/udev.te +1 -0
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/udev.te policy-1.17.13/domains/program/unused/udev.te
@@ -103,3 +103,4 @@
 
 dbusd_client(system, udev_t)
 
+allow udev_t device_t:dir { relabelfrom relabelto create_dir_perms };
domains/program/unused/updfstab.te +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/updfstab.te policy-1.17.13/domains/program/unused/updfstab.te
@@ -60,5 +60,5 @@
 allow updfstab_t self:capability dac_override;
 dontaudit updfstab_t self:capability sys_admin;
 
-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } )
 can_getsecurity(updfstab_t)
+dontaudit updfstab_t selinux_config_t:dir search;
file_contexts/program/lvm.fc +0 -5
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/lvm.fc policy-1.17.13/file_contexts/program/lvm.fc
@@ -54,12 +54,7 @@
 /sbin/vgscan.static	--	system_u:object_r:lvm_exec_t
 /sbin/vgsplit		--	system_u:object_r:lvm_exec_t
 /sbin/vgwrapper		--	system_u:object_r:lvm_exec_t
-ifdef(`distro_redhat', `
-/usr/bin/cryptsetup	--	system_u:object_r:lvm_exec_t
-')
-ifdef(`distro_debian', `
 /sbin/cryptsetup	--	system_u:object_r:lvm_exec_t
-')
 /sbin/dmsetup      --      system_u:object_r:lvm_exec_t
 /sbin/dmsetup.static --    system_u:object_r:lvm_exec_t
 /sbin/lvm          --      system_u:object_r:lvm_exec_t
file_contexts/program/saslauthd.fc +2 -2
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/saslauthd.fc policy-1.17.13/file_contexts/program/saslauthd.fc
@@ -1,3 +1,3 @@
 # saslauthd 
-/usr/sbin/saslauthd				--	system_u:object_r:saslauthd_exec_t
-/var/run/saslauthd					system_u:object_r:saslauthd_var_run_t
+/usr/sbin/saslauthd		--	system_u:object_r:saslauthd_exec_t
+/var/run/saslauthd(/.*)?		system_u:object_r:saslauthd_var_run_t
file_contexts/program/xdm.fc +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/xdm.fc policy-1.17.13/file_contexts/program/xdm.fc
@@ -7,7 +7,7 @@
 /usr/var/[xgkw]dm(/.*)?		system_u:object_r:xserver_log_t
 /var/log/[kw]dm\.log	--	system_u:object_r:xserver_log_t
 /var/log/gdm(/.*)?		system_u:object_r:xserver_log_t
-/tmp/\.X0-lock		--	system_u:object_r:xdm_tmp_t
+/tmp/\.X0-lock		--	system_u:object_r:xdm_xserver_tmp_t
 /etc/X11/Xsession[^/]*	--	system_u:object_r:xsession_exec_t
 /etc/X11/wdm(/.*)?		system_u:object_r:xdm_rw_etc_t
 /etc/X11/wdm/Xsetup.*	--	system_u:object_r:xsession_exec_t
file_contexts/program/xserver.fc +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/xserver.fc policy-1.17.13/file_contexts/program/xserver.fc
@@ -11,7 +11,7 @@
 /var/log/XFree86.*	--	system_u:object_r:xserver_log_t
 /var/log/Xorg.*		--	system_u:object_r:xserver_log_t
 /etc/init\.d/xfree86-common --	system_u:object_r:xserver_exec_t
-/tmp/\.X11-unix		-d	system_u:object_r:xdm_xserver_tmp_t
+/tmp/\.X11-unix		-d	system_u:object_r:xdm_tmp_t
 /tmp/\.X11-unix/.*	-s	<<none>>
 /tmp/\.ICE-unix		-d	system_u:object_r:xdm_xserver_tmp_t
 /tmp/\.ICE-unix/.*	-s	<<none>>
macros/program/dbusd_macros.te +9 -1
diff --exclude-from=exclude -N -u -r nsapolicy/macros/program/dbusd_macros.te policy-1.17.13/macros/program/dbusd_macros.te
@@ -22,7 +22,8 @@
 type $1_dbusd_t, domain, privlog, userspace_objmgr;
 role $1_r types $1_dbusd_t;
 domain_auto_trans($1_t, dbusd_exec_t, $1_dbusd_t)
-
+read_locale($1_dbusd_t)
+dontaudit $1_dbusd_t var_t:dir { getattr search };
 ')dnl end ifdef single_userdomain
 ')dnl end ifelse system
 
@@ -30,6 +31,12 @@
 uses_shlib($1_dbusd_t)
 allow $1_dbusd_t etc_t:file { getattr read };
 r_dir_file($1_dbusd_t, etc_dbusd_t)
+tmp_domain($1_dbusd) 
+allow $1_dbusd_t self:process { fork };
+ifdef(`xdm.te', `
+allow $1_dbusd_t xdm_t:fd { use };
+allow $1_dbusd_t xdm_t:fifo_file { write };
+')
 
 allow $1_dbusd_t self:unix_stream_socket create_stream_socket_perms;
 allow $1_dbusd_t self:unix_dgram_socket create_socket_perms;
@@ -58,5 +65,6 @@
 ') dnl endif system
 # SE-DBus specific permissions
 allow $2 { $1_dbusd_t self }:dbus { send_msg };
+allow $2 $1_dbusd_t:dbus { acquire_svc };
 ') dnl endif dbusd.te
 ')
Makefile +6 -1
diff --exclude-from=exclude -N -u -r nsapolicy/Makefile policy-1.17.13/Makefile
@@ -52,13 +52,18 @@
 FCFILES=file_contexts/types.fc $(patsubst domains/program/%.te,file_contexts/program/%.fc, $(wildcard domains/program/*.te)) $(wildcard file_contexts/misc/*.fc)
 
 APPDIR=$(CONTEXTPATH)
-APPFILES = $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context userhelper_context)
+APPFILES = $(addprefix $(APPDIR)/,default_contexts default_type initrc_context failsafe_context userhelper_context) $(CONTEXTPATH)/files/media
+
 ROOTFILES = $(addprefix $(APPDIR)/users/,root)
 
 install: $(APPFILES) $(ROOTFILES) $(LOADPATH) $(FCPATH) 
 	@echo "Validating file_contexts ..."	
 	$(SETFILES) -q -c $(LOADPATH) $(FCPATH)
 
+$(CONTEXTPATH)/files/media: appconfig/media
+	mkdir -p $(CONTEXTPATH)/files/
+	install -m 644 $< $@
+
 $(APPDIR)/default_contexts: appconfig/default_contexts
 	mkdir -p $(APPDIR)
 	install -m 644 $< $@
tunables/distro.tun +1 -1
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/distro.tun policy-1.17.13/tunables/distro.tun
@@ -5,7 +5,7 @@
 # appropriate ifdefs.
 
 
-dnl define(`distro_redhat')
+define(`distro_redhat')
 
 dnl define(`distro_suse')
 
tunables/tunable.tun +11 -14
diff --exclude-from=exclude -N -u -r nsapolicy/tunables/tunable.tun policy-1.17.13/tunables/tunable.tun
@@ -1,54 +1,51 @@
 # Allow all domains to connect to nscd
-dnl define(`nscd_all_connect')
+define(`nscd_all_connect')
 
 # Allow users to control network interfaces (also needs USERCTL=true)
 dnl define(`user_net_control')
 
 # Allow users to execute the mount command
-dnl define(`user_can_mount')
+define(`user_can_mount')
 
 # Allow rpm to run unconfined.
-dnl define(`unlimitedRPM')
+define(`unlimitedRPM')
 
 # Allow privileged utilities like hotplug and insmod to run unconfined.
-dnl define(`unlimitedUtils')
+define(`unlimitedUtils')
 
 # Support NFS home directories
-dnl define(`nfs_home_dirs')
+define(`nfs_home_dirs')
 
 # Allow users to run games
-dnl define(`use_games')
+define(`use_games')
 
 # Allow ypbind to run with NIS
-dnl define(`allow_ypbind')
+define(`allow_ypbind')
 
 # Allow rc scripts to run unconfined, including any daemon
 # started by an rc script that does not have a domain transition
 # explicitly defined.
-dnl define(`unlimitedRC')
+define(`unlimitedRC')
 
 # Allow sysadm_t to directly start daemons
 define(`direct_sysadm_daemon')
 
 # Do not audit things that we know to be broken but which
 # are not security risks
-dnl define(`hide_broken_symptoms')
+define(`hide_broken_symptoms')
 
 # Allow sysadm_t to do almost everything
 dnl define(`unrestricted_admin')
 
 # Allow the read/write/create on any NFS file system
-dnl define(`nfs_export_all_rw')
-
-# Allow users to unrestricted access
-dnl define(`unlimitedUsers')
+define(`nfs_export_all_rw')
 
 # Allow the reading on any NFS file system
 dnl define(`nfs_export_all_ro')
 
 # Allow user_r to reach sysadm_r via su, sudo, or userhelper.
 # Otherwise, only staff_r can do so.
-dnl define(`user_canbe_sysadm')
+define(`user_canbe_sysadm')
 
 # Allow xinetd to run unconfined, including any services it starts
 # that do not have a domain transition explicitly defined.
#3 lore raw
Quoted 2 lines · Daniel J Walsh

Latest policy. More stuff for dbus. Added media file. Changes for
udev on tmpfs.

Conflicts with our latest patches.

domains/program/ifconfig.te line 27

Quoted 4 lines

______________________________________________________________________

domains/program/ifconfig.te +1 -1
-allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
+allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write setopt };

I just replaced this with rw_netlink_socket_perms in our tree.

domains/program/unused/updfstab.te line 64

Quoted 3 lines
domains/program/unused/updfstab.te +1 -1
-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } )
 can_getsecurity(updfstab_t)
+dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

file_contexts/program/xserver.fc line 17

Quoted 12 lines

diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/xserver.fc policy-1.17.13/file_contexts/program/xserver.fc

file_contexts/program/xserver.fc +1 -1
@@ -11,7 +11,7 @@
 /var/log/XFree86.*	--	system_u:object_r:xserver_log_t
 /var/log/Xorg.*		--	system_u:object_r:xserver_log_t
 /etc/init\.d/xfree86-common --	system_u:object_r:xserver_exec_t
-/tmp/\.X11-unix		-d	system_u:object_r:xdm_xserver_tmp_t
+/tmp/\.X11-unix		-d	system_u:object_r:xdm_tmp_t
 /tmp/\.X11-unix/.*	-s	<<none>>
 /tmp/\.ICE-unix		-d	system_u:object_r:xdm_xserver_tmp_t
 /tmp/\.ICE-unix/.*	-s	<<none>>

I know that this was motivated by the relabel cycling reported by Tom London, but it raises an obvious question - who is creating this directory? Is it truly [xdk]dm? If not, why it is being created in xdm_tmp_t rather than xdm_xserver_t?

Quoted 1 line

+dontaudit $1_dbusd_t var_t:dir { getattr search };

Hmm...I was going to give it access to read /var/run/console, as with the system dbus daemon. Does the per-session dbusd not need it?

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 10 lines · Stephen Smalley
Quoted 3 lines · Daniel J Walsh

Latest policy. More stuff for dbus. Added media file. Changes for udev on tmpfs.

Conflicts with our latest patches.

Ok

Quoted 10 lines

domains/program/ifconfig.te line 27

Quoted 5 lines

______________________________________________________________________

domains/program/ifconfig.te +1 -1
-allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
+allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write setopt };

I just replaced this with rw_netlink_socket_perms in our tree.

Yes I saw that.

Quoted 11 lines
Quoted 5 lines

-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } ) can_getsecurity(updfstab_t)
+dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

Ok somebody else must have made that change.

Quoted 24 lines
Quoted 11 lines

diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/xserver.fc policy-1.17.13/file_contexts/program/xserver.fc

file_contexts/program/xserver.fc +0 -0
@@ -11,7 +11,7 @@

/var/log/XFree86.* -- system_u:object_r:xserver_log_t
/var/log/Xorg.* -- system_u:object_r:xserver_log_t
/etc/init\.d/xfree86-common -- system_u:object_r:xserver_exec_t

file_contexts/program/xserver.fc +1 -1
-/tmp/\.X11-unix		-d	system_u:object_r:xdm_xserver_tmp_t
+/tmp/\.X11-unix		-d	system_u:object_r:xdm_tmp_t
Quoted 5 lines

/tmp/\.X11-unix/.* -s <<none>>
/tmp/\.ICE-unix -d system_u:object_r:xdm_xserver_tmp_t
/tmp/\.ICE-unix/.* -s <<none>>

I know that this was motivated by the relabel cycling reported by Tom London, but it raises an obvious question - who is creating this directory? Is it truly [xdk]dm? If not, why it is being created in xdm_tmp_t rather than xdm_xserver_t?

Quoted 9 lines
Quoted 3 lines

+dontaudit $1_dbusd_t var_t:dir { getattr search };

Hmm...I was going to give it access to read /var/run/console, as with the system dbus daemon. Does the per-session dbusd not need it?

Colin will need to comment on this.

--
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.

#5 lore raw
In reply to Stephen Smalley
Quoted 29 lines · Stephen Smalley
Quoted 2 lines · Daniel J Walsh

Latest policy. More stuff for dbus. Added media file. Changes for
udev on tmpfs.

Conflicts with our latest patches.

domains/program/ifconfig.te line 27

Quoted 4 lines

______________________________________________________________________

domains/program/ifconfig.te +1 -1
-allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
+allow ifconfig_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write setopt };

I just replaced this with rw_netlink_socket_perms in our tree.

domains/program/unused/updfstab.te line 64

Quoted 3 lines
domains/program/unused/updfstab.te +1 -1
-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } )
 can_getsecurity(updfstab_t)
+dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

Quoted 9 lines

diff --exclude-from=exclude -N -u -r nsapolicy/file_contexts/program/xserver.fc policy-1.17.13/file_contexts/program/xserver.fc

file_contexts/program/xserver.fc +1 -1
@@ -11,7 +11,7 @@
 /var/log/XFree86.*	--	system_u:object_r:xserver_log_t
 /var/log/Xorg.*		--	system_u:object_r:xserver_log_t
 /etc/init\.d/xfree86-common --	system_u:object_r:xserver_exec_t
-/tmp/\.X11-unix		-d	system_u:object_r:xdm_xserver_tmp_t
+/tmp/\.X11-unix		-d	system_u:object_r:xdm_tmp_t
Quoted 9 lines

file_contexts/program/xserver.fc line 17

Quoted 3 lines
file_contexts/program/xserver.fc +0 -0
 /tmp/\.X11-unix/.*	-s	<<none>>
 /tmp/\.ICE-unix		-d	system_u:object_r:xdm_xserver_tmp_t
 /tmp/\.ICE-unix/.*	-s	<<none>>

I know that this was motivated by the relabel cycling reported by Tom London, but it raises an obvious question - who is creating this directory? Is it truly [xdk]dm? If not, why it is being created in xdm_tmp_t rather than xdm_xserver_t?

i raised a bug on debian about this and the reason is that a number of legacy X programs rely on the location /tmp.

actually i raised the bug about /etc/init.d/xfs so in fact this time /etc/init.d/xfree86-common needs
if [ -x /sbin/restorecon ]; then /sbin/restorecon $ICE_DIR; fi and
if [ -x /sbin/restorecon ]; then /sbin/restorecon $SOCKET_DIR; fi

debian intend to fix the location of all of these post-sarge.

at the moment it'd break too many legacy apps that used to be happy with /tmp.

l.

--
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
In reply to Stephen Smalley
Quoted 7 lines · Stephen Smalley
Quoted 3 lines

-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } ) can_getsecurity(updfstab_t) +dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

Why do we want to have updfstab do that? Adding such functionality to updfstab means more work for it to do, more time taken to complete, etc.

Just having updfstab create the new file as /etc/fstab.new (or similar) makes it get the right context automatically with much less effort.

We don't want to change every program that creates a file to preserve the SE Linux context! That would take significant development work and create significant issues if the SE Linux interfaces ever change.

The source to fstab-sync refers to the idea of creating a new fstab file in /tmp if /etc is mounted read-only (with /etc/fstab being a sym-link to somewhere else). If this is implemented as described in the comments then an inopportune power failure or system crash could potentially truncate the fstab file and make the system non-bootable. I think we should give up on the idea of having fstab-sync do anything special in regard to SE Linux.

Dan, what do you think?

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

-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } ) can_getsecurity(updfstab_t) +dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

Why do we want to have updfstab do that? Adding such functionality to updfstab means more work for it to do, more time taken to complete, etc.

Quoted 10 lines

Just having updfstab create the new file as /etc/fstab.new (or similar) makes it get the right context automatically with much less effort.

We don't want to change every program that creates a file to preserve the SE Linux context! That would take significant development work and create significant issues if the SE Linux interfaces ever change.

The source to fstab-sync refers to the idea of creating a new fstab file in /tmp if /etc is mounted read-only (with /etc/fstab being a sym-link to somewhere else). If this is implemented as described in the comments then an inopportune power failure or system crash could potentially truncate the fstab file and make the system non-bootable. I think we should give up on the idea of having fstab-sync do anything special in regard to SE Linux.

Dan, what do you think?

That sounds good to me. I will look into who made the change and see if we remedy this.

--
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.

#8 lore raw
In reply to Russell Coker
Quoted 16 lines · Russell Coker
Quoted 10 lines · Stephen Smalley
Quoted 5 lines

-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } ) can_getsecurity(updfstab_t) +dontaudit updfstab_t selinux_config_t:dir search;

I don't think that this is correct; updfstab appears to be looking up a context via matchpathcon for preserving the context on /etc/fstab, so it needs access to the file contexts file as in our policy.

Why do we want to have updfstab do that? Adding such functionality to updfstab means more work for it to do, more time taken to complete, etc.

Quoted 10 lines

Just having updfstab create the new file as /etc/fstab.new (or similar) makes it get the right context automatically with much less effort.

We don't want to change every program that creates a file to preserve the SE Linux context! That would take significant development work and create significant issues if the SE Linux interfaces ever change.

The source to fstab-sync refers to the idea of creating a new fstab file in /tmp if /etc is mounted read-only (with /etc/fstab being a sym-link to somewhere else). If this is implemented as described in the comments then an inopportune power failure or system crash could potentially truncate the fstab file and make the system non-bootable. I think we should give up on the idea of having fstab-sync do anything special in regard to SE Linux.

Dan, what do you think?

Talked to the person who did this and he is fixing it. It came about because the temp file was originally being created on /tmp but now is created in /etc/.

Dan

--
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.

#9 lore raw
In reply to Daniel J Walsh

Merged, for the most part, except for what Steve commented on.

Quoted 9 lines · Daniel J Walsh

Latest policy. More stuff for dbus. Added media file. Changes for
udev on tmpfs.

______________________________________________________________________

diff --exclude-from=exclude -N -u -r nsapolicy/domains/program/unused/updfstab.te policy-1.17.13/domains/program/unused/updfstab.te

domains/program/unused/updfstab.te line 64

Quoted 6 lines
domains/program/unused/updfstab.te +1 -1
@@ -60,5 +60,5 @@
 allow updfstab_t self:capability dac_override;
 dontaudit updfstab_t self:capability sys_admin;
 
-r_dir_file(updfstab_t, { selinux_config_t file_context_t default_context_t } )
 can_getsecurity(updfstab_t)
+dontaudit updfstab_t selinux_config_t:dir search;

Will wait for updfstab to be fixed to update its policy.

Signature · 7 lines
James Carter <[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.