Skip to contentSkip to conversation

fakehwclock: update

PATCH New Christian Göttsche 2 participants 2 messages Sep 10, 2017 – Sep 11, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fakehwclock: update

- add initrc filecontext
- drop domtrans/run interface in favor of new admin interface

---
 fakehwclock.fc |  2 ++
 fakehwclock.if | 37 +++++++++++--------------------------
 fakehwclock.te |  3 +++
 3 files changed, 16 insertions(+), 26 deletions(-)
fakehwclock.fc +2 -0
index 0ab3bd8..459bd5c 100644
@@ -1,5 +1,7 @@
 /etc/fake-hwclock\.data				--	gen_context(system_u:object_r:fakehwclock_backup_t,s0)
 
+/etc/rc\.d/init\.d/fake-hwclock			--	gen_context(system_u:object_r:fakehwclock_initrc_exec_t,s0)
+
 /usr/bin/fake-hwclock				--	gen_context(system_u:object_r:fakehwclock_exec_t,s0)
 
 /usr/sbin/fake-hwclock				--	gen_context(system_u:object_r:fakehwclock_exec_t,s0)
fakehwclock.if +11 -26
index 24cc7d1..63afb52 100644
@@ -2,28 +2,8 @@
 
 ########################################
 ## <summary>
-##	Execute a domain transition to run fake-hwclock.
-## </summary>
-## <param name="domain">
-##	<summary>
-##	Domain allowed to transition.
-##	</summary>
-## </param>
-#
-interface(`fakehwclock_domtrans',`
-	gen_require(`
-		type fakehwclock_t, fakehwclock_exec_t;
-	')
-
-	corecmd_search_bin($1)
-	domtrans_pattern($1, fakehwclock_exec_t, fakehwclock_t)
-')
-
-########################################
-## <summary>
-##	Execute fake-hwclock in the fake-hwclock domain,
-##	and allow the specified role
-##	the fake-hwclock domain.
+##	All the rules required to
+##	administrate an fake-hwclock environment.
 ## </summary>
 ## <param name="domain">
 ##	<summary>
@@ -36,11 +16,16 @@ interface(`fakehwclock_domtrans',`
 ##	</summary>
 ## </param>
 #
-interface(`fakehwclock_run',`
+interface(`fakehwclock_admin',`
 	gen_require(`
-		attribute_role fakehwclock_roles;
+		type fakehwclock_t, fakehwclock_exec_t, fakehwclock_backup_t;
+		type fakehwclock_initrc_exec_t, fakehwclock_unit_t;
 	')
 
-	fakehwclock_domtrans($1)
-	roleattribute $2 fakehwclock_roles;
+	admin_process_pattern($1, fakehwclock_t)
+
+	init_startstop_service($1, $2, fakehwclock_t, fakehwclock_initrc_exec_t, fakehwclock_unit_t)
+
+	files_search_etc($1)
+	admin_pattern($1, fakehwclock_backup_t)
 ')
fakehwclock.te +3 -0
index 0a896a3..20bc5a0 100644
@@ -15,6 +15,9 @@ role fakehwclock_roles types fakehwclock_t;
 type fakehwclock_backup_t;
 files_type(fakehwclock_backup_t)
 
+type fakehwclock_initrc_exec_t;
+init_script_file(fakehwclock_initrc_exec_t)
+
 type fakehwclock_unit_t;
 init_unit_file(fakehwclock_unit_t)
 
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 fakehwclock: update

Quoted 13 lines · Christian G?ttsche via refpolicy

- add initrc filecontext
- drop domtrans/run interface in favor of new admin interface

---
  fakehwclock.fc |  2 ++
  fakehwclock.if | 37 +++++++++++--------------------------
  fakehwclock.te |  3 +++
  3 files changed, 16 insertions(+), 26 deletions(-)
fakehwclock.fc +0 -0
index 0ab3bd8..459bd5c 100644

fakehwclock.fc line 7

Quoted 7 lines
fakehwclock.fc +2 -0
@@ -1,5 +1,7 @@
  /etc/fake-hwclock\.data				--	gen_context(system_u:object_r:fakehwclock_backup_t,s0)
 
+/etc/rc\.d/init\.d/fake-hwclock			--	gen_context(system_u:object_r:fakehwclock_initrc_exec_t,s0)
+
  /usr/bin/fake-hwclock				--	gen_context(system_u:object_r:fakehwclock_exec_t,s0)
 
  /usr/sbin/fake-hwclock				--	gen_context(system_u:object_r:fakehwclock_exec_t,s0)

No fc for the unit?

Quoted 7 lines
fakehwclock.if +0 -0
index 24cc7d1..63afb52 100644
@@ -2,28 +2,8 @@
 
  ########################################

fakehwclock.if line 13

Quoted 10 lines
fakehwclock.if +0 -9
  ## <summary>
-##	Execute a domain transition to run fake-hwclock.
-## </summary>
-## <param name="domain">
-##	<summary>
-##	Domain allowed to transition.
-##	</summary>
-## </param>
-#
-interface(`fakehwclock_domtrans',`

Do not delete interfaces, deprecate them.

Quoted 54 lines
fakehwclock.if +11 -17
-	gen_require(`
-		type fakehwclock_t, fakehwclock_exec_t;
-	')
-
-	corecmd_search_bin($1)
-	domtrans_pattern($1, fakehwclock_exec_t, fakehwclock_t)
-')
-
-########################################
-## <summary>
-##	Execute fake-hwclock in the fake-hwclock domain,
-##	and allow the specified role
-##	the fake-hwclock domain.
+##	All the rules required to
+##	administrate an fake-hwclock environment.
  ## </summary>
  ## <param name="domain">
  ##	<summary>
@@ -36,11 +16,16 @@ interface(`fakehwclock_domtrans',`
  ##	</summary>
  ## </param>
  #
-interface(`fakehwclock_run',`
+interface(`fakehwclock_admin',`
  	gen_require(`
-		attribute_role fakehwclock_roles;
+		type fakehwclock_t, fakehwclock_exec_t, fakehwclock_backup_t;
+		type fakehwclock_initrc_exec_t, fakehwclock_unit_t;
  	')
 
-	fakehwclock_domtrans($1)
-	roleattribute $2 fakehwclock_roles;
+	admin_process_pattern($1, fakehwclock_t)
+
+	init_startstop_service($1, $2, fakehwclock_t, fakehwclock_initrc_exec_t, fakehwclock_unit_t)
+
+	files_search_etc($1)
+	admin_pattern($1, fakehwclock_backup_t)
  ')
fakehwclock.te +3 -0
index 0a896a3..20bc5a0 100644
@@ -15,6 +15,9 @@ role fakehwclock_roles types fakehwclock_t;
  type fakehwclock_backup_t;
  files_type(fakehwclock_backup_t)
 
+type fakehwclock_initrc_exec_t;
+init_script_file(fakehwclock_initrc_exec_t)
+
  type fakehwclock_unit_t;
  init_unit_file(fakehwclock_unit_t)
 
Signature · 1 line
Chris PeBenito