LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-10-2014, 07:42 PM   #1
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Rep: Reputation: 15
How to setup Auditd to monitor Apache/httpd for stop and restart.


So I have a process restart on me in the middle of the night all I have is
[notice] SIGHUP received. Attempting to restart
Can I monitor httpd with auditd and see who or what is sending the SIGHUP?

Thanks
 
Old 09-11-2014, 01:18 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Asserting: the process sending the -HUP, one way or the other, has to possess root rights, you run a Linux distribution that uses RHEL-style SysV initscripts (here for the "killproc" function in /etc/rc.d/init.d/functions) and this is a one off where you manually or using a script manage rules with auditctl due to monitoring a (potentially changing Process Id), you'll want to monitor (for correlation purposes): 0) the PID file, the kill binary (see assertion #1) and 2 the Process Id of httpd. This might (more or less) look something like this:

Code:
auditctl -a always,exit -F path=/var/run/httpd.pid -F perm=r -F auid=0 -k rootkill
auditctl -a always,exit -F path=/bin/kill -F perm=x -F auid=0 -k rootkill
auditctl -a always,exit -S kill -F auid=0 -F pid=[mainpidofhttpdprocess] -k rootkill
Also check crontabs BTW.
 
1 members found this post helpful.
Old 09-11-2014, 02:01 PM   #3
Nemus
Member
 
Registered: Apr 2007
Distribution: Fedora/Ubuntu
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by unSpawn View Post
Asserting: the process sending the -HUP, one way or the other, has to possess root rights, you run a Linux distribution that uses RHEL-style SysV initscripts (here for the "killproc" function in /etc/rc.d/init.d/functions) and this is a one off where you manually or using a script manage rules with auditctl due to monitoring a (potentially changing Process Id), you'll want to monitor (for correlation purposes): 0) the PID file, the kill binary (see assertion #1) and 2 the Process Id of httpd. This might (more or less) look something like this:

Code:
auditctl -a always,exit -F path=/var/run/httpd.pid -F perm=r -F auid=0 -k rootkill
auditctl -a always,exit -F path=/bin/kill -F perm=x -F auid=0 -k rootkill
auditctl -a always,exit -S kill -F auid=0 -F pid=[mainpidofhttpdprocess] -k rootkill
Also check crontabs BTW.
So how would I search the audit logs for the SIGHUP?
 
Old 09-11-2014, 06:19 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Use 'grep rootkill' or see 'man ausearch'?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I monitor services such as apache and mysql, and restart them automatically? abefroman Linux - Software 3 05-21-2008 10:06 PM
having apache read httpd.conf without restart xpucto Linux - Server 1 06-06-2007 03:03 AM
Apache server monitor and restart grob115 Linux - Server 3 02-28-2007 12:33 PM
Apache Rotates Logs During Restart - How do I STOP IT? jasonpsage Linux - Server 2 10-30-2006 07:23 AM
deleted httpd.conf - apache still finds it after restart jordanthompson Linux - Software 1 10-16-2004 02:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration