[CentOS] SELinux Relabeling

Wed Sep 9 12:08:27 UTC 2009
Jorge Fábregas <jorge.fabregas at gmail.com>

Hello everyone,

If create a folder called "whatever" under /var, the context is:

root:object_r:var_t  /var/whatever/

That's expected as it is under /var.  If I then change its type:

chcont -t httpd_sys_content_t /var/whatever

The context looks like:

root:object_r:httpd_sys_content_t  /var/whatever/

My question is...Shouldn't a relabeling of the filesystem change the type of 
this directory back to var_t?  I just performed a relabel (/.autorelabel) and 
the directory stayed with httpd_sys_content_t.  I thought that the only way 
this could happen was if I used "semanage fcontext -a ...." so that a new 
line would be appended in:
/etc/selinux//etc/selinux/targeted/contexts/files/file_contexts.local.


Not only that, If I perform "matchpathcon  /var/whatever" I still get var_t as 
its default type. Then again, why it kept the httpd_sys_content_t after the 
relabel?

Thansk in advance,
Jorge