Writing to /var/log from CGIs with SElinux enabled



Hello, world

I have an HTTP server on RHEL4. I have a few CGIs that write logs on /
var/log, as expected. Without SELinux, they work OK. But, with
SElinux, these scripts fail because they can't open their logs. I have
modified their contexts:

$ ls -Z /var/log/swrep-soap-server.log
-rw-r--r-- apache apache system_u:object_r:httpd_sys_script_rw_t /
var/log/swrep-soap-server.log

but this is useless because my CGI cannot open /var/log, which is
var_log_t:

$ dmesg|grep audit |tail -n1
audit(1184265870.104:27): avc: denied { search } for pid=3888
comm="swrep-soap-serv"name="log" dev=hda1 ino=819222
scontext=root:system_r:httpd_sys_script_t
tcontext=system_u:object_r:var_log_t tclass=dir

so, I can't reach the logs. I suppose I shouldn't chcon /var/log, as
this would affect the rest of the system, right? I need to write
exactly 2 files on /var/log, how can I modify the policy to reach
them?

Thanks in advance.

.



Relevant Pages

  • RE: FC3, MySQL and PHP
    ... to run if you completely turn off selinux? ... Subject: FC3, MySQL and PHP ... > I've run into a problem with my web development server. ... which is an error it kept showing in the logs. ...
    (Fedora)
  • Re: smbd and httpd cant see other filesystems
    ... a section of the Fedora website that deals with the way it interacts with httpd. ... I haven't noticed anything SELinux-related in the logs but will have a closer look. ... In FC3 the default is to have SELinux enabled in Targeted mode, which means it only applies extra protection to some named daemons. ... try accessing pages in user directories and then look at /var/log/messages and the httpd error logs for SELinux access violation messages. ...
    (uk.comp.os.linux)
  • Re: Security Privacy, Big Brother, Linux Distros.
    ... them against hackers so then so you can keep hackers from deleting their ... presence from the logs. ... firewalls, they usually don't have any need of SELinux, while a server ... If you are worried, check the source code. ...
    (alt.os.linux)
  • Re: SElinux Syslog
    ... I am trying to setup a Selinux machine as a server to capture all the logs ... machine or logs from any aix machine. ...
    (comp.os.linux.security)