Wednesday, July 21, 2010

SELINUX SCREWS LOG FILES

How do we troubleshoot a problem in a Linux machine
We first try to see through the logs and see if we notice anything.

Now what if the logs are empty. What do we do ???
Ahh we are in a deep shit now. We check the /var and then the space on the /var and permissions and all things and we dont find anything. We check the syslog config file and we still dont see anything. Now What. Someone Help me please.

What I do is I check the dmesg and do a grep on the syslog. Ahh I found something. If at all it returns you with a similar output as shown below you can really catch the IT security guy and blame it on the SELINUX config
dmesg | grep syslog
audit(1151150355.645:2): avc: denied { read } for pid=2204 comm="syslogd" name="services" dev=dm-0 ino=14567535 scontext=system_u:system_r:syslogd_t tcontext=rootbject_r:tmp_t tclass=file
.

A quick workaround is to stop the syslog service and start the daemons from the terminal.
Ohh hoo it works.

service syslog stop
Stopping kernel logger [OK]
Stopping system logger [OK]
[root@test]# klogd -d
[root@test]# syslogd -d.


Now check the logs and it has to work.

Now what. Solution for this is


Turn off the Damn SELINUX or run

fixfiles relabel


Problem resolved. Give me a 5