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 04-14-2008, 07:26 PM   #1
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Rep: Reputation: 55
What is the best way to setup an "audit trail"?


What is the best way to setup an "audit trail"?

And what exactly is an "audit trail"?

Last edited by abefroman; 04-14-2008 at 07:56 PM.
 
Old 04-14-2008, 09:15 PM   #2
tajamari
Member
 
Registered: Jul 2007
Distribution: Red Hat CentOS Ubuntu FreeBSD OpenSuSe
Posts: 252

Rep: Reputation: 32
Quote:
Originally Posted by abefroman View Post
What is the best way to setup an "audit trail"?

And what exactly is an "audit trail"?
http://en.wikipedia.org/wiki/Audit_trail - hope this helps.
 
Old 04-14-2008, 10:11 PM   #3
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Is it specific to SSH commands usually?
 
Old 04-15-2008, 02:58 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
Quote:
Originally Posted by abefroman View Post
What is the best way to setup an "audit trail"?
What are the requirements? I mean, what *needs* to be logged?
 
Old 04-15-2008, 07:40 AM   #5
tiocsti
LQ Newbie
 
Registered: Apr 2008
Location: Atlanta, GA
Distribution: [linux] Ubuntu, [bsd] FreeBSD, NetBSD
Posts: 21

Rep: Reputation: 15
Quote:
Originally Posted by abefroman View Post
What is the best way to setup an "audit trail"?

And what exactly is an "audit trail"?
An audit trail usually refers to enabling the linux (2.6+) audit subsystem to basically log system calls of the criteria you specify. You can install the tools for centos with (i think) up2date install audit.

Once that's done, you can use auditctl to control it, and use ausearch to search the audit trail for rules matching a specific criteria.
 
Old 04-15-2008, 10:17 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 tiocsti View Post
An audit trail usually refers to enabling the linux (2.6+) audit subsystem to basically log system calls of the criteria you specify. (..) search the audit trail for rules matching a specific criteria.
I disgree. Having an audit trail is not confined to kernel 2.6 as you can have one in 2.4 as well. Requirements should dictate if using Auditd is the right tool for the job or if it is enough. Auditd logging is not all-encompassing, unless you can determine from a line like this 'type=SYSCALL msg= arch= syscall=128 success=yes exit=0 a0=8067750 a1=c6fc a2=80611b8 a3=80611b8 items=0 ppid= pid= auid=666 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 comm="modprobe" exe="/sbin/modprobe"' what just got loaded, you'll see it only logs whats within its scope, and can not for instance log commandline or screen output.
 
Old 04-15-2008, 10:27 AM   #7
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
If I use auditd will I be able to know which user su'd to root and then ran the commands?
 
Old 04-15-2008, 10:31 AM   #8
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

Rep: Reputation: 33
You don't need the audit trail to see all the su's.
Problem is su's can overlap and it's hard to pin point which su'd user did which command. The su and login info is normally written to /var/log messages.
 
Old 04-15-2008, 11:06 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
In addition to what DotHQ posted
Quote:
Originally Posted by abefroman View Post
and then ran the commands?
I have posted more than once in the past about auditing trails, maybe search this forum? One way could be to patch the kernel with GRSecurity as it allows for more finegrained logging and it seems it can currently live together with SELinux but I haven't tried that yet, the easiest way would be to use a "wrapper" shell like Rootsh. It logs all commands and screen output to either file or syslog. If run right the client can't mess with it (requirement) but can *flood* logs so next to only allowing trusted personnel in, this emphasises again that having an auditing trail *also* implies having a properly hardened box in the first place.
 
Old 04-16-2008, 08:33 PM   #10
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,430

Original Poster
Rep: Reputation: 55
Quote:
Originally Posted by unSpawn View Post
One way could be to patch the kernel with GRSecurity as it allows for more finegrained logging and it seems it can currently live together with SELinux but I haven't tried that yet,
Do you mean with the grsecurity's gradm or just the grsecurity kernel patches?
 
Old 04-17-2008, 05:12 AM   #11
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
For enhanced auditing the patch is enough, just make sure you hit the right sysctls.
 
Old 08-21-2008, 08:24 AM   #12
unixhunter
LQ Newbie
 
Registered: Aug 2008
Posts: 1

Rep: Reputation: 0
tracking su's

Quote:
Originally Posted by DotHQ View Post
You don't need the audit trail to see all the su's.
Problem is su's can overlap and it's hard to pin point which su'd user did which command. The su and login info is normally written to /var/log messages.

You can use something like this in /etc/profile to separate the history of each su:

HISTFILE=`tty | sed -e 's/\///g'`.hist
export HISTFILE

Each su will generate its own history file with a tty in the name so you can trace it back to the individual login.
 
Old 08-21-2008, 09:28 AM   #13
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by abefroman View Post
If I use auditd will I be able to know which user su'd to root and then ran the commands?
You should discourage or disable users su'ing to root and set these users up with sudo access. This can be simply be logged through syslog in most cases and it will usually notify the root user if they try to run a command they are not setup for, etc.

Unless you're wanting more details logged, I'd take the simple approach if this is all you're needing is who's su'ing to root and the like.
 
  


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
LXer: How to keep a detailed audit trail of what's being done on your Linux systems LXer Syndicated Linux News 1 02-06-2007 11:38 AM
"setup" or "elinks" text garbage displayed sr99 Red Hat 1 12-06-2006 07:43 PM
"mythtv-setup" giving "Session management error: Authentication Rejected" Mitchua Ubuntu 0 10-09-2005 04:32 PM
Audit Log Messages "denied" shortsword Linux - Newbie 0 10-03-2004 05:46 AM
pppd server audit trail bhwchun Linux - Networking 1 06-21-2004 05:07 AM

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

All times are GMT -5. The time now is 03:03 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