Skip to contentSkip to conversation

latest memlockd patch

PATCH In review Russell Coker 2 participants 2 messages Jan 20, 2021 – Jan 25, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 latest memlockd patch

Includes the ifndef(`distro_debian' section that was requested. Should be ready for merging now.

policy/modules/services/memlockd.fc new file +1 -0
Index: refpolicy-2.20201205/policy/modules/services/memlockd.fc
===================================================================
@@ -0,0 +1 @@
+/usr/sbin/memlockd	--	gen_context(system_u:object_r:memlockd_exec_t,s0)
policy/modules/services/memlockd.if new file +2 -0
Index: refpolicy-2.20201205/policy/modules/services/memlockd.if
===================================================================
@@ -0,0 +1,2 @@
+## <summary>memory lock daemon, keeps important files in RAM.</summary>
+
policy/modules/services/memlockd.te new file +39 -0
Index: refpolicy-2.20201205/policy/modules/services/memlockd.te
===================================================================
@@ -0,0 +1,39 @@
+policy_module(memlockd, 1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type memlockd_t;
+type memlockd_exec_t;
+init_daemon_domain(memlockd_t, memlockd_exec_t)
+
+########################################
+#
+# Local policy
+#
+
+allow memlockd_t self:capability { setgid setuid ipc_lock };
+ifndef(`distro_debian', `
+allow memlockd_t self:capability dac_read_search;
+')
+allow memlockd_t self:fifo_file rw_file_perms;
+
+# cache /etc/shadow too
+auth_read_shadow(memlockd_t)
+auth_map_shadow(memlockd_t)
+
+corecmd_exec_all_executables(memlockd_t)
+corecmd_exec_bin(memlockd_t)
+corecmd_exec_shell(memlockd_t)
+corecmd_read_all_executables(memlockd_t)
+corecmd_search_bin(memlockd_t)
+files_read_etc_files(memlockd_t)
+libs_exec_ld_so(memlockd_t)
+files_map_etc_files(memlockd_t)
+
+logging_send_syslog_msg(memlockd_t)
+miscfiles_read_localization(memlockd_t)
+
+sysnet_mmap_read_config(memlockd_t)
policy/modules/system/sysnetwork.if +25 -0
Index: refpolicy-2.20201205/policy/modules/system/sysnetwork.if
===================================================================
@@ -393,6 +393,31 @@ interface(`sysnet_mmap_config_files',`
 
 #######################################
 ## <summary>
+##	map network config files.
+## </summary>
+## <desc>
+##	<p>
+##	Allow the specified domain to mmap the
+##	general network configuration files.
+##	</p>
+## </desc>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`sysnet_mmap_read_config',`
+	gen_require(`
+		type net_conf_t;
+	')
+
+	files_search_etc($1)
+	allow $1 net_conf_t:file mmap_read_file_perms;
+')
+
+#######################################
+## <summary>
 ##	Do not audit attempts to read network config files.
 ## </summary>
 ## <param name="domain">
policy/modules/system/authlogin.if +17 -0
Index: refpolicy-2.20201205/policy/modules/system/authlogin.if
===================================================================
@@ -577,6 +577,23 @@ interface(`auth_read_shadow',`
 
 ########################################
 ## <summary>
+##	Map the shadow passwords file (/etc/shadow)
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`auth_map_shadow',`
+	gen_require(`
+		type shadow_t;
+	')
+	allow $1 shadow_t:file map;
+')
+
+########################################
+## <summary>
 ##	Pass shadow assertion for reading.
 ## </summary>
 ## <desc>
#1 lore raw
Quoted 116 lines · Russell Coker

Includes the ifndef(`distro_debian' section that was requested. Should be ready for merging now.

Index: refpolicy-2.20201205/policy/modules/services/memlockd.fc
===================================================================

policy/modules/services/memlockd.fc new file +1 -0
@@ -0,0 +1 @@
+/usr/sbin/memlockd	--	gen_context(system_u:object_r:memlockd_exec_t,s0)

Index: refpolicy-2.20201205/policy/modules/services/memlockd.if
===================================================================

policy/modules/services/memlockd.if new file +2 -0
@@ -0,0 +1,2 @@
+## <summary>memory lock daemon, keeps important files in RAM.</summary>
+

Index: refpolicy-2.20201205/policy/modules/services/memlockd.te
===================================================================

policy/modules/services/memlockd.te new file +39 -0
@@ -0,0 +1,39 @@
+policy_module(memlockd, 1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type memlockd_t;
+type memlockd_exec_t;
+init_daemon_domain(memlockd_t, memlockd_exec_t)
+
+########################################
+#
+# Local policy
+#
+
+allow memlockd_t self:capability { setgid setuid ipc_lock };
+ifndef(`distro_debian', `
+allow memlockd_t self:capability dac_read_search;
+')
+allow memlockd_t self:fifo_file rw_file_perms;
+
+# cache /etc/shadow too
+auth_read_shadow(memlockd_t)
+auth_map_shadow(memlockd_t)
+
+corecmd_exec_all_executables(memlockd_t)
+corecmd_exec_bin(memlockd_t)
+corecmd_exec_shell(memlockd_t)
+corecmd_read_all_executables(memlockd_t)
+corecmd_search_bin(memlockd_t)
+files_read_etc_files(memlockd_t)
+libs_exec_ld_so(memlockd_t)
+files_map_etc_files(memlockd_t)
+
+logging_send_syslog_msg(memlockd_t)
+miscfiles_read_localization(memlockd_t)
+
+sysnet_mmap_read_config(memlockd_t)

Index: refpolicy-2.20201205/policy/modules/system/sysnetwork.if
===================================================================

policy/modules/system/sysnetwork.if +25 -0
@@ -393,6 +393,31 @@ interface(`sysnet_mmap_config_files',`
 
  #######################################
  ## <summary>
+##	map network config files.
+## </summary>
+## <desc>
+##	<p>
+##	Allow the specified domain to mmap the
+##	general network configuration files.
+##	</p>
+## </desc>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`sysnet_mmap_read_config',`
+	gen_require(`
+		type net_conf_t;
+	')
+
+	files_search_etc($1)
+	allow $1 net_conf_t:file mmap_read_file_perms;
+')
+
+#######################################
+## <summary>
  ##	Do not audit attempts to read network config files.
  ## </summary>
  ## <param name="domain">

Index: refpolicy-2.20201205/policy/modules/system/authlogin.if
===================================================================

policy/modules/system/authlogin.if +10 -0
@@ -577,6 +577,23 @@ interface(`auth_read_shadow',`
 
  ########################################
  ## <summary>
+##	Map the shadow passwords file (/etc/shadow)
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`auth_map_shadow',`
+	gen_require(`

policy/modules/system/authlogin.if interface(`auth_read_shadow',` · line 599

Quoted 10 lines
policy/modules/system/authlogin.if +7 -0
+		type shadow_t;
+	')
+	allow $1 shadow_t:file map;
+')
+
+########################################
+## <summary>
  ##	Pass shadow assertion for reading.
  ## </summary>
  ## <desc>

Merged.

Signature · 1 line
Chris PeBenito