macro for run_init etc
Currently there's a run_init program for initrc_t, a run_deb program for running Debian package maintenance utilities, and now we have been discussing having similar programs for starting httpd, databases, and others.
I think that we need a macro such as in the attached file for this purpose.
With such a macro file the following three lines take the place of run_init.te and run_deb.te, and you could easily define another dozen run_something domains without effort.
run_program(sysadm_t, syadm_r, init, etc_t, initrc_t) run_program(sysadm_t, syadm_r, deb, dpkg_exec_t, dpkg_t) domain_trans(run_deb_t, apt_exec_t, apt_t)
Signature · 3 lines
I do not get viruses because I do not use MS software. If you use Outlook then please do not put my email address in your address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line
From field.
# $1 is the source domain (or domains), $2 is the source role (or roles) and $3
# is the base name for the domain to run. $1 is normally sysadm_t, and $2 is # normally sysadm_r. $4 is the type of program to run and $5 is the domain to # transition to. # sample usage: # run_program(sysadm_t, syadm_r, init, etc_t, initrc_t) # # if you have several users who run the same run_init type program for # different purposes (think of a run_db program used by several database # administrators to start several databases) then you can list all the source # domains in $1, all the source roles in $2, but you may not want to list all # types of programs to run in $4 and target domains in $5 (as that may permit # entering a domain from the wrong type). In such a situation just specify # one value for each of $4 and $5 and have some rules such as the following: # domain_trans(run_whatever_t, whatever_exec_t, whatever_t)
define(run_program',
type run_$3_exec_t, file_type, exec_type, sysadmfile;
# domain for program to run in, needs to change role (privrole), change # identity to system_u (privuser), log failures to syslog (privlog) and # authenticate users (auth) type run_$3_t, domain, privrole, privuser, privlog, auth; domain_auto_trans($1, run_$3_exec_t, run_$3_t) role $2 types run_$3_t;
# for utmp
allow run_$3_t initrc_var_run_t:file rw_file_perms;
allow run_$3_t { sysadm_devpts_t sysadm_tty_device_t }:chr_file rw_file_perms;# often the administrator runs such programs from a directory that is owned
# by a different user or has restrictive SE permissions, do not want to audit
# the failed access to the current directory
dontaudit run_$3_t file_type:dir search;
dontaudit run_$3_t self:capability { dac_override dac_read_search };can_exec(run_$3_t, { bin_t chkpwd_exec_t shell_exec_t })
domain_trans(run_$3_t, $4, $5)
# hmm, do we REALLY need this?every_domain(run_$3_t)
')
Quoted 6 lines · Russell Coker
Currently there's a
run_initprogram forinitrc_t, arun_debprogram for running Debian package maintenance utilities, and now we have been discussing having similar programs for starting httpd, databases, and others.I think that we need a macro such as in the attached file for this purpose.
Quoted 7 lines
With such a macro file the following three lines take the place of run_init.te and run_deb.te, and you could easily define another dozen
run_somethingdomains without effort.
run_program(sysadm_t, syadm_r, init, etc_t, initrc_t)run_program(sysadm_t, syadm_r, deb, dpkg_exec_t, dpkg_t)domain_trans(run_deb_t, apt_exec_t, apt_t)
This change has been merged by Chris Vance and is available in sourceforge CVS.
--
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 4 lines · Russell Coker
Quoted 2 lines
This change has been merged by Chris Vance and is available in sourceforge CVS.
It's in my tree now.
It made no sense to me to have two lines in run_deb.te, so I merged it with dpkg.te. run_deb.te would never work without dpkg.te in any case, and dpkg.te makes no sense without run_deb.te
I originally had them in separate policy files because the run_deb policy was so big and complex, now it's two lines it should be in the same file.
I think that perhaps the same merging should be done with initrc.te and run_init.te.
Signature · 3 lines
I do not get viruses because I do not use MS software. If you use Outlook then please do not put my email address in your address-book so that WHEN you get a virus it won't use my address in the
Quoted 1 line
From field.
--
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 · Russell Coker
Quoted 4 lines · Russell Coker
Quoted 2 lines
This change has been merged by Chris Vance and is available in sourceforge CVS.
It's in my tree now.
It made no sense to me to have two lines in run_deb.te, so I merged it with dpkg.te. run_deb.te would never work without dpkg.te in any case, and dpkg.te makes no sense without run_deb.te
Quoted 5 lines
I originally had them in separate policy files because the
run_debpolicy was so big and complex, now it's two lines it should be in the same file.I think that perhaps the same merging should be done with initrc.te and run_init.te.
I agree. I've made these changes in our tree and they will be pushed out to Sourceforge shortly.
chris.
--
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.