From: guido@trentalancia.net (Guido Trentalancia) Date: Thu, 08 Sep 2016 18:18:39 +0200 Subject: [refpolicy] [PATCH v3] cups: update permissions for HP printers (load firmware) In-Reply-To: References: <1473185308.11558.1.camel@trentalancia.net> <1473191553.11558.3.camel@trentalancia.net> <1473266789.11558.6.camel@trentalancia.net> Message-ID: <1473351519.2887.5.camel@trentalancia.net> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com Hello Christopher. Thanks for getting back on this. My reply follows the quoted text... On Wed, 07/09/2016 at 18.01 -0400, Chris PeBenito wrote: > On 09/07/16 12:46, Guido Trentalancia via refpolicy wrote: > > > > 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. [...] > > @@ -300,6 +301,9 @@ optional_policy(` > > ?') > > > > ?optional_policy(` > > + init_dbus_chat_script(cupsd_t) > > +') > > +optional_policy(` > > nitpick: Needs a blank line between the blocks. You've done well to tell me, clearly I didn't notice it ! > > ? 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) > > +') > > It looks like hplip is opening up a pty, so there should be a new > pty? > type (add term_pty()) and use term_create_pty() to get it created > with? > that type.??Also, I don't see why this is optional. I made it optional because I have seen it was optional in cupsd_config_t. It is clearly wrong, so I have now changed it in both places to normal policy. Other permissions are not needed, I am calling the Principle of Least Priviledge here !! > > +optional_policy(` > > ? udev_read_db(hplip_t) > > ?') A new version of the patch will be posted shortly after this message. Please, consider people using those printers are not able to print (or fax, scan on some models) at the moment, so this is an urgent patch. Best regards, Guido