diff --git a/policy/modules/apps/sigrok.fc b/policy/modules/apps/sigrok.fc new file mode 100644 index 000000000..3784ea44f --- /dev/null +++ b/policy/modules/apps/sigrok.fc @@ -0,0 +1 @@ +/usr/bin/sigrok-cli -- gen_context(system_u:object_r:sigrok_exec_t,s0) diff --git a/policy/modules/apps/sigrok.if b/policy/modules/apps/sigrok.if new file mode 100644 index 000000000..bf7a792af --- /dev/null +++ b/policy/modules/apps/sigrok.if @@ -0,0 +1,37 @@ +## sigrok signal analysis software suite. + +######################################## +## +## Execute sigrok in its domain. +## +## +## +## Role allowed access. +## +## +## +## +## User domain for the role. +## +## +# +interface(`sigrok_run',` + gen_require(` + type sigrok_t, sigrok_exec_t; + attribute_role sigrok_roles; + ') + + ######################################## + # + # Declarations + # + + roleattribute $1 sigrok_roles; + + ######################################## + # + # Policy + # + + domtrans_pattern($2, sigrok_exec_t, sigrok_t) +') diff --git a/policy/modules/apps/sigrok.te b/policy/modules/apps/sigrok.te new file mode 100644 index 000000000..1284e7161 --- /dev/null +++ b/policy/modules/apps/sigrok.te @@ -0,0 +1,39 @@ +policy_module(sigrok, 1.0.0) + +######################################## +# +# Declarations +# + +attribute_role sigrok_roles; +roleattribute system_r sigrok_roles; + +type sigrok_t; +type sigrok_exec_t; +userdom_user_application_domain(sigrok_t, sigrok_exec_t) +role sigrok_roles types sigrok_t; + +######################################## +# +# Local policy +# + +allow sigrok_t self:fifo_file rw_fifo_file_perms; +allow sigrok_t self:netlink_kobject_uevent_socket create_socket_perms; +allow sigrok_t self:tcp_socket create_socket_perms; + +corenet_tcp_connect_all_unreserved_ports(sigrok_t) + +dev_getattr_sysfs_dirs(sigrok_t) +dev_read_sysfs(sigrok_t) +dev_rw_generic_usb_dev(sigrok_t) + +files_read_etc_files(sigrok_t) + +term_use_unallocated_ttys(sigrok_t) + +userdom_use_user_ptys(sigrok_t) + +optional_policy(` + udev_read_pid_files(sigrok_t) +') diff --git a/policy/modules/roles/unprivuser.te b/policy/modules/roles/unprivuser.te index 8c713831c..98957eeaf 100644 --- a/policy/modules/roles/unprivuser.te +++ b/policy/modules/roles/unprivuser.te @@ -149,6 +149,10 @@ ifndef(`distro_redhat',` rssh_role(user_r, user_t) ') + optional_policy(` + sigrok_run(user_r, user_t) + ') + optional_policy(` spamassassin_role(user_r, user_t) ')