$1_cupsd_spool_t in lpr_macros.te
Hi,
the attached patch add cups support in lpr_domain. You can pipe some data to lpr with this additional rules.
Carsten
Index: lpr_macros.te
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux/policy/macros/program/lpr_macros.te,v retrieving revision 1.1.1.3
lpr_macros.te +5 -0
@@ -45,6 +45,11 @@ # Use this type when creating files in /var/spool/lpd. file_type_auto_trans($1_lpr_t, lpd_spool_t, $1_lpd_spool_t) +ifdef(`cups.te',` +type $1_cupsd_spool_t, file_type, sysadmfile; +file_type_auto_trans($1_lpr_t, cupsd_spool_t, $1_cupsd_spool_t) +') + # Use the network. can_network($1_lpr_t)
Quoted 2 lines · Carsten Grohmann
the attached patch add cups support in
lpr_domain. You can pipe some data to lpr with this additional rules.
Won't you also need something like the following? allow cupsd_t $1_cupsd_spool_t:file { r_file_perms unlink };
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Am Sonntag, 29. September 2002 13:43 schrieb Russell Coker:
Quoted 6 lines · Carsten Grohmann
Quoted 2 lines
the attached patch add cups support in
lpr_domain. You can pipe some data to lpr with this additional rules.Won't you also need something like the following? allow
cupsd_t$1_cupsd_spool_t:file {r_file_permsunlink };
No. I try the new rules and it runs fine.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Carsten Grohmann
Am Sonntag, 29. September 2002 13:43 schrieb Russell Coker:
Quoted 6 lines · Carsten Grohmann
Quoted 2 lines
the attached patch add cups support in
lpr_domain. You can pipe some data to lpr with this additional rules.Won't you also need something like the following? allow
cupsd_t$1_cupsd_spool_t:file {r_file_permsunlink };No. I try the new rules and it runs fine.
So how does $1_cupsd_spool_t get accessed by the print server? What is done with the $1_cupsd_spool_t? Is it just a temporary file that the lpr just writes and then reads back?
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Am Sonntag, 29. September 2002 18:59 schrieb Russell Coker:
Quoted 6 lines · Carsten Grohmann
Quoted 5 lines
Am Sonntag, 29. September 2002 13:43 schrieb Russell Coker:
Quoted 4 lines · Carsten Grohmann
Quoted 2 lines
the attached patch add cups support in
lpr_domain. You can pipe some data to lpr with this additional rules.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Won't you also need something like the following? allow
cupsd_t$1_cupsd_spool_t:file {r_file_permsunlink };No. I try the new rules and it runs fine.
So how does $1_cupsd_spool_t get accessed by the print server? What is done with the $1_cupsd_spool_t? Is it just a temporary file that the lpr just writes and then reads back?
I thinks also it is only a temporary file from lpr. In this case we could label it as $1_lpr_spool_t instead of $1_cupsd_spool_t.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Carsten Grohmann
Am Sonntag, 29. September 2002 18:59 schrieb Russell Coker:
Quoted 9 lines · Carsten Grohmann
Quoted 8 lines
Am Sonntag, 29. September 2002 13:43 schrieb Russell Coker:
Quoted 6 lines · Carsten Grohmann
Quoted 2 lines
the attached patch add cups support in
lpr_domain. You can pipe some data to lpr with this additional rules.Won't you also need something like the following? allow
cupsd_t$1_cupsd_spool_t:file {r_file_permsunlink };
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
No. I try the new rules and it runs fine.
So how does $1_cupsd_spool_t get accessed by the print server? What is done with the $1_cupsd_spool_t? Is it just a temporary file that the lpr just writes and then reads back?
I thinks also it is only a temporary file from lpr. In this case we could label it as $1_lpr_spool_t instead of $1_cupsd_spool_t.
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove cupsd_spool_t and replace it with lpd_spool_t instead. What do you think?
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 3 lines · Russell Coker
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?
Do you mean $1_lpd_spool_t? There is no $1_lpr_spool_t in my policy.
--
Stephen D. Smalley, NAI Labs
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Stephen Smalley
Quoted 4 lines · Russell Coker
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?Do you mean $1_lpd_spool_t? There is no $1_lpr_spool_t in my policy.
Yes, I put $1_lpd_spool_t in my policy tree. Late night...
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Am Montag, 30. September 2002 15:24 schrieb Russell Coker:
Quoted 10 lines · Stephen Smalley
Quoted 7 lines · Russell Coker
Quoted 4 lines
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?Do you mean $1_lpd_spool_t? There is no $1_lpr_spool_t in my policy.
Yes, I put $1_lpd_spool_t in my policy tree. Late night...
I am not sure if I understand you right. You replace cupds_spool_t trougth lpd_spool_t.
And added $1_lpd_spool_t? I think this type exist already. Or?
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Carsten Grohmann
Am Montag, 30. September 2002 15:24 schrieb Russell Coker:
Quoted 7 lines · Stephen Smalley
Quoted 6 lines · Russell Coker
Quoted 4 lines
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Do you mean $1_lpd_spool_t? There is no $1_lpr_spool_t in my policy.
Yes, I put $1_lpd_spool_t in my policy tree. Late night...
I am not sure if I understand you right. You replace
cupds_spool_ttrougthlpd_spool_t.
I am suggesting that as a possibility, as I can't test I haven't made any such changes to my tree.
Quoted 1 line
And added $1_lpd_spool_t? I think this type exist already. Or?
Yes, it already exists.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Am Montag, 30. September 2002 10:21 schrieb Russell Coker:
Quoted 4 lines
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?
I am not sure. I my opinion is a serparate type per domain the better solution. It is more clear in contrast to domains which use other domains types special _tmp_t and spool_t types.
But we could use an generic type like print_spool_t instead of lpd_spool_t and cupsd_spool_t.
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 11 lines · Carsten Grohmann
Am Montag, 30. September 2002 10:21 schrieb Russell Coker:
Quoted 4 lines
I've added such a change to my tree to make it use $1_lpr_spool_t. Although it has occurred to me that perhaps the best thing to do is to remove
cupsd_spool_tand replace it withlpd_spool_tinstead. What do you think?I am not sure. I my opinion is a serparate type per domain the better solution. It is more clear in contrast to domains which use other domains types special
_tmp_tandspool_ttypes.
But we could use an generic type likeprint_spool_tinstead oflpd_spool_tandcupsd_spool_t.
Sounds like a good idea to me!
Also maybe we should make even more integration between CUPS policy and lpd policy.
I look forward to further patches from you in this regard.
I've just put a new policy archive online at
http://www.coker.com.au/selinux/policy.tgz , you may want to use that to base your work on as it's got all the necessary patches for home_root_t, xauth, etc.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Am Montag, 30. September 2002 22:09 schrieb Russell Coker:
Quoted 6 lines
Quoted 5 lines
I am not sure. I my opinion is a serparate type per domain the better solution. It is more clear in contrast to domains which use other domains types special
_tmp_tandspool_ttypes.
But we could use an generic type likeprint_spool_tinstead oflpd_spool_tandcupsd_spool_t.
Quoted 6 lines
Sounds like a good idea to me!
Also maybe we should make even more integration between CUPS policy and lpd policy.
I look forward to further patches from you in this regard.
The attached patch is again the actuell CVS state. It change lpd_spool_t and cupsd_spool_t to print_spool_t.
I think it is better to rename printer_port_t in lpd.te to lpd_port_t -- it's more intuitive. Or?
domains/program/cups.te +4 -7
@@ -14,7 +14,6 @@ role system_r types cupsd_t; every_domain(cupsd_t) type cupsd_exec_t, file_type, sysadmfile, exec_type; -type cupsd_spool_t, file_type, sysadmfile; type etc_cupsd_t, file_type, sysadmfile; type var_log_cups_t, file_type, sysadmfile;
@@ -22,8 +21,7 @@ domain_auto_trans(initrc_t, cupsd_exec_t, cupsd_t) -type cupsd_tmp_t, file_type, sysadmfile, tmpfile; -file_type_auto_trans(cupsd_t, tmp_t, cupsd_tmp_t) +tmp_domain(cupsd) allow cupsd_t printer_t:chr_file rw_file_perms;
@@ -56,10 +54,9 @@ ifdef(`ypbind.te', `can_tcp_connect(cupsd_t, ypbind_t)') # Write to /var/spool/cups. -allow cupsd_t cupsd_spool_t:dir { setattr rw_dir_perms }; -allow cupsd_t cupsd_spool_t:file create_file_perms; -allow cupsd_t cupsd_spool_t:file rw_file_perms; +allow cupsd_t print_spool_t:dir { setattr rw_dir_perms }; +allow cupsd_t print_spool_t:file create_file_perms; +allow cupsd_t print_spool_t:file rw_file_perms; # Filter scripts may be shell scripts, and may invoke progs like /bin/mktemp can_exec(cupsd_t, { shell_exec_t bin_t }) -
domains/program/lpd.te +8 -11
@@ -24,8 +24,7 @@ type printconf_t, file_type, sysadmfile; # Type for files in /usr/share/printconf. -type lpd_tmp_t, file_type, sysadmfile, tmpfile; -file_type_auto_trans(lpd_t, tmp_t, lpd_tmp_t) +tmp_domain(lpd); # Allow checkpc to access the lpd spool so it can check & fix it. # This requires that /usr/sbin/checkpc have type checkpc_t.
@@ -40,8 +39,8 @@ type_transition init_t checkpc_exec_t:process checkpc_t; allow checkpc_t checkpc_t:capability { setgid setuid dac_override }; -allow checkpc_t lpd_spool_t:file { rw_file_perms unlink }; -allow checkpc_t lpd_spool_t:dir { read write search add_name remove_name getattr }; +allow checkpc_t print_spool_t:file { rw_file_perms unlink }; +allow checkpc_t print_spool_t:dir { read write search add_name remove_name getattr }; allow checkpc_t printer_t:chr_file { getattr append }; # Allow access to /dev/console through the fd:
@@ -63,7 +62,7 @@ # running in the initrc_t domain can read the printer spool directory. # Perhaps executing /etc/rc.d/init.d/lpd should transition # to domain lpd_t, instead of waiting for executing lpd. -allow initrc_t lpd_spool_t:dir { read }; +allow initrc_t print_spool_t:dir { read }; # Use capabilities.
@@ -92,12 +91,12 @@ allow lpd_t printer_t:chr_file rw_file_perms; # Write to /var/spool/lpd. -allow lpd_t lpd_spool_t:dir rw_dir_perms; -allow lpd_t lpd_spool_t:file create_file_perms; -allow lpd_t lpd_spool_t:file rw_file_perms; +allow lpd_t print_spool_t:dir rw_dir_perms; +allow lpd_t print_spool_t:file create_file_perms; +allow lpd_t print_spool_t:file rw_file_perms; # Execute filter scripts. -# can_exec(lpd_t, lpd_spool_t) +# can_exec(lpd_t, print_spool_t) # Filter scripts may be shell scripts, and may invoke progs like /bin/mktemp can_exec(lpd_t, { bin_t sbin_t shell_exec_t })
@@ -110,5 +109,3 @@ # checkpc needs similar permissions. allow checkpc_t printconf_t:file { getattr }; allow checkpc_t printconf_t:dir { getattr search read }; - -
file_contexts/program/cups.fc +1 -1
@@ -5,5 +5,5 @@ /usr/lib/cups/backend/.* system_u:object_r:cupsd_exec_t /usr/sbin/cupsd system_u:object_r:cupsd_exec_t /var/log/cups(/.*)? system_u:object_r:var_log_cups_t -/var/spool/cups(/.*)? system_u:object_r:cupsd_spool_t +/var/spool/cups(/.*)? system_u:object_r:print_spool_t /usr/lib/cups/filter/.* system_u:object_r:bin_t
file_contexts/program/lpd.fc +1 -1
@@ -4,6 +4,6 @@ /dev/usb/lp.* system_u:object_r:printer_t /usr/sbin/lpd system_u:object_r:lpd_exec_t /usr/sbin/checkpc system_u:object_r:checkpc_exec_t -/var/spool/lpd(/.*)? system_u:object_r:lpd_spool_t +/var/spool/lpd(/.*)? system_u:object_r:print_spool_t /usr/share/printconf/.* system_u:object_r:printconf_t /var/run/lprng(/.*)? system_u:object_r:lpd_var_run_t
macros/program/lpr_macros.te +6 -9
@@ -41,9 +41,9 @@ allow $1_lpr_t lpd_var_run_t:sock_file write; # Type for spool files. -type $1_lpd_spool_t, file_type, sysadmfile; -# Use this type when creating files in /var/spool/lpd. -file_type_auto_trans($1_lpr_t, lpd_spool_t, $1_lpd_spool_t) +type $1_print_spool_t, file_type, sysadmfile; +# Use this type when creating files in /var/spool/lpd and /var/spool/cups. +file_type_auto_trans($1_lpr_t, print_spool_t, $1_print_spool_t) # Access the terminal. allow $1_lpr_t $1_tty_device_t:chr_file rw_file_perms;
@@ -57,7 +57,7 @@ allow $1_lpr_t $1_home_t:{ file lnk_file } r_file_perms; # Read and write shared files in the spool directory. -allow $1_lpr_t lpd_spool_t:notdevfile_class_set rw_file_perms; +allow $1_lpr_t print_spool_t:notdevfile_class_set rw_file_perms; # Connect to lpd via a Unix domain socket. allow $1_lpr_t printer_t:sock_file rw_file_perms;
@@ -70,17 +70,14 @@ allow $1_lpr_t lpd_t:process signal; # Allow lpd to read, rename, and unlink spool files. -allow lpd_t $1_lpd_spool_t:file r_file_perms; -allow lpd_t $1_lpd_spool_t:file link_file_perms; +allow lpd_t $1_print_spool_t:file r_file_perms; +allow lpd_t $1_print_spool_t:file link_file_perms; dontaudit $1_lpr_t $1_t:unix_stream_socket { read write }; ifdef(`cups.te', ` allow { $1_lpr_t $1_t } etc_cupsd_t:dir search; can_tcp_connect({ $1_lpr_t $1_t }, cupsd_t) -file_type_auto_trans($1_lpr_t, cupsd_spool_t, $1_lpd_spool_t) ') ') - -
types/file.te +2 -2
@@ -201,9 +196,9 @@ type cron_spool_t, file_type, sysadmfile; # -# lpd_spool_t is the type for /var/spool/lpd. +# print_spool_t is the type for /var/spool/lpd and /var/spool/cups. # -type lpd_spool_t, file_type, sysadmfile; +type print_spool_t, file_type, sysadmfile; # # mail_spool_t is the type for /var/spool/mail.
Quoted 2 lines · Carsten Grohmann
The attached patch is again the actuell CVS state. It change
lpd_spool_tandcupsd_spool_ttoprint_spool_t.
Thanks, merged.
Quoted 2 lines
I think it is better to rename
printer_port_tin lpd.te tolpd_port_t-- it's more intuitive. Or?
Doesn't matter to me.
--
Stephen D. Smalley, NAI Labs
[email protected]
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 10 lines · Stephen Smalley
Quoted 2 lines · Carsten Grohmann
The attached patch is again the actuell CVS state. It change
lpd_spool_tandcupsd_spool_ttoprint_spool_t.Thanks, merged.
Quoted 2 lines
I think it is better to rename
printer_port_tin lpd.te tolpd_port_t-- it's more intuitive. Or?Doesn't matter to me.
Actually it might be best if we renamed ipp_port_t to printer_port_t, I don't think that there's enough benefit in having two names to justify it. Anything that can bind to one port can probably interfere with the other in one way or another anyway...
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Carsten Grohmann
Am Montag, 30. September 2002 22:09 schrieb Russell Coker:
Quoted 11 lines
Quoted 5 lines
I am not sure. I my opinion is a serparate type per domain the better solution. It is more clear in contrast to domains which use other domains types special
_tmp_tandspool_ttypes.
But we could use an generic type likeprint_spool_tinstead oflpd_spool_tandcupsd_spool_t.Sounds like a good idea to me!
Also maybe we should make even more integration between CUPS policy and lpd policy.
Quoted 7 lines
Quoted 1 line
I look forward to further patches from you in this regard.
The attached patch is again the actuell CVS state. It change
lpd_spool_tandcupsd_spool_ttoprint_spool_t.I think it is better to rename
printer_port_tin lpd.te tolpd_port_t-- it's more intuitive. Or?
I think your patch is great, I've added it to my tree.
I'm about to release a new version. After this I don't anticipate doing any more serious policy work for a while (I've got to port the SE patches to the latest versions of all the utils and I've got a few other things to work on).
Anyway I hope that from now on I won't need to be so seriously involved in writing policy, I think that you, Brian, and Tom should have it under control. ;)
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.