From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Grubb Subject: Re: getuid() vs. geteuid() in auditctl Date: Tue, 20 Mar 2012 14:07:46 -0400 Message-ID: <201203201407.46778.sgrubb@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com List-Id: linux-audit@redhat.com On Friday, March 16, 2012 05:50:56 PM Peter Moody wrote: > line 1162 in auditctl.c has this: > > #ifndef DEBUG > /* Make sure we are root */ > if (getuid() != 0) { > fprintf(stderr, "You must be root to run this program.\n"); > return 4; > } > #endif > > Is there any particular reason to use getuid() there as opposed to > geteuid()? I suppose it doesn't matter. I never envisioned having a helper application, so that why its the way it is. Since we are optionally linking in libcap-ng, I suppose we could even check the capability rather than the euid. Also note that for certification purposes the file permissions are restricted. -Steve > In my particular case, we have a setuid helper that allows > a normal user to run 'auditctl -l' (with a clean environment), and > this prevents the setuid helper from working.