netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: create audit records for x_tables replaces
@ 2011-01-14 22:45 Thomas Graf
  2011-01-16 17:14 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Graf @ 2011-01-14 22:45 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel, linux-audit, Eric Paris, Al Viro

The setsockopt() syscall to replace tables is already recorded
in the audit logs. This patch stores additional information
such as table name and netfilter protocol.

Cc: Patrick McHardy <kaber@trash.net>
Cc: Eric Paris <eparis@parisplace.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Thomas Graf <tgraf@redhat.com>

Index: net-2.6/include/linux/audit.h
===================================================================
--- net-2.6.orig/include/linux/audit.h
+++ net-2.6/include/linux/audit.h
@@ -104,6 +104,7 @@
 #define AUDIT_CAPSET		1322	/* Record showing argument to sys_capset */
 #define AUDIT_MMAP		1323	/* Record showing descriptor and flags in mmap */
 #define AUDIT_NETFILTER_PKT	1324	/* Packets traversing netfilter chains */
+#define AUDIT_NETFILTER_CFG	1325	/* Netfilter chain modifications */
 
 #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */
Index: net-2.6/net/netfilter/x_tables.c
===================================================================
--- net-2.6.orig/net/netfilter/x_tables.c
+++ net-2.6/net/netfilter/x_tables.c
@@ -23,6 +23,7 @@
 #include <linux/mutex.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
+#include <linux/audit.h>
 #include <net/net_namespace.h>
 
 #include <linux/netfilter/x_tables.h>
@@ -820,6 +821,21 @@ xt_replace_table(struct xt_table *table,
 	 */
 	local_bh_enable();
 
+#ifdef CONFIG_AUDIT
+	if (audit_enabled) {
+		struct audit_buffer *ab;
+
+		ab = audit_log_start(current->audit_context, GFP_KERNEL,
+				     AUDIT_NETFILTER_CFG);
+		if (ab) {
+			audit_log_format(ab, "table=%s family=%u entries=%u",
+					 table->name, table->af,
+					 private->number);
+			audit_log_end(ab);
+		}
+	}
+#endif
+
 	return private;
 }
 EXPORT_SYMBOL_GPL(xt_replace_table);

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

* Re: [PATCH] netfilter: create audit records for x_tables replaces
  2011-01-14 22:45 [PATCH] netfilter: create audit records for x_tables replaces Thomas Graf
@ 2011-01-16 17:14 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2011-01-16 17:14 UTC (permalink / raw)
  To: netfilter-devel, linux-audit, Eric Paris, Al Viro

Am 14.01.2011 23:45, schrieb Thomas Graf:
> The setsockopt() syscall to replace tables is already recorded
> in the audit logs. This patch stores additional information
> such as table name and netfilter protocol.
> 

Applied, thanks Thomas.

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

end of thread, other threads:[~2011-01-16 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 22:45 [PATCH] netfilter: create audit records for x_tables replaces Thomas Graf
2011-01-16 17:14 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).