Skip to contentSkip to conversation

Latest diffs. Trimmed down this time.

PATCH Daniel J Walsh 3 participants 5 messages Sep 25, 2006 – Sep 28, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Unlinking the /etc/prelink.cache file requires ability allow $1 etc_t:dir rw_dir_perms;

slocate needs to getattr on rpc_pipefs

mdadm does a getattr on everything in /dev. Need to dontaudit device_t:file getattr;

Adding a cron_var_lib_t and cron_log_t so that sysadm_cron_t can write to these directories. Policy explains which scripts need these privs

Additional lpr_exec_t applications

Corrected oddjob policy

Sendmail needs to read netlink_route_socket

Switch fsdaemon to mls_read_up

Doesn't ssh need
+ userdom_search_all_users_home_dirs(sshd_t)

Cups init script wants to clear the error_log

auditd_log_t is supposed to be able to have a device mounted on it for compliance reasons.

mdadm wants to getattr_core_if

policy/modules/admin/prelink.if +1 -1
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/admin/prelink.if serefpolicy-2.3.16/policy/modules/admin/prelink.if
@@ -76,7 +76,7 @@
 	gen_require(`
 		type prelink_cache_t;
 	')
-
+	files_rw_etc_dir($1)
 	allow $1 prelink_cache_t:file unlink;
 ')
 
policy/modules/admin/readahead.te +2 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/admin/readahead.te serefpolicy-2.3.16/policy/modules/admin/readahead.te
@@ -36,6 +36,8 @@
 dev_getattr_all_blk_files(readahead_t)
 dev_dontaudit_read_all_blk_files(readahead_t)
 dev_dontaudit_getattr_memory_dev(readahead_t)
+dev_dontaudit_getattr_nvram(readahead_t)
+storage_dontaudit_getattr_fixed_disk_dev(readahead_t)
 
 domain_use_interactive_fds(readahead_t)
 
policy/modules/apps/slocate.te +1 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/apps/slocate.te serefpolicy-2.3.16/policy/modules/apps/slocate.te
@@ -45,6 +45,7 @@
 files_dontaudit_getattr_all_dirs(locate_t)
 
 fs_getattr_xattr_fs(locate_t)
+fs_getattr_rpc_pipefs(locate_t)
 
 libs_use_shared_libs(locate_t)
 libs_use_ld_so(locate_t)
policy/modules/kernel/devices.if +20 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/kernel/devices.if serefpolicy-2.3.16/policy/modules/kernel/devices.if
@@ -3211,3 +3211,23 @@
 
 	typeattribute $1 devices_unconfined_type;
 ')
+
+########################################
+## <summary>
+##	dontaudit getattr generic files in /dev.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain to not audit.
+##	</summary>
+## </param>
+#
+interface(`dev_dontaudit_getattr_generic_files',`
+	gen_require(`
+		type device_t;
+	')
+
+	allow $1 device_t:dir search;
+	dontaudit $1 device_t:file getattr;
+')
+
policy/modules/kernel/files.if +20 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/kernel/files.if serefpolicy-2.3.16/policy/modules/kernel/files.if
@@ -4541,3 +4541,23 @@
 
 	typealias etc_runtime_t alias $1;
 ')
+
+########################################
+## <summary>
+##	Read and write files in /etc.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`files_rw_etc_dir',`
+	gen_require(`
+		type etc_t;
+	')
+
+	allow $1 etc_t:dir rw_dir_perms;
+')
+
policy/modules/kernel/storage.if +1 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/kernel/storage.if serefpolicy-2.3.16/policy/modules/kernel/storage.if
@@ -37,6 +37,7 @@
 	')
 
 	dontaudit $1 fixed_disk_device_t:blk_file getattr;
+	dontaudit $1 fixed_disk_device_t:chr_file getattr; # /dev/rawctl
 ')
 
 ########################################
policy/modules/services/automount.te +1 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/automount.te serefpolicy-2.3.16/policy/modules/services/automount.te
@@ -74,6 +76,7 @@
 files_mounton_all_mountpoints(automount_t)
 files_mount_all_file_type_fs(automount_t)
 files_unmount_all_file_type_fs(automount_t)
+files_manage_non_security_dirs(automount_t)
 
 fs_mount_all_fs(automount_t)
 fs_unmount_all_fs(automount_t)
policy/modules/services/cron.te +19 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/cron.te serefpolicy-2.3.16/policy/modules/services/cron.te
@@ -17,6 +17,14 @@
 type cron_spool_t;
 files_type(cron_spool_t)
 
+# var/lib files
+type cron_var_lib_t;
+files_type(cron_var_lib_t)
+
+# var/log files
+type cron_log_t;
+logging_log_file(cron_log_t)
+
 type crond_t;
 # real declaration moved to mls until
 # range_transition works in loadable modules
@@ -184,6 +192,17 @@
 	files_tmp_filetrans(crond_t, crond_tmp_t, { file dir })
 ')
 
+# This is to handle /var/lib/misc directory.  Used currently by prelink
+# var/lib files for cron 
+allow system_crond_t cron_var_lib_t:file create_file_perms;
+files_var_lib_filetrans(system_crond_t,cron_var_lib_t,file)
+
+# This is to handle creation of files in /var/log directory.  Used currently by rpm script
+# log files
+allow system_crond_t cron_log_t:file create_file_perms;
+logging_log_filetrans(system_crond_t,cron_log_t,{ file })
+
+
 tunable_policy(`fcron_crond', `
 	allow crond_t system_cron_spool_t:file create_file_perms;
 ')
policy/modules/services/lpd.fc +3 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/lpd.fc serefpolicy-2.3.16/policy/modules/services/lpd.fc
@@ -8,11 +8,14 @@
 #
 /usr/sbin/checkpc	--	gen_context(system_u:object_r:checkpc_exec_t,s0)
 /usr/sbin/lpd		--	gen_context(system_u:object_r:lpd_exec_t,s0)
+/usr/sbin/lpadmin	--	gen_context(system_u:object_r:lpr_exec_t,s0)
+/usr/sbin/lpc(\.cups)?	--	gen_context(system_u:object_r:lpr_exec_t,s0)
 /usr/share/printconf/.* --	gen_context(system_u:object_r:printconf_t,s0)
 /usr/bin/lp(\.cups)?	--	gen_context(system_u:object_r:lpr_exec_t,s0)
 /usr/bin/lpr(\.cups)?	--	gen_context(system_u:object_r:lpr_exec_t,s0)
 /usr/bin/lpq(\.cups)?	--	gen_context(system_u:object_r:lpr_exec_t,s0)
 /usr/bin/lprm(\.cups)?	--	gen_context(system_u:object_r:lpr_exec_t,s0)
+/usr/bin/lpstat(\.cups)? --	gen_context(system_u:object_r:lpr_exec_t,s0)
 
 #
 # /var
policy/modules/services/oddjob.fc +8 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/oddjob.fc serefpolicy-2.3.16/policy/modules/services/oddjob.fc
@@ -0,0 +1,8 @@
+# oddjob executable will have:
+# label: system_u:object_r:oddjob_exec_t
+# MLS sensitivity: s0
+# MCS categories: <none>
+
+/usr/sbin/oddjobd		--	gen_context(system_u:object_r:oddjob_exec_t,s0)
+/var/run/oddjobd.pid			gen_context(system_u:object_r:oddjob_var_run_t,s0)
+/usr/lib/oddjob/mkhomedir	--	gen_context(system_u:object_r:oddjob_mkhomedir_exec_t,s0)
policy/modules/services/oddjob.if +99 -0

99 lines not on this page · raw message

policy/modules/services/oddjob.te +85 -0

85 lines not on this page · raw message

policy/modules/services/sendmail.te +1 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/sendmail.te serefpolicy-2.3.16/policy/modules/services/sendmail.te
@@ -32,6 +32,7 @@
 allow sendmail_t self:unix_dgram_socket create_socket_perms;
 allow sendmail_t self:tcp_socket create_stream_socket_perms;
 allow sendmail_t self:udp_socket create_socket_perms;
+allow sendmail_t self:netlink_route_socket r_netlink_socket_perms;
 
 allow sendmail_t sendmail_log_t:file create_file_perms;
 allow sendmail_t sendmail_log_t:dir { rw_dir_perms setattr };
policy/modules/services/smartmon.te +3 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/smartmon.te serefpolicy-2.3.16/policy/modules/services/smartmon.te
@@ -60,8 +60,11 @@
 fs_getattr_all_fs(fsdaemon_t)
 fs_search_auto_mountpoints(fsdaemon_t)
 
+mls_file_read_up(fsdaemon_t)
+
 storage_raw_read_fixed_disk(fsdaemon_t)
 storage_raw_write_fixed_disk(fsdaemon_t)
+storage_raw_read_removable_device(fsdaemon_t)
 
 term_dontaudit_use_console(fsdaemon_t)
 term_dontaudit_search_ptys(fsdaemon_t)
policy/modules/services/ssh.te +4 -3
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/services/ssh.te serefpolicy-2.3.16/policy/modules/services/ssh.te
@@ -72,18 +72,19 @@
 	# so a tunnel can point to another ssh tunnel
 	allow sshd_t self:netlink_route_socket r_netlink_socket_perms;
 	allow sshd_t self:key { search link write };
-
 	allow sshd_t sshd_tmp_t:dir create_dir_perms;
 	allow sshd_t sshd_tmp_t:file create_file_perms;
 	allow sshd_t sshd_tmp_t:sock_file create_file_perms;
 	files_tmp_filetrans(sshd_t, sshd_tmp_t, { dir file sock_file })
 
-	kernel_link_key(sshd_t)
-
 	# for X forwarding
 	corenet_tcp_bind_xserver_port(sshd_t)
 	corenet_sendrecv_xserver_server_packets(sshd_t)
 
+	kernel_link_key(sshd_t)
+
+	userdom_search_all_users_home_dirs(sshd_t)
+
 	tunable_policy(`ssh_sysadm_login',`
 		# Relabel and access ptys created by sshd
 		# ioctl is necessary for logout() processing for utmp entry and for w to
policy/modules/system/init.te +2 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/system/init.te serefpolicy-2.3.16/policy/modules/system/init.te
@@ -579,6 +580,8 @@
 	dev_getattr_printer_dev(initrc_t)
 
 	cups_read_log(initrc_t)
+#cups init script clears error log
+	cups_write_log(initrc_t)
 	cups_read_rw_config(initrc_t)
 ')
 
policy/modules/system/logging.te +1 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/system/logging.te serefpolicy-2.3.16/policy/modules/system/logging.te
@@ -18,6 +18,7 @@
 
 type auditd_log_t;
 files_security_file(auditd_log_t)
+files_mountpoint(auditd_log_t)
 
 type auditd_t;
 # real declaration moved to mls until
policy/modules/system/raid.te +2 -0
diff --exclude-from=exclude -N -u -r nsaserefpolicy/policy/modules/system/raid.te serefpolicy-2.3.16/policy/modules/system/raid.te
@@ -29,11 +29,13 @@
 kernel_read_system_state(mdadm_t)
 kernel_read_kernel_sysctls(mdadm_t)
 kernel_rw_software_raid_state(mdadm_t)
+kernel_getattr_core_if(mdadm_t)
 
 dev_read_sysfs(mdadm_t)
 # Ignore attempts to read every device file
 dev_dontaudit_getattr_all_blk_files(mdadm_t)
 dev_dontaudit_getattr_all_chr_files(mdadm_t)
+dev_dontaudit_getattr_generic_files(mdadm_t)
 
 fs_search_auto_mountpoints(mdadm_t)
 fs_dontaudit_list_tmpfs(mdadm_t)
#1 lore raw

Hello Daniel,

Quoted 2 lines

Doesn't ssh need
+ userdom_search_all_users_home_dirs(sshd_t)

getattr is supposedly sufficient, no need for searching. See earlier thread.

best regards,
Erich Schubert

Signature · 11 lines
   erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
     You know we all became mathematicians for the same reason:     //\
                  we were lazy. --- Max Rosenlicht                  V_/_
           Es ist besser, geliebt und verloren zu haben,
                   als niemals geliebt zu haben.


--
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 6 lines · Erich Schubert

Hello Daniel,

Quoted 2 lines

Doesn't ssh need
+ userdom_search_all_users_home_dirs(sshd_t)

getattr is supposedly sufficient, no need for searching. See earlier thread.

I've already fixed this in a different way. Getattr by itself is not sufficient, you need search too.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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
In reply to Daniel J Walsh

Merged.

Quoted 1 line · Daniel J Walsh

Corrected oddjob policy

The mkhomedir policy looks incomplete.

fixed the stray

domain_auto_trans(unconfined_t,oddjob_mkhomedir_exec_t,oddjob_mkhomedir_t)

in the module.

Quoted 2 lines

Doesn't ssh need
+ userdom_search_all_users_home_dirs(sshd_t)

See my response to Erich.

Quoted 1 line

Cups init script wants to clear the error_log

Does initrc_t need read on this still?

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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 · Christopher J. PeBenito

Merged.

Quoted 2 lines · Daniel J Walsh

Corrected oddjob policy

The mkhomedir policy looks incomplete.

Yes it needs more testing.

Quoted 4 lines

fixed the stray

domain_auto_trans(unconfined_t,oddjob_mkhomedir_exec_t,oddjob_mkhomedir_t)

Quoted 10 lines

in the module.

Quoted 3 lines

Doesn't ssh need
+ userdom_search_all_users_home_dirs(sshd_t)

See my response to Erich.

I removed this.

Quoted 6 lines
Quoted 2 lines

Cups init script wants to clear the error_log

Does initrc_t need read on this still?

I don't think so.

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