Skip to contentSkip to conversation

/run/systemd/units/ links

PATCH In review Russell Coker 3 participants 5 messages Jan 8, 2019 – Jan 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /run/systemd/units/ links

This allows systemd-journald to read /run/systemd/units/ link files.

policy/modules/system/logging.te +1 -0
Index: refpolicy-2.20180701/policy/modules/system/logging.te
===================================================================
@@ -547,6 +547,7 @@ ifdef(`init_systemd',`
 	init_create_pid_dirs(syslogd_t)
 	init_daemon_pid_file(syslogd_var_run_t, dir, "syslogd")
 	init_getattr(syslogd_t)
+	init_read_run_links(syslogd_t)
 	init_rename_pid_files(syslogd_t)
 	init_delete_pid_files(syslogd_t)
 	init_dgram_send(syslogd_t)
policy/modules/system/init.if +20 -0
Index: refpolicy-2.20180701/policy/modules/system/init.if
===================================================================
@@ -894,6 +894,26 @@ interface(`init_dgram_send',`
 
 ########################################
 ## <summary>
+##	read init /run link files
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`init_read_run_links',`
+	gen_require(`
+		type init_var_run_t;
+	')
+
+	files_search_pids($1)
+	allow $1 init_var_run_t:lnk_file read_lnk_file_perms;
+')
+
+########################################
+## <summary>
 ##	Read and write to inherited init unix streams.
 ## </summary>
 ## <param name="domain">
#1 lore raw
Quoted 22 lines · Russell Coker

This allows systemd-journald to read /run/systemd/units/ link files.

Index: refpolicy-2.20180701/policy/modules/system/logging.te
===================================================================

policy/modules/system/logging.te +1 -0
@@ -547,6 +547,7 @@ ifdef(`init_systemd',`
  	init_create_pid_dirs(syslogd_t)
  	init_daemon_pid_file(syslogd_var_run_t, dir, "syslogd")
  	init_getattr(syslogd_t)
+	init_read_run_links(syslogd_t)
  	init_rename_pid_files(syslogd_t)
  	init_delete_pid_files(syslogd_t)
  	init_dgram_send(syslogd_t)

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

policy/modules/system/init.if +0 -0
@@ -894,6 +894,26 @@ interface(`init_dgram_send',`
 
  ########################################
  ## <summary>

policy/modules/system/init.if interface(`init_dgram_send',` · line 906

Quoted 10 lines
policy/modules/system/init.if +10 -0
+##	read init /run link files
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+## <rolecap/>
+#
+interface(`init_read_run_links',`

I guess this is a race between patches. Should be named init_read_pid_symlinks. Same feedback as GitHub PR https://github.com/SELinuxProject/refpolicy/pull/17

Signature · 1 line
Chris PeBenito
#2 lore raw
Quoted 22 lines · Chris PeBenito
Quoted 20 lines · Russell Coker

This allows systemd-journald to read /run/systemd/units/ link files.

Index: refpolicy-2.20180701/policy/modules/system/logging.te
===================================================================

policy/modules/system/logging.te +1 -0
@@ -547,6 +547,7 @@ ifdef(`init_systemd',`
      init_create_pid_dirs(syslogd_t)
      init_daemon_pid_file(syslogd_var_run_t, dir, "syslogd")
      init_getattr(syslogd_t)
+     init_read_run_links(syslogd_t)
      init_rename_pid_files(syslogd_t)
      init_delete_pid_files(syslogd_t)
      init_dgram_send(syslogd_t)

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

policy/modules/system/init.if +0 -0
@@ -894,6 +894,26 @@ interface(`init_dgram_send',`
 
Quoted 16 lines

policy/modules/system/init.if interface(`init_dgram_send',` · line 906

Quoted 12 lines
policy/modules/system/init.if +10 -0
  ########################################
  ## <summary>
+##   read init /run link files
+## </summary>
+## <param name="domain">
+##   <summary>
+##   Domain allowed access.
+##   </summary>
+## </param>
+## <rolecap/>
+#
+interface(`init_read_run_links',`

I guess this is a race between patches. Should be named init_read_pid_symlinks. Same feedback as GitHub PR
https://github.com/SELinuxProject/refpolicy/pull/17

I like "init_read_runtime_symlinks" more than "init_read_pid_symlinks" so I have uploaded my Pull Request. If your prefer the second name, I can change it again.
Compared to this patch, my PR does not use files_search_pids() but directly read_lnk_files_pattern() like some other interfaces. I have no strong preferences regarding this.

Thanks,
Nicolas

#3 lore raw
Quoted 10 lines · AEDT Nicolas Iooss
Quoted 3 lines

I guess this is a race between patches. Should be named init_read_pid_symlinks. Same feedback as GitHub PR
https://github.com/SELinuxProject/refpolicy/pull/17

I like "init_read_runtime_symlinks" more than "init_read_pid_symlinks" so I have uploaded my Pull Request. If your prefer the second name, I can change it again.
Compared to this patch, my PR does not use files_search_pids() but directly read_lnk_files_pattern() like some other interfaces. I have no strong preferences regarding this.

I'm really not bothered by the name. Whatever gets it included in git the fastest is good for me.

Also I'd really like to see a new upstream release before the end of the month if convenient.

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#4 lore raw
Quoted 12 lines · Russell Coker
Quoted 10 lines · AEDT Nicolas Iooss
Quoted 3 lines

I guess this is a race between patches. Should be named init_read_pid_symlinks. Same feedback as GitHub PR
https://github.com/SELinuxProject/refpolicy/pull/17

I like "init_read_runtime_symlinks" more than "init_read_pid_symlinks" so I have uploaded my Pull Request. If your prefer the second name, I can change it again.
Compared to this patch, my PR does not use files_search_pids() but directly read_lnk_files_pattern() like some other interfaces. I have no strong preferences regarding this.

Quoted 5 lines

I'm really not bothered by the name. Whatever gets it included in git the fastest is good for me.

Also I'd really like to see a new upstream release before the end of the month if convenient.

I've merged the PR, though this means the init_*_pid_*() interfaces will need to be deprecated and replaced, for consistency.

Signature · 1 line
Chris PeBenito