Starting applications from initrc in a user's context?
Greetings Gurus of Space, Time and SELinux:
Let me preface by saying that I'm a newbie to SELinux. <disclaimer done>
I'm trying to run a series of applications from the init scripts that
I want to run in separate user contexts. Four separate init scripts all run from a master script that runs the user code only if tripwire says that the file system is kosher. The actual launching of the four separate scripts is working well. However, I'm trying to use the runcon command to run the applications in the separate user contexts and I'm getting a transition error from the initrc domain to the user domain. I've added the
allow initrc_t user1_t:process { transition };
to the user domain .te file as recommended by audit2allow, but this does not seem to squelch this error. As an additional gotcha, the applications are actually Java code and are run with the "java classname" invokation.
What am I missing? Or, is there a better way of running the four applications in their respective user domains from the init scripts?
Regards,
Mike
Signature · 15 lines
--------------------------------------------------------------- Mike Anderson 703.585.9384 CTO/Chief Scientist [email protected] www.ThePTRGroup.com Embedded, Real-Time Solutions --------------------------------------------------------------- "Software development is like making a baby. You can't make a baby in one month by impregnating nine women. Some things just take time." -Paraphrased from The Mythical Man Month -- 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 · Mike Anderson
I'm trying to run a series of applications from the init scripts that
I want to run in separate user contexts. Four separate init scripts all run from a master script that runs the user code only if tripwire says that the file system is kosher. The actual launching of the four separate scripts is working well. However, I'm trying to use the runcon command to run the applications in the separate user contexts and I'm getting a transition error from the initrc domain to the user domain. I've added theallow
initrc_tuser1_t:process { transition };
Use:domain_trans(initrc_t, shell_exec_t, user1_t)
Also you need to either allow domain user1_t to run in role system_r or allow a role transition from system_r to user1_r by initrc_t.
Allowing the domain user1_t in role system_r is done by:
role system_r types user1_t;
Allowing the role to be changed requires adding privrole to the attributes of domain initrc_t. In that case either the identity system_u must be permitted to have the role user1_r or initrc_t also needs the privuser attribute so it can launch a process with a different identity.
Quoted 2 lines
What am I missing? Or, is there a better way of running the four applications in their respective user domains from the init scripts?
Maybe have cron launch them. Cron has all privs needed to launch processes on behalf of users.
Signature · 9 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 4 lines · Russell Coker
Allowing the role to be changed requires adding privrole to the attributes of domain
initrc_t. In that case either the identitysystem_umust be permitted to have the roleuser1_rorinitrc_talso needs the privuser attribute so it can launch a process with a different identity.
Role changes also require a role allow rule, e.g.
allow foo_r bar_r;
Signature · 8 lines
Stephen Smalley <[email protected]> National Security Agency -- 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 8 lines · Stephen Smalley
Quoted 4 lines · Russell Coker
Allowing the role to be changed requires adding privrole to the attributes of domain
initrc_t. In that case either the identitysystem_umust be permitted to have the roleuser1_rorinitrc_talso needs the privuser attribute so it can launch a process with a different identity.Role changes also require a role allow rule, e.g.
allowfoo_rbar_r;
True, but that should already be allowed. Init scripts run as system_u:system_r:initrc_t, and system_r is already allowed to change to every role.
Signature · 9 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.