<div>Thanks Steve for the prompt response. <br></div><div class="protonmail_signature_block "><div class="protonmail_signature_block-user ">Could you please help me understand how the starting of the application from systemd will solve my problem of capturing the auid of the person who sudoes to another userid and runs the script to access the files. <br></div><div class="protonmail_signature_block-user "><user2> sudoes to <super-user2> and runs the script to access the files. <br></div><div class="protonmail_signature_block-user "><br></div><div class="protonmail_signature_block-user ">with the application starting as systemd - auid will be -1, uid would still be <super_user2> and <user2> id wont be logged in audit log. Is it not? <br></div><div class="protonmail_signature_block-user "><br></div><div class="protonmail_signature_block-user ">Thanks,<br></div><div class="protonmail_signature_block-user ">Amit. </div><div class="protonmail_signature_block-user "><br></div><div class="protonmail_signature_block-proton ">Sent with <a href="https://protonmail.com">ProtonMail</a> Secure Email.<br></div></div><div><br></div><blockquote type="cite" class="protonmail_quote"><div>-------- Original Message --------<br></div><div>Subject: Re: auid of a script started by a daemon process.<br></div><div>Local Time: February 20, 2017 11:04 AM<br></div><div>UTC Time: February 20, 2017 5:04 PM<br></div><div>From: sgrubb@redhat.com<br></div><div>To: linux-audit@redhat.com, Kaptaan <kaptaan@protonmail.com><br></div><div><br></div><div>On Monday, February 20, 2017 11:50:31 AM EST Kaptaan wrote:<br></div><div> > Hello All,<br></div><div> > I have recently been introduced to linux security. After going through man<br></div><div> > pages and some posts, I believe I have configured and setup my audit rules<br></div><div> > correctly. My need is to monitor and log access to all files in certain<br></div><div> > directories. The problem.<br></div><div> > Application1 - I log in using my id <user1>. I sudo to <super_user1> and<br></div><div> > start the application. The application starts a few daemon process owned by<br></div><div> > <super_user1>.<br></div><div> > <br></div><div> > User2 - uses the application to access the files (through some script). The<br></div><div> > script is actually executed by the application's daemon process.<br></div><div> > <br></div><div> > The auid shown in the audit logs is always my id <user1> for all audit<br></div><div> > events.<br></div><div> <br></div><div> Yes. This sounds like a problem. The auid is the mechanism to track who the <br></div><div> person is no matter who they sudo/su to. The uid is the transient id of the <br></div><div> user that changes with whatever account they are currently using.<br></div><div> <br></div><div> Daemons have an auid of (unsigned int)-1. I think that to fix the issue, you <br></div><div> need your daemons started by themselves and not from your account. With <br></div><div> systemd its pretty easy. From a SysVinit based system...its not fixable.<br></div><div> <br></div><div> The auid is set on login and is inherited by each process that gets started in <br></div><div> your session. With systemd, when you start a daemon a message goes across dbus <br></div><div> and systemd forks and execs the daemon. The auid is -1. On sysVinit systems, <br></div><div> you run the init script in your session so the daemon picks up your auid.<br></div><div> <br></div><div> <br></div><div> > So I started capturing the uid from the logs which shows <user2>.<br></div><div> > <br></div><div> > Now user2 is smart, he/she sudo to <super_user2> and then runs the same<br></div><div> > script to access the files. This time the auid is shown as my user <user1><br></div><div> > and the uid, euid is always shown as <super_user2>.<br></div><div> > <br></div><div> > Is there a way I can get the auid of the person who started the script even<br></div><div> > after he/she sudoes to another user?<br></div><div> <br></div><div> It is the auid.<br></div><div> <br></div><div> -Steve<br></div><div> <br></div><div> > Any help/suggestion is much appreciated.<br></div><div> > <br></div><div> > Thanks,<br></div><div> > Amit.<br></div><div> <br></div></blockquote><div><br></div>