Hi everyone,
I'm trying to get a custom Apache build to work using SELinux.
Consider the following path (/Applications is a mount point I created):
/Applications/Apache/{conf,bin,htdocs,lib,etc}
All the Apache directories are stored in this directory structure. I've relabeled the filesystem using:
Code:
restorecon -R -v /Applications
Now all the files in the directory structure have the following context:
Code:
drwxr-xr-x root sys system_u:object_r:default_t
Now, I want the httpd executable to run as the httpd_t type (like the default red hat apache). So I've attempted to relabel the sub folders in an attempt to use the same context as apache:
Code:
chcon -R -h -t httpd_sys_content_t /Applications/Apache/htdocs
chcon -R -h -t httpd_exec_t /Applications/Apache/bin
chcon -h -t httpd_suexec_exec_t /Applications/Apache/bin/suexec
chcon -R -h -t httpd_config_t /Applications/Apache/conf
chcon -R -h -t httpd_config_t /Applications/Apache/ssl
chcon -R -h -t httpd_log_t /Applications/Apache/logs
chcon -R -h -t httpd_modules_t /Applications/Apache/modules
chcon -R -h -t lib_t /Applications/Apache/lib
Now when I start Apache via my custom SYSVInit script it runs as the correct context, ie. "httpd_t". However I get a number of errors about the "default_t" label:
Code:
Jun 25 10:56:00 setroubleshoot: SELinux is preventing access to files with the default label, default_t.
The only help I've managed to find on this via google is the
same message I get from setroubleshootd.
So this is where I'm stuck. I'm not sure what label these directories should be using. Is there any way to find out? Also when doing a relabel all the manual labeling I've done above is reset. Do I need to create a selinux policy for this in order to stop it relabeling these files as default_t ?
Any help on this is appreciated,
Cheers.