public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* [Patch]Fix the bug of comparing the file's mode in dispatch_parser() and check_exe_name()
@ 2008-07-27  7:09 chuli
  2008-07-27 19:21 ` Steve Grubb
  0 siblings, 1 reply; 2+ messages in thread
From: chuli @ 2008-07-27  7:09 UTC (permalink / raw)
  To: 'Steve Grubb'; +Cc: 'linux-audit'

Hi Mr. Grubby,

  When I set "dispatcher = /mydir/audispd" in /etc/audit/auditd.conf and make
the mode of /mydir/audispd to 0755, auditd can be started successfully. But I
found in the codes that such file like "/mydir/audispd" is hoped as 0750. 
There
is a little error in comparing the file's mode, "S_IRWXO" should be used not 
just
"S_IWOTH", otherwise the file is allowed to be readable or executable by
others.

  There is the same bug in check_exe_name(). This bug will allow the script of
"exec /path-to-script" to be readable or executable by others.

  Here is my patch for audit-1.7.4. Hope for your opinion about such 
modification.

Signed-off-by: Chu Li<chul@cn.fujitsu.com>
---
diff --git a/src/auditd-config.c b/src/auditd-config.c
index a7a939e..fc2fd48 100644
--- a/src/auditd-config.c
+++ b/src/auditd-config.c
@@ -629,7 +629,7 @@ static int dispatch_parser(struct nv_pair *nv, int line,
 		audit_msg(LOG_ERR, "%s is not owned by root", nv->value);
 		return 1;
 	}
-	if ((buf.st_mode & (S_IRWXU|S_IRWXG|S_IWOTH)) !=
+	if ((buf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) !=
 			   (S_IRWXU|S_IRGRP|S_IXGRP)) {
 		audit_msg(LOG_ERR, "%s permissions should be 0750", nv->value);
 		return 1;
@@ -869,7 +869,7 @@ static int check_exe_name(const char *val)
 		audit_msg(LOG_ERR, "%s is not owned by root", val);
 		return -1;
 	}
-	if ((buf.st_mode & (S_IRWXU|S_IRWXG|S_IWOTH)) !=
+	if ((buf.st_mode & (S_IRWXU|S_IRWXG|S_IRWXO)) !=
 			   (S_IRWXU|S_IRGRP|S_IXGRP)) {
 		audit_msg(LOG_ERR, "%s permissions should be 0750", val);
 		return -1;

Regards
Chu Li

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch]Fix the bug of comparing the file's mode in dispatch_parser() and check_exe_name()
  2008-07-27  7:09 [Patch]Fix the bug of comparing the file's mode in dispatch_parser() and check_exe_name() chuli
@ 2008-07-27 19:21 ` Steve Grubb
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Grubb @ 2008-07-27 19:21 UTC (permalink / raw)
  To: chuli; +Cc: 'linux-audit'

On Sunday 27 July 2008 03:09:30 chuli wrote:
>   Here is my patch for audit-1.7.4. Hope for your opinion about such
> modification.

Looks good - applied.

Thanks,
-Steve

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-27 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-27  7:09 [Patch]Fix the bug of comparing the file's mode in dispatch_parser() and check_exe_name() chuli
2008-07-27 19:21 ` Steve Grubb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox