LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 07-10-2009, 07:05 AM   #1
Vypadkovyy
LQ Newbie
 
Registered: Jul 2009
Distribution: Ubuntu 9.04, Sorcerer, RHEL 5
Posts: 8

Rep: Reputation: 1
auditd and bash builtins


Hey there (first post here, so please tell me if I'm being a bit noobish)

I've been searching google for days now trying to find the answer to this question, but so far all of my searches have been pretty much useless.

I'm trying to configure auditd on a RHEL 5 server to keep track of a users every action. So far, i've added this rule to my /etc/audit/audit rules file

Code:
-a entry,always -S execve
-a entry,never
but the problem is that it won't keep track of shell builtins. A disgruntled administrator could gain root access to the machine, use shell builtins like "kill" and we would never know what happened (if he cleared his bash history)

Anybody know how to make auditd track shell builtins? If it can't, can anyone suggest and open source solution which can?
 
Old 07-10-2009, 08:07 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
Auditd no but you could use Rootsh as logging shell wrapper. In any case there are privacy and security considerations attached to logging output. BTW, if you allow root account access then root can undo any action. Best configure logging to a hardened remote syslog server.
 
Old 07-10-2009, 08:59 AM   #3
Vypadkovyy
LQ Newbie
 
Registered: Jul 2009
Distribution: Ubuntu 9.04, Sorcerer, RHEL 5
Posts: 8

Original Poster
Rep: Reputation: 1
it actually logs to a splunk server for that very reason

to add to my previous post, I've found an awesome guide on novell's site [novell.com] which helped me to configure auditd.

I can get it to track the kill call, but I'm looking for a way to log everything and then whitelist the programs that I do not want to log.

forcing users to have an alternate shell is probably not an option.
 
Old 07-10-2009, 09:18 AM   #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
Sure you can log syscalls with Auditd no problem. It's all in the LSPP/CAPP/SNARE audit rulesets, examples galore. The "problem" (not really, unless) with Auditd logging is that it's in-kernel and the kernel as usual gives zilch about "everything" nor does it provide you with the kind of mapping or resolution you get in userland. As a consequence saying "log everything" sounds greedy-matching enough until you actually define any auditing aspects as "...and also give me all the commands arguments" and "... and CLI output". If something is "not an option" if could help explain why, pointing to rules 'n regulations, policies or whatever else in effect.
 
Old 07-10-2009, 09:48 AM   #5
Vypadkovyy
LQ Newbie
 
Registered: Jul 2009
Distribution: Ubuntu 9.04, Sorcerer, RHEL 5
Posts: 8

Original Poster
Rep: Reputation: 1
thx unSpawn. I'll definitely keep researching. I suppose "log everything" does sound a bit greedy I suppose what I really meant was that I want to log enough so that I know what actions a certain user has done and the consequences of this action.

for example. a certain user (uid and gid known) executes a command which starts a process (pid and ppid known). this process kicks off two others, one which runs with certain permissions, the other which drops down to lower permissions. The end result is that a file is written to and another process is killed.

right now auditd is doing a good job at logging things like this. but there are a few situations that give no feedback. I'm just trying to fill in the holes in those situations.

right now, the biggest problem is shell builtin commands. right now, it looks like i have to explicitly state each one I'd like to track (some of which don't match up with their command names). I'm just worried that I might miss a few and leave an obvious security hole open.

I'll keep looking at the examples you mentioned and try to learn more about auditd. thanks
 
Old 07-10-2009, 10:47 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Vypadkovyy View Post
I suppose "log everything" does sound a bit greedy
No, not really. "greedy match" has nothing to do with greed: it's a common term for regexes that aren't properly anchored. In your case as in not defining exactly what you need. Most wheels have been invented: we just need to know if you need huge tires or ludicrously huge tires...


Quote:
Originally Posted by Vypadkovyy View Post
I suppose what I really meant was that I want to log enough so that I know what actions a certain user has done and the consequences of this action. for example. a certain user (uid and gid known) executes a command which starts a process (pid and ppid known). this process kicks off two others, one which runs with certain permissions, the other which drops down to lower permissions. The end result is that a file is written to and another process is killed.
This looks more like strace-like style troubleshooting than auditing but maybe that's just me.


Quote:
Originally Posted by Vypadkovyy View Post
right now auditd is doing a good job at logging things like this. but there are a few situations that give no feedback. I'm just trying to fill in the holes in those situations. right now, the biggest problem is shell builtin commands. right now, it looks like i have to explicitly state each one I'd like to track (some of which don't match up with their command names). I'm just worried that I might miss a few and leave an obvious security hole open.
Userland processes communicating with the kernel requires a fixed set of syscalls. Getting all syscalls isn't hard either if you check lib/modules/$(uname -r)/build)/include/asm-i386/unistd.h. For looking up things for reporting and adding rules I use two shell functions:
Code:
syscallName2Num() { # Resolve system call name to its number
 HDRLOC="$(readlink -f /lib/modules/$(uname -r)/build)/include/asm-i386/unistd.h"
 grep "^#define __NR_${1}[[:blank:]]" $HDRLOC | awk '{print $3}'
}

syscallNum2Name() { # Resolve system call number to canonical name
 HDRLOC="$(readlink -f /lib/modules/$(uname -r)/build)/include/asm-i386/unistd.h"
 grep "^#define __NR_.*[[:blank:]]$1$" $HDRLOC | awk -F'_' '{print $4}'
}
* BTW, if you want to see which syscalls get used just strace something.
 
Old 07-10-2009, 11:37 AM   #7
Vypadkovyy
LQ Newbie
 
Registered: Jul 2009
Distribution: Ubuntu 9.04, Sorcerer, RHEL 5
Posts: 8

Original Poster
Rep: Reputation: 1
heh, thanks

This was just what I was looking for. And yes, i suppose it really isn't auditing, I'm trying to set up a system for user process accounting. I need to know who's doing things to what and auditd seems to do what i need.
 
  


Reply

Tags
auditd



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
Interfacing with the Auditd scourge99 Linux - Kernel 6 07-08-2009 07:23 PM
auditd: auditd startup failed cmschube Red Hat 2 05-11-2009 07:08 AM
Bash builtins?????? adnankhawer Linux - Software 8 03-07-2008 02:24 PM
over rule bash builtins lynnevan Slackware 6 04-01-2007 01:19 PM
Help with crond and auditd pfaendtner Linux - Software 4 04-25-2005 10:41 AM

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

All times are GMT -5. The time now is 03:04 PM.

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