Skip to contentSkip to conversation

running make relabel from a cronjob

PATCH Luke Kenneth Casson Leighton 2 participants 3 messages Aug 24, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

the following patches allow the attached /etc/cron.d/selinux program to successfully run.

this is for a user-only system where root access will not be given out, and there won't be any maintenance or support, either.

i heard from someone that Fedora also has a cronjob doing a make relabel too, so i am slightly confused that the strict selinux policy doesn't presently have this already oh well.

l.

Signature · 7 lines
--
Truth, honesty and respect are rare commodities that all spring from
the same well: Love.  If you love yourself and everyone and everything
around you, funnily and coincidentally enough, life gets a lot better.
--
<a href="http://lkcl.net">      lkcl.net      </a> <br />
<a href="mailto:[email protected]"> [email protected] </a> <br />
setfiles.te renamed from usr/share/selinux/policy/default/domains/program/setfiles.te +5 -0
@@ -49,9 +49,14 @@
 
 allow setfiles_t etc_runtime_t:file read;
 allow setfiles_t etc_t:file read;
+allow setfiles_t automount_etc_t:file { getattr read };
 allow setfiles_t proc_t:file { getattr read };
 dontaudit setfiles_t proc_t:lnk_file { getattr read };
 
 # for config files in a home directory
 allow setfiles_t home_type:file r_file_perms;
 dontaudit setfiles_t sysadm_tty_device_t:chr_file { relabelfrom };
+
+# allow setfiles to be run from crond
+allow setfiles_t crond_t:fifo_file { read write };
+
crond.te renamed from usr/share/selinux/policy/default/domains/program/crond.te +8 -0
@@ -202,3 +202,11 @@
 r_dir_file(system_crond_t, file_context_t)
 can_getsecurity(system_crond_t)
 ')
+
+
+allow system_crond_t policy_src_t:file { read };
+	#EXE=/usr/bin/make  NAME=Makefile   :  read
+
+can_exec(system_crond_t, setfiles_exec_t)
+domain_auto_trans(system_crond_t,  setfiles_exec_t, setfiles_t)
+
# run every 6 hours to restore contexts on filesystem
# ... just in case of damage...

SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
* 0,6,12,18	* * *	root    nice -20 make -C /etc/selinux/src relabel
#1 lore raw
Quoted 9 lines · Luke Kenneth Casson Leighton

the following patches allow the attached /etc/cron.d/selinux program to successfully run.

this is for a user-only system where root access will not be given out, and there won't be any maintenance or support, either.

i heard from someone that Fedora also has a cronjob doing a make relabel too, so i am slightly confused that the strict selinux policy doesn't presently have this already oh well.

See the cron_can_relabel boolean in crond.te and the fixfiles.cron script in policycoreutils. If CRONTYPE=relabel is in /etc/selinux/config and the cron_can_relabel boolean is enabled, then cron will (and can) relabel. Otherwise, cron will merely check file contexts and mail a report about incorrect contexts. It doesn't need to access policy sources; there is an installed file_contexts file in /etc/selinux/$SELINUXTYPE/contexts/files that is used at runtime for restorecon, fixfiles, etc.

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.
#2 lore raw
Quoted 11 lines · Stephen Smalley
Quoted 9 lines · Luke Kenneth Casson Leighton

the following patches allow the attached /etc/cron.d/selinux program to successfully run.

this is for a user-only system where root access will not be given out, and there won't be any maintenance or support, either.

i heard from someone that Fedora also has a cronjob doing a make relabel too, so i am slightly confused that the strict selinux policy doesn't presently have this already oh well.

Quoted 8 lines

See the cron_can_relabel boolean in crond.te and the fixfiles.cron script in policycoreutils. If CRONTYPE=relabel is in /etc/selinux/config and the cron_can_relabel boolean is enabled, then cron will (and can) relabel. Otherwise, cron will merely check file contexts and mail a report about incorrect contexts. It doesn't need to access policy sources; there is an installed file_contexts file in /etc/selinux/$SELINUXTYPE/contexts/files that is used at runtime for restorecon, fixfiles, etc.

ah ha!

great. thank you v. much.

l.

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