From: guido@trentalancia.net (Guido Trentalancia) Date: Tue, 06 Sep 2016 21:52:33 +0200 Subject: [refpolicy] [PATCH v2] cups: update permissions for HP printers (load firmware) In-Reply-To: <1473185308.11558.1.camel@trentalancia.net> References: <1473185308.11558.1.camel@trentalancia.net> Message-ID: <1473191553.11558.3.camel@trentalancia.net> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Update the cups module with some permissions needed to run HP printers (in particular to be able to load firmware on those printers that need it every time they are connected). The permission to execute shell scripts has been removed in this new version, as this is not required. Signed-off-by: Guido Trentalancia --- policy/modules/contrib/cups.te | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- refpolicy-git-06082016-orig/policy/modules/contrib/cups.te 2016-08-07 23:05:57.061018507 +0200 +++ refpolicy-git-06082016/policy/modules/contrib/cups.te 2016-09-06 20:03:49.511295021 +0200 @@ -157,6 +154,10 @@ read_files_pattern(cupsd_t, hplip_etc_t, allow cupsd_t hplip_var_run_t:file read_file_perms; +# hpcups +read_files_pattern(cupsd_t, hplip_var_lib_t, hplip_var_lib_t) +read_lnk_files_pattern(cupsd_t, hplip_var_lib_t, hplip_var_lib_t) + stream_connect_pattern(cupsd_t, ptal_var_run_t, ptal_var_run_t, ptal_t) allow cupsd_t ptal_var_run_t:sock_file setattr_sock_file_perms; @@ -300,6 +301,9 @@ optional_policy(` ') optional_policy(` + init_dbus_chat_script(cupsd_t) +') +optional_policy(` kerberos_manage_host_rcache(cupsd_t) kerberos_tmp_filetrans_host_rcache(cupsd_t, file, "host_0") ') @@ -608,6 +612,7 @@ allow hplip_t self:capability { dac_over dontaudit hplip_t self:capability sys_tty_config; allow hplip_t self:fifo_file rw_fifo_file_perms; allow hplip_t self:process signal_perms; +allow hplip_t self:netlink_kobject_uevent_socket create_socket_perms; allow hplip_t self:tcp_socket { accept listen }; allow hplip_t self:rawip_socket create_socket_perms; @@ -635,6 +640,9 @@ stream_connect_pattern(hplip_t, cupsd_va kernel_read_system_state(hplip_t) kernel_read_kernel_sysctls(hplip_t) +# e.g. execute python script to load the firmware +can_exec(hplip_t, hplip_exec_t) + corenet_all_recvfrom_unlabeled(hplip_t) corenet_all_recvfrom_netlabel(hplip_t) corenet_tcp_sendrecv_generic_if(hplip_t) @@ -710,6 +720,11 @@ optional_policy(` ') optional_policy(` + term_use_generic_ptys(hplip_t) + term_use_ptmx(hplip_t) +') + +optional_policy(` udev_read_db(hplip_t) ')