Skip to contentSkip to conversation

Add interfaces to control ntpd_unit_t systemd services

PATCH In review David Sugar 2 participants 4 messages Nov 17, 2018 – Nov 18, 2018

lore
Share & tools
lore
#1 lore raw

PATCH 2/2 interface to enable/disable systemd_networkd service

In reply to David Sugar
---
 policy/modules/system/systemd.if | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
policy/modules/system/systemd.if +19 -0
index 9247924b..74f0b215 100644
@@ -467,6 +467,25 @@ interface(`systemd_manage_networkd_units',`
 	manage_files_pattern($1, systemd_networkd_unit_t, systemd_networkd_unit_t)
 ')
 
+########################################
+## <summary>
+##	Allow specified domain to enable systemd-networkd units
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`systemd_enabledisable_networkd',`
+	gen_require(`
+		type systemd_networkd_unit_t;
+		class service { enable disable };
+	')
+
+	allow $1 systemd_networkd_unit_t:service { enable disable };
+')
+
 ########################################
 ## <summary>
 ##	Allow specified domain to start systemd-networkd units
Signature · 1 line
2.19.1
#0 lore raw

PATCH 1/2 Add interfaces to control ntpd_unit_t systemd services

---
 policy/modules/services/ntp.if | 63 ++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)
policy/modules/services/ntp.if +63 -0
index 00c7620b..f1a90c55 100644
@@ -177,6 +177,69 @@ interface(`ntp_rw_shm',`
 	fs_search_tmpfs($1)
 ')
 
+########################################
+## <summary>
+##	Allow specified domain to enable/disable ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_enabledisable',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;
+			class service { enable disable };
+		')
+
+		allow $1 ntpd_unit_t:service { enable disable };
+	')
+')
+
+########################################
+## <summary>
+##	Allow specified domain to start/stop ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_startstop',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;
+			class service { start stop };
+		')
+
+		allow $1 ntpd_unit_t:service { start stop };
+	')
+')
+
+########################################
+## <summary>
+##	Allow specified domain to get status of ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_status',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;
+			class service status;
+		')
+
+		allow $1 ntpd_unit_t:service status;
+	')
+')
+
 ########################################
 ## <summary>
 ##	All of the rules required to
Signature · 1 line
2.19.1
#3 lore raw
Quoted 69 lines · David Sugar
---
  policy/modules/services/ntp.if | 63 ++++++++++++++++++++++++++++++++++
  1 file changed, 63 insertions(+)
policy/modules/services/ntp.if +56 -0
index 00c7620b..f1a90c55 100644
@@ -177,6 +177,69 @@ interface(`ntp_rw_shm',`
  	fs_search_tmpfs($1)
  ')
 
+########################################
+## <summary>
+##	Allow specified domain to enable/disable ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_enabledisable',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;
+			class service { enable disable };
+		')
+
+		allow $1 ntpd_unit_t:service { enable disable };
+	')
+')
+
+########################################
+## <summary>
+##	Allow specified domain to start/stop ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_startstop',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;
+			class service { start stop };
+		')
+
+		allow $1 ntpd_unit_t:service { start stop };
+	')
+')
+
+########################################
+## <summary>
+##	Allow specified domain to get status of ntpd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`ntp_status',`
+	ifdef(`init_systemd',`
+		gen_require(`
+			type ntpd_unit_t;

policy/modules/services/ntp.if interface(`ntp_rw_shm',` · line 245

Quoted 10 lines
policy/modules/services/ntp.if +7 -0
+			class service status;
+		')
+
+		allow $1 ntpd_unit_t:service status;
+	')
+')
+
  ########################################
  ## <summary>
  ##	All of the rules required to

Merged.

Signature · 1 line
Chris PeBenito
#2 lore raw

Re: [PATCH 2/2] interface to enable/disable systemd_networkd service

In reply to David Sugar
Quoted 25 lines · David Sugar
---
  policy/modules/system/systemd.if | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
policy/modules/system/systemd.if +12 -0
index 9247924b..74f0b215 100644
@@ -467,6 +467,25 @@ interface(`systemd_manage_networkd_units',`
  	manage_files_pattern($1, systemd_networkd_unit_t, systemd_networkd_unit_t)
  ')
 
+########################################
+## <summary>
+##	Allow specified domain to enable systemd-networkd units
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`systemd_enabledisable_networkd',`
+	gen_require(`

policy/modules/system/systemd.if interface(`systemd_manage_networkd_units',` · line 491

Quoted 10 lines
policy/modules/system/systemd.if +7 -0
+		type systemd_networkd_unit_t;
+		class service { enable disable };
+	')
+
+	allow $1 systemd_networkd_unit_t:service { enable disable };
+')
+
  ########################################
  ## <summary>
  ##	Allow specified domain to start systemd-networkd units

Merged.

Signature · 1 line
Chris PeBenito