Skip to contentSkip to conversation

Recording user commands (from RE: Linux-audit Digest, Vol 31, Issue 12)

DISCUSSION [email protected] 4 participants 4 messages Apr 27, 2007 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

-----Original Message-----
While a little more verbose than one might like, couldn't you audit exec() system calls? That would certainly capture all the commands issued from a shell. However, you might want to only audit successful exec()s. As I recall from auditing *nix systems years ago, shells tend to just start trying to execute a command name along your path and if it fails, it tries again with the next path (for example, the command doesn't exist in /usr/local/bin, let's try /usr/bin and then /usr/sbin, etc.)
This would pick up other exec()s as well, but you should be able to
generate reports to find the ones that were issued by a shell. Just a thought.
--Tad Taylor

Message: 3
Date: Thu, 26 Apr 2007 11:10:05 -0400
From: Steve Grubb <[email protected]>
Subject: Re: Recording user command ?
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"

Quoted 1 line · Gavin White

In addition to recording system calls, file activity etc, I would

like

Quoted 1 line

to record issued commands, ie. anything typed into a shell by a

user.

Quoted 2 lines

Is this a reasonable thing to do with auditd? Is it possible?

Well, there are 2 kinds of users, root and everyone else. What
everyone else
does cannot be logged by the session they are running in because it
does not
have enough privileges to log to the audit system.

For the root user, it has enough privileges to log. We are working on
a
solution for this problem. I think most security targets are only
interested
in actions performed by the root user since they can affect the
machine in
many ways.

So, as it stands today, it can't be done with the audit system. We
hope to
have something that starts to address the problem soon.

-Steve

------------------------------

--
Linux-audit mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-audit

End of Linux-audit Digest, Vol 31, Issue 12
*******************************************

#2 lore raw
Quoted 2 lines · On Friday 27 April 2007 16:05, [email protected] wrote:

While a little more verbose than one might like, couldn't you audit exec() system calls?

Yes, you could certainly do that. But as you said, it would be more data than you would want. If you had a policy of no root logins, you could define a rule something like this:

-a always,entry -S execve -F 'auid>=500'

And that should cut it down to the commands run by real users and not daemons.

Quoted 1 line

However, you might want to only audit successful exec()s.

I don't think execve returns in the normal sense when successful.

-Steve

#3 lore raw
In reply to [email protected]
Quoted 3 lines · On Friday, April 27 2007 4:05:28 pm [email protected] wrote:

While a little more verbose than one might like, couldn't you audit exec() system calls? That would certainly capture all the commands issued from a shell.

I believe that would miss all of the shell built-in commands though, wouldn't it? Not sure if we would care, but you can do some interesting things with the built-ins ... (although maybe you could capture that through additional audit watches/syscalls/etc.)

Signature · 2 lines
paul moore
linux security @ hp
#4 lore raw
Quoted 4 lines · Paul Moore

I believe that would miss all of the shell built-in commands though, wouldn't it? Not sure if we would care, but you can do some interesting things with the built-ins ... (although maybe you could capture that through additional audit watches/syscalls/etc.)

# perl -e 'while (<>) {eval $_;}'

Doing proper auditing of what a user is doing is harder than it looks. Have a nice day. :)