Skip to contentSkip to conversation

Service control via /etc/init.d/ using strict policy

DISCUSSION Eoin Ryan 3 participants 3 messages Feb 4, 2008 SELinux security module

lore
Share & tools
lore

Eoin Ryan

author
#0 lore raw

Hi All,

Apologies in advance if this is slightly off topic. Over the last few years I've gained some experience with SELinux using the targeted policy, but now after discovering the new support in RHEL5 I've decided to learn about the strict/mls policies and hopefully contribute in some way one day.

I have a test RHEL5 system running the strict policy, but I'm confused about how services/daemons can be controlled by the superuser. The sysadm_t does not have permission to execute initrc_exec_t, but does have permission to execute /usr/sbin/httpd directly as it's httpd_exec_t. The type_transition rules allow mainly the system startup types (init_t etc) to transition to initrc_exec_t, but there is no transition from sysadm_t defined. This seems to say that services can only be started and stopped during bootup and shutdown.

Am I missing something here, or does a transition to initrc_exec_t need to be defined for some SELinux user via a policy module? Sorry if my terminology is a little off.

Kind Regards
Eoin

#1 lore raw
Quoted 17 lines · Eoin Ryan

Hi All,

Apologies in advance if this is slightly off topic. Over the last few years I've gained some experience with SELinux using the targeted policy, but now after discovering the new support in RHEL5 I've decided to learn about the strict/mls policies and hopefully contribute in some way one day.

I have a test RHEL5 system running the strict policy, but I'm confused about how services/daemons can be controlled by the superuser. The sysadm_t does not have permission to execute initrc_exec_t, but does have permission to execute /usr/sbin/httpd directly as it's httpd_exec_t. The type_transition rules allow mainly the system startup types (init_t etc) to transition to initrc_exec_t, but there is no transition from sysadm_t defined. This seems to say that services can only be started and stopped during bootup and shutdown.

Quoted 3 lines

Am I missing something here, or does a transition to initrc_exec_t need to be defined for some SELinux user via a policy module? Sorry if my terminology is a little off.

Depends on your policy build settings. If DIRECT_INITRC was set to n in build.conf, then you have to use run_init to run init scripts from an admin shell, so you can do:
run_init /etc/init.d/httpd restart

Signature · 8 lines
Stephen Smalley
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.
#2 lore raw
In reply to Eoin Ryan
Quoted 17 lines · Eoin Ryan

Hi All,

Apologies in advance if this is slightly off topic. Over the last few years I've gained some experience with SELinux using the targeted policy, but now after discovering the new support in RHEL5 I've decided to learn about the strict/mls policies and hopefully contribute in some way one day.

I have a test RHEL5 system running the strict policy, but I'm confused about how services/daemons can be controlled by the superuser. The sysadm_t does not have permission to execute initrc_exec_t, but does have permission to execute /usr/sbin/httpd directly as it's httpd_exec_t. The type_transition rules allow mainly the system startup types (init_t etc) to transition to initrc_exec_t, but there is no transition from sysadm_t defined. This seems to say that services can only be started and stopped during bootup and shutdown.

Quoted 6 lines

Am I missing something here, or does a transition to initrc_exec_t need to be defined for some SELinux user via a policy module? Sorry if my terminology is a little off.

Kind Regards
Eoin

You could use e.g. "run_init /etc/init.d/sshd restart". Via "run_init" the type transition occurs. As long as I know that's the proper way of using init-scripts from sysadm_r at the moment.

--
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.