Skip to contentSkip to conversation

bounds for tor, mysqld, and entropyd

PATCH New Russell Coker 2 participants 2 messages Sep 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bounds for tor, mysqld, and entropyd

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874201

The following patch fixes 3 instances of the bounds issue as described in the above bug report. There will be more as more maintainers and upstream developers make use of systemd access control features.

policy/modules/system/init.te +1 -0
Index: refpolicy-2.20170907/policy/modules/system/init.te
===================================================================
@@ -295,6 +295,7 @@ ifdef(`init_systemd',`
 	fs_manage_hugetlbfs_dirs(init_t)
 	fs_getattr_tmpfs(init_t)
 	fs_read_tmpfs_files(init_t)
+	fs_read_tmpfs_symlinks(init_t)
 	fs_read_cgroup_files(init_t)
 	fs_relabel_pstore_dirs(init_t)
 	fs_dontaudit_getattr_xattr_fs(init_t)
policy/modules/contrib/entropyd.te +5 -0
Index: refpolicy-2.20170907/policy/modules/contrib/entropyd.te
===================================================================
@@ -50,6 +50,7 @@ files_read_usr_files(entropyd_t)
 
 fs_getattr_all_fs(entropyd_t)
 fs_search_auto_mountpoints(entropyd_t)
+fs_search_tmpfs(entropyd_t)
 
 domain_use_interactive_fds(entropyd_t)
 
@@ -65,6 +66,10 @@ tunable_policy(`entropyd_use_audio',`
 	dev_write_sound(entropyd_t)
 ')
 
+ifdef(`init_systemd',`
+	init_bounded(entropyd_t, entropyd_exec_t)
+')
+
 optional_policy(`
 	tunable_policy(`entropyd_use_audio',`
 		alsa_read_lib(entropyd_t)
policy/modules/contrib/tor.te +4 -0
Index: refpolicy-2.20170907/policy/modules/contrib/tor.te
===================================================================
@@ -118,6 +118,10 @@ tunable_policy(`tor_bind_all_unreserved_
 	corenet_tcp_bind_all_unreserved_ports(tor_t)
 ')
 
+ifdef(`init_systemd',`
+	init_bounded(tor_t, tor_exec_t)
+')
+
 optional_policy(`
 	seutil_sigchld_newrole(tor_t)
 ')
policy/modules/system/init.if +25 -0
Index: refpolicy-2.20170907/policy/modules/system/init.if
===================================================================
@@ -314,6 +314,31 @@ interface(`init_ranged_daemon_domain',`
 	')
 ')
 
+########################################
+## <summary>
+##     Make a domain be bounded by init_t
+##     NB init_t needs to have all the permissions of the domain in question
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Bounded domain
+##     </summary>
+## </param>
+## <param name="entry_point">
+##	<summary>
+##	Type of the program to be used as an entry point to this domain.
+##	</summary>
+## </param>
+#
+interface(`init_bounded',`
+	gen_require(`
+		type init_t;
+	')
+
+	typebounds init_t $1;
+	allow init_t $2:file entrypoint;
+')
+
 #########################################
 ## <summary>
 ##	Abstract socket service activation (systemd).
policy/modules/contrib/mysql.te +5 -0
Index: refpolicy-2.20170907/policy/modules/contrib/mysql.te
===================================================================
@@ -125,6 +125,7 @@ domain_use_interactive_fds(mysqld_t)
 
 fs_getattr_all_fs(mysqld_t)
 fs_search_auto_mountpoints(mysqld_t)
+fs_search_tmpfs(mysqld_t)
 fs_rw_hugetlbfs_files(mysqld_t)
 
 files_read_etc_runtime_files(mysqld_t)
@@ -149,6 +150,10 @@ optional_policy(`
 	daemontools_service_domain(mysqld_t, mysqld_exec_t)
 ')
 
+ifdef(`init_systemd',`
+	init_bounded(mysqld_t, mysqld_exec_t)
+')
+
 optional_policy(`
 	seutil_sigchld_newrole(mysqld_t)
 ')
#1 lore raw

PATCH 1/1 bounds for tor, mysqld, and entropyd

Quoted 5 lines · Russell Coker via refpolicy

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=874201

The following patch fixes 3 instances of the bounds issue as described in the above bug report. There will be more as more maintainers and upstream developers make use of systemd access control features.

NAK. This has already been fixed with the upcoming nnp_transition nosuid_transition permissions in refpolicy. I'm afraid distros will have to carry policy patches until they can roll out kernels that support these permissions.

https://marc.info/?l=selinux&m=150151037511601&w=2

Quoted 114 lines

Index: refpolicy-2.20170907/policy/modules/system/init.te
===================================================================

policy/modules/system/init.te +1 -0
@@ -295,6 +295,7 @@ ifdef(`init_systemd',`
  fs_manage_hugetlbfs_dirs(init_t)
  fs_getattr_tmpfs(init_t)
  fs_read_tmpfs_files(init_t)
+ fs_read_tmpfs_symlinks(init_t)
  fs_read_cgroup_files(init_t)
  fs_relabel_pstore_dirs(init_t)
  fs_dontaudit_getattr_xattr_fs(init_t)

Index: refpolicy-2.20170907/policy/modules/contrib/entropyd.te
===================================================================

policy/modules/contrib/entropyd.te +5 -0
@@ -50,6 +50,7 @@ files_read_usr_files(entropyd_t)
 
  fs_getattr_all_fs(entropyd_t)
  fs_search_auto_mountpoints(entropyd_t)
+fs_search_tmpfs(entropyd_t)
 
  domain_use_interactive_fds(entropyd_t)
 
@@ -65,6 +66,10 @@ tunable_policy(`entropyd_use_audio',`
  dev_write_sound(entropyd_t)
  ')
 
+ifdef(`init_systemd',`
+ init_bounded(entropyd_t, entropyd_exec_t)
+')
+
  optional_policy(`
  tunable_policy(`entropyd_use_audio',`
  alsa_read_lib(entropyd_t)

Index: refpolicy-2.20170907/policy/modules/contrib/tor.te
===================================================================

policy/modules/contrib/tor.te +4 -0
@@ -118,6 +118,10 @@ tunable_policy(`tor_bind_all_unreserved_
  corenet_tcp_bind_all_unreserved_ports(tor_t)
  ')
 
+ifdef(`init_systemd',`
+ init_bounded(tor_t, tor_exec_t)
+')
+
  optional_policy(`
  seutil_sigchld_newrole(tor_t)
  ')

Index: refpolicy-2.20170907/policy/modules/system/init.if
===================================================================

policy/modules/system/init.if +25 -0
@@ -314,6 +314,31 @@ interface(`init_ranged_daemon_domain',`
  ')
  ')
 
+########################################
+## <summary>
+##     Make a domain be bounded by init_t
+##     NB init_t needs to have all the permissions of the domain in question
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Bounded domain
+##     </summary>
+## </param>
+## <param name="entry_point">
+## <summary>
+## Type of the program to be used as an entry point to this domain.
+## </summary>
+## </param>
+#
+interface(`init_bounded',`
+ gen_require(`
+ type init_t;
+ ')
+
+ typebounds init_t $1;
+ allow init_t $2:file entrypoint;
+')
+
  #########################################
  ## <summary>
  ## Abstract socket service activation (systemd).

Index: refpolicy-2.20170907/policy/modules/contrib/mysql.te
===================================================================

policy/modules/contrib/mysql.te +5 -0
@@ -125,6 +125,7 @@ domain_use_interactive_fds(mysqld_t)
 
  fs_getattr_all_fs(mysqld_t)
  fs_search_auto_mountpoints(mysqld_t)
+fs_search_tmpfs(mysqld_t)
  fs_rw_hugetlbfs_files(mysqld_t)
 
  files_read_etc_runtime_files(mysqld_t)
@@ -149,6 +150,10 @@ optional_policy(`
  daemontools_service_domain(mysqld_t, mysqld_exec_t)
  ')
 
+ifdef(`init_systemd',`
+ init_bounded(mysqld_t, mysqld_exec_t)
+')
+
  optional_policy(`
  seutil_sigchld_newrole(mysqld_t)
  ')

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

Signature · 1 line
Chris PeBenito