diff --git a/policy/modules/services/tpm2.fc b/policy/modules/services/tpm2.fc new file mode 100644 index 000000000..4ccf2f253 --- /dev/null +++ b/policy/modules/services/tpm2.fc @@ -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) diff --git a/policy/modules/services/tpm2.if b/policy/modules/services/tpm2.if new file mode 100644 index 000000000..55133e4a5 --- /dev/null +++ b/policy/modules/services/tpm2.if @@ -0,0 +1,58 @@ +## Trusted Platform Module 2.0 + +######################################## +## +## Allow specified domain to enable/disable tpm2-abrmd unit +## +## +## +## Domain allowed access. +## +## +# +interface(`tpm2_enabledisable_abrmd',` + gen_require(` + type tpm2_abrmd_unit_t; + class service { enable disable }; + ') + + allow $1 tpm2_abrmd_unit_t:service { enable disable }; +') + +######################################## +## +## Allow specified domain to start/stop tpm2-abrmd unit +## +## +## +## Domain allowed access. +## +## +# +interface(`tpm2_startstop_abrmd',` + gen_require(` + type tpm2_abrmd_unit_t; + class service { start stop }; + ') + + allow $1 tpm2_abrmd_unit_t:service { start stop }; +') + +######################################## +## +## Allow specified domain to get status of tpm2-abrmd unit +## +## +## +## Domain allowed access. +## +## +# +interface(`tpm2_status_abrmd',` + gen_require(` + type tpm2_abrmd_unit_t; + class service status; + ') + + allow $1 tpm2_abrmd_unit_t:service status; +') diff --git a/policy/modules/services/tpm2.te b/policy/modules/services/tpm2.te new file mode 100644 index 000000000..aa607771a --- /dev/null +++ b/policy/modules/services/tpm2.te @@ -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) +')