Skip to contentSkip to conversation

Application_domain

PATCH Daniel J Walsh 2 participants 3 messages Aug 2, 2007 – Aug 7, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

My definition of the application domain, is any file that a normal user is expected to execute. It can either have a transition or not. If I define application_domain then it will transition. If I just define application_executable_file, then logged in users can execute it without a transition.

Daemons for the most part should NOT be application_domains. This way we can dontaudit getattr of daemons that users would/should not be allowed to execute.

Some applictions can be in both domains. For example cvs, rsync can be run without transitioning by users but when run from an initscript they transition.

This patch makes changes to the pool to match this.

I included the entire readahead patch in this patch as this should

policy/modules/admin/acct.te +1 -0
@@ -9,6 +9,7 @@
 type acct_t;
 type acct_exec_t;
 init_system_domain(acct_t,acct_exec_t)
+application_executable_file(acct_exec_t)
 
 type acct_data_t;
 logging_log_file(acct_data_t)
policy/modules/admin/netutils.te +1 -0
@@ -29,6 +29,7 @@
 type traceroute_t;
 type traceroute_exec_t;
 init_system_domain(traceroute_t,traceroute_exec_t)
+application_executable_file(traceroute_exec_t)
 role system_r types traceroute_t;
 
 ########################################
policy/modules/admin/rpm.te +2 -0
@@ -9,6 +9,8 @@
 type rpm_t;
 type rpm_exec_t;
 init_system_domain(rpm_t,rpm_exec_t)
+application_executable_file(rpm_exec_t)
+
 domain_obj_id_change_exemption(rpm_t)
 domain_role_change_exemption(rpm_t)
 domain_system_change_exemption(rpm_t)
policy/modules/services/cvs.te +1 -0
@@ -16,6 +16,7 @@
 type cvs_t;
 type cvs_exec_t;
 inetd_tcp_service_domain(cvs_t,cvs_exec_t)
+application_executable_file(cvs_exec_t)
 role system_r types cvs_t;
 
 type cvs_data_t; # customizable
policy/modules/services/rsync.te +1 -0
@@ -17,6 +17,7 @@
 type rsync_t;
 type rsync_exec_t;
 init_daemon_domain(rsync_t,rsync_exec_t)
+application_executable_file(rsync_exec_t)
 role system_r types rsync_t;
 
 type rsync_data_t;
policy/modules/services/ssh.te +1 -1
@@ -24,7 +24,7 @@
 
 # Type for the ssh-agent executable.
 type ssh_agent_exec_t;
-files_type(ssh_agent_exec_t)
+application_executable_file(ssh_agent_exec_t)
 
 # ssh client executable.
 type ssh_exec_t;
policy/modules/system/application.if +20 -0
@@ -63,6 +63,26 @@
 
 ########################################
 ## <summary>
+##	Execute all executable files.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`application_exec_all',`
+       # Need this dontaudit or command completion fires hundreds of avcs
+       corecmd_dontaudit_exec_all_executables($1)
+       corecmd_exec_bin($1)
+       corecmd_exec_shell($1)
+       corecmd_exec_chroot($1)
+       application_exec($1)
+')
+
+########################################
+## <summary>
 ##	Create a domain which can be started by users
 ## </summary>
 ## <param name="domain">
policy/modules/system/fstools.te +1 -0
@@ -9,6 +9,7 @@
 type fsadm_t;
 type fsadm_exec_t;
 init_system_domain(fsadm_t,fsadm_exec_t)
+application_executable_file(fsadm_exec_t)
 role system_r types fsadm_t;
 
 type fsadm_log_t;
policy/modules/system/init.if +5 -1
@@ -194,9 +194,13 @@
 	gen_require(`
 		type initrc_t;
 		role system_r;
+		attribute daemon;
 	')
 
-	application_domain($1,$2)
+	domain_type($1)
+	domain_entry_file($1,$2)
+
+	typeattribute $1 daemon;
 
 	role system_r types $1;
 
policy/modules/system/lvm.te +1 -0
@@ -16,6 +16,7 @@
 type lvm_t;
 type lvm_exec_t;
 init_system_domain(lvm_t,lvm_exec_t)
+application_executable_file(lvm_exec_t)
 # needs privowner because it assigns the identity system_u to device nodes
 # but runs as the identity of the sysadmin
 domain_obj_id_change_exemption(lvm_t)
policy/modules/system/mount.te +5 -3
@@ -16,19 +23,21 @@
 type mount_t;
 type mount_exec_t;
 init_system_domain(mount_t,mount_exec_t)
+application_executable_file(mount_exec_t)
 role system_r types mount_t;
 
+typealias mount_t alias mount_ntfs_t;
+typealias mount_exec_t alias mount_ntfs_exec_t;
+
 type mount_loopback_t; # customizable
 files_type(mount_loopback_t)
 
 type mount_tmp_t;
 files_tmp_file(mount_tmp_t)
 
-# causes problems with interfaces when
-# this is optionally declared in monolithic
-# policy--duplicate type declaration
 type unconfined_mount_t;
 application_domain(unconfined_mount_t,mount_exec_t)
+role system_r types unconfined_mount_t;
 
 ########################################
 #
policy/modules/system/userdomain.if +4 -0
@@ -62,6 +62,10 @@
 
 	allow $1_t $1_tty_device_t:chr_file { setattr rw_chr_file_perms };
 
+	application_exec_all($1_t)
+
+	auth_use_nsswitch($1_t)
+
 	kernel_read_kernel_sysctls($1_t)
 	kernel_dontaudit_list_unlabeled($1_t)
 	kernel_dontaudit_getattr_unlabeled_files($1_t)
#1 lore raw
Quoted 10 lines · Daniel J Walsh

My definition of the application domain, is any file that a normal
user is expected to execute. It can either have a transition or
not. If I define application_domain then it will transition. If I just define application_executable_file, then logged in users can execute it without a transition.

Daemons for the most part should NOT be application_domains. This
way we can dontaudit getattr of daemons that users would/should not be allowed to execute.

Quoted 5 lines

Some applictions can be in both domains. For example cvs, rsync can be run without transitioning by users but when run from an initscript they transition.

This patch makes changes to the pool to match this.

If you look back at what you're changing, init_system_domains() are all apps, so the call is in that interface. Your patch undoes this.

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.
#2 lore raw
Quoted 16 lines · Christopher J. PeBenito
Quoted 14 lines · Daniel J Walsh

My definition of the application domain, is any file that a normal
user is expected to execute. It can either have a transition or
not. If I define application_domain then it will transition. If I just define application_executable_file, then logged in users can execute it without a transition.

Daemons for the most part should NOT be application_domains. This
way we can dontaudit getattr of daemons that users would/should not be allowed to execute.

Some applictions can be in both domains. For example cvs, rsync can be run without transitioning by users but when run from an initscript they transition.

Quoted 7 lines
Quoted 2 lines

This patch makes changes to the pool to match this.

If you look back at what you're changing, init_system_domains() are all apps, so the call is in that interface. Your patch undoes this.

Ok I guess your right, even though some of these being user executables is a little shaky.

Reverting patch in rawhide.

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