LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-06-2020, 01:46 AM   #1
Wallboy
LQ Newbie
 
Registered: Nov 2020
Posts: 2

Rep: Reputation: Disabled
Using auditd to trace every boot process


Hey all,


I'm trying to figure out how to view every single process that gets ran since boot, everything from PID 1 and onwards; even short lived transient processes. After googling around, I discovered auditd would be the tool for the job.

I have the following line in my auditd rules file:

Code:
-a exit,always -S execve
I've also added the
Code:
audit=1
kernel parameter to get early audit support before the auditd daemon has started.

However, after looking at the audit.log file, I can only see all processes that have launched AFTER the auditd daemon has started. I was under the impression the point of the
Code:
audit=1
kernel parameter was to be able to capture the SYSCALLs before the userspace daemon is ran.

Anyone have any ideas what I'm doing wrong, or if there is another way to go about seeing every single process (and arguments passed to it) that was ran during the entire boot sequence?
 
Old 11-06-2020, 03:58 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
By any definition (and there are several), boot has well and truly finished by the time init has been scheduled - let alone later tasks like auditd. Everything prior to init is in kernel-space - none of it issues syscalls, let alone attempting things like trying to open files which might leave audit records. Be satisfied with what you have would be my perspective.
 
Old 11-06-2020, 05:21 AM   #3
Wallboy
LQ Newbie
 
Registered: Nov 2020
Posts: 2

Original Poster
Rep: Reputation: Disabled
Yeah I know about the kernel itself being finished by the time it has to call the userspace init. I'm not so much interested in the kernel initialization stuff itself, but everything from userspace init and onwards like I mentioned. Obviously there must be a way to do this, since how would you debug/trace a potentially slow process (that's supposed to be short-lived/transient) that boots between init (the actual systemd process) and the last process to load before user input (agetty, for the sake of an example). systemd-analyze doesn't go deep enough, as that only shows you processes that systemd kicks off, but not potentially what THOSE processes themselves end up executing. I'm just interested in seeing the process called, it's arguments, and potentially the CPU time it used. auditd works fantastic for this, but ONLY after the daemon has already started.

On Windows side of things you have WPR w/ boot tracing and WPA which gives you the entire picture of all processes (whether permanent or transient) during the boot. From everything I've read, I should be able to see these processes with auditd and the audit=1 kernel flag.

EDIT: I figured out what I'll probably need to do, is that I need to call auditctl in the initramfs. Though feel free to chime in on any additional ways or other tools that accomplish what I'm trying to do.

EDIT2: This was indeed the fix. I just edited my initramfs to include auditctl and have it start capturing the execve SYSCALL just prior to the call to switch_root. I can see all process calls now that I want.

Last edited by Wallboy; 11-06-2020 at 07:22 PM. Reason: Solved.
 
1 members found this post helpful.
Old 11-06-2020, 11:38 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,129

Rep: Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121Reputation: 4121
Excellent - thanks for the updates. Never a day goes by there isn't something to learn.
 
  


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
The auditd daemon stops logging after deleting audit.log until auditd is restarted Latitude Linux - Security 2 06-20-2013 03:10 PM
Sir, While installing ns2.34 on fedora 16 got the error : trace/cmu-trace.cc 1327:22 jeevanpinto Linux - Newbie 2 06-28-2012 03:35 AM
auditd: auditd startup failed cmschube Red Hat 2 05-11-2009 07:08 AM
How to trace and disable the HTTP TRACE method in Apache 1.3.33 with FreeBSD? SomnathG Linux - Security 1 11-11-2008 09:41 AM
"killed" Message - how to trace/back trace ebinjose Linux - Kernel 1 01-29-2008 06:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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