LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "System V" scripts not working properly sometimes (https://www.linuxquestions.org/questions/linux-newbie-8/system-v-scripts-not-working-properly-sometimes-711640/)

rbauhaus 03-14-2009 05:58 PM

"System V" scripts not working properly sometimes
 
Hi guys,
I have strange problem. Some services when run on Centos 32bit, 5.2 via service command behave abnormally. For example - Nagios when run as root from command prompt works normally, when in daemon mode - not (exits). Samba when run from prompt - work wonderfully, when via service smb start - is not serving files.
Had 2 guess:
1. when run via service command - wrong config file is read (Nagios especially has this I think)
2. or running via service command can be affected by SELinux or something?

Googled this, but without any luck. Any thoughts?

Robert

unSpawn 03-14-2009 09:04 PM

Luckily you don't need to guess. If something goes awry stuff gets logged. Nagios even provides useful "preflight check" information. If there's SE Linux warnings but you don't run setroubleshootd (see sealert) look in /var/log/audit/ (unless you don't run Auditd as well, then AVC log lines end up in /var/log/messages).

rbauhaus 03-15-2009 03:23 AM

Thank you for reply, you were right - audit.log was way to go.
Let's talk about Nagios in more detailed way.

It's 3.0.6 on Centos 5.2 32bit.
nagios --verify-config /etc/nagios/nagios.cfg
0 warnings, 0 errors. "Things look okay"

but
service nagios start
Starting nagios:CONFIG ERROR! Start aborted. Check your Nagios configuration.

So I checked /var/log/nagios/nagios.log - empty file.
And tail /var/log/messages - absolutely nothing about Nagios.

This is why I think Nagios has problem with config file.

So I checked audit.log and found few avc: denied { read }

so used audit2allow -a (to check what's blocked)
guess what? There was smbd and nagios rules proposals

then audit2allow -M myAdditionalRules < /var/log/audit/audit.log
(rules producet to myAdditionalRules.pp file)
semodule -i myAdditionalRules.pp

Had to do this 3 times (script was going further every time, and rules was longer naturally).

And Nagios started finally. I hope it can save somebody some time.
Again thank you for help.

Robert

unSpawn 03-15-2009 08:39 AM

Good you managed to go for the logs. But the Nagios quickinstall docs do have hints wrt SE Linux. I mean, reading does pay off. Still it's good to see you got it working all by yourself.


All times are GMT -5. The time now is 10:40 PM.