Skip to contentSkip to conversation

Module for tpm2

PATCH In review Sugar, David 2 participants 2 messages Aug 5, 2019 – Aug 11, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Module for tpm2

Module for tpm2

v2 - updated to rename module and interface names, different dbus interface

---
 policy/modules/services/tpm2.fc |  3 ++
 policy/modules/services/tpm2.if | 58 +++++++++++++++++++++++++++++++++
 policy/modules/services/tpm2.te | 30 +++++++++++++++++
 3 files changed, 91 insertions(+)
 create mode 100644 policy/modules/services/tpm2.fc
 create mode 100644 policy/modules/services/tpm2.if
 create mode 100644 policy/modules/services/tpm2.te
policy/modules/services/tpm2.fc new file +3 -0
new file mode 100644
index 00000000..4ccf2f25
@@ -0,0 +1,3 @@
+/usr/sbin/tpm2-abrmd								--	gen_context(system_u:object_r:tpm2_abrmd_exec_t,s0)
+
+/usr/lib/systemd/system/[^/]*tpm2-abrmd\.service	--	gen_context(system_u:object_r:tpm2_abrmd_unit_t,s0)
policy/modules/services/tpm2.if new file +58 -0

58 lines not on this page · raw message

policy/modules/services/tpm2.te new file +30 -0
new file mode 100644
index 00000000..aa607771
@@ -0,0 +1,30 @@
+policy_module(tpm2, 1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type tpm2_abrmd_t;
+type tpm2_abrmd_exec_t;
+init_daemon_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t)
+
+type tpm2_abrmd_unit_t;
+init_unit_file(tpm2_abrmd_unit_t)
+
+########################################
+#
+# Local policy
+#
+
+allow tpm2_abrmd_t self:process signal;
+allow tpm2_abrmd_t self:unix_stream_socket create_socket_perms;
+
+dev_rw_tpm(tpm2_abrmd_t)
+
+kernel_read_crypto_sysctls(tpm2_abrmd_t)
+kernel_read_system_state(tpm2_abrmd_t)
+
+optional_policy(`
+	dbus_system_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t)
+')
Signature · 1 line
2.21.0
#1 lore raw
Quoted 114 lines · David

Module for tpm2

v2 - updated to rename module and interface names, different dbus interface

---
  policy/modules/services/tpm2.fc |  3 ++
  policy/modules/services/tpm2.if | 58 +++++++++++++++++++++++++++++++++
  policy/modules/services/tpm2.te | 30 +++++++++++++++++
  3 files changed, 91 insertions(+)

create mode 100644 policy/modules/services/tpm2.fc create mode 100644 policy/modules/services/tpm2.if create mode 100644 policy/modules/services/tpm2.te

policy/modules/services/tpm2.fc new file +3 -0
new file mode 100644
index 00000000..4ccf2f25
@@ -0,0 +1,3 @@
+/usr/sbin/tpm2-abrmd								--	gen_context(system_u:object_r:tpm2_abrmd_exec_t,s0)
+
+/usr/lib/systemd/system/[^/]*tpm2-abrmd\.service	--	gen_context(system_u:object_r:tpm2_abrmd_unit_t,s0)
policy/modules/services/tpm2.if new file +58 -0
new file mode 100644
index 00000000..55133e4a
@@ -0,0 +1,58 @@
+## <summary>Trusted Platform Module 2.0</summary>
+
+########################################
+## <summary>
+##	Allow specified domain to enable/disable tpm2-abrmd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`tpm2_enabledisable_abrmd',`
+	gen_require(`
+		type tpm2_abrmd_unit_t;
+		class service { enable disable };
+	')
+
+	allow $1 tpm2_abrmd_unit_t:service { enable disable };
+')
+
+########################################
+## <summary>
+##	Allow specified domain to start/stop tpm2-abrmd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`tpm2_startstop_abrmd',`
+	gen_require(`
+		type tpm2_abrmd_unit_t;
+		class service { start stop };
+	')
+
+	allow $1 tpm2_abrmd_unit_t:service { start stop };
+')
+
+########################################
+## <summary>
+##	Allow specified domain to get status of tpm2-abrmd unit
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`tpm2_status_abrmd',`
+	gen_require(`
+		type tpm2_abrmd_unit_t;
+		class service status;
+	')
+
+	allow $1 tpm2_abrmd_unit_t:service status;
+')
policy/modules/services/tpm2.te new file +20 -0
new file mode 100644
index 00000000..aa607771
@@ -0,0 +1,30 @@
+policy_module(tpm2, 1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type tpm2_abrmd_t;
+type tpm2_abrmd_exec_t;
+init_daemon_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t)
+
+type tpm2_abrmd_unit_t;
+init_unit_file(tpm2_abrmd_unit_t)
+
+########################################
+#
+# Local policy
+#
+
+allow tpm2_abrmd_t self:process signal;

policy/modules/services/tpm2.te line 30

Quoted 10 lines
policy/modules/services/tpm2.te new file +10 -0
+allow tpm2_abrmd_t self:unix_stream_socket create_socket_perms;
+
+dev_rw_tpm(tpm2_abrmd_t)
+
+kernel_read_crypto_sysctls(tpm2_abrmd_t)
+kernel_read_system_state(tpm2_abrmd_t)
+
+optional_policy(`
+	dbus_system_domain(tpm2_abrmd_t, tpm2_abrmd_exec_t)
+')

Merged.

Signature · 1 line
Chris PeBenito