diff options
author | Thomas Graf <tgraf@infradead.org> | 2011-01-16 12:12:59 -0500 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2011-01-16 12:12:59 -0500 |
commit | fbabf31e4d482149b5e2704eb0287cf9117bdcf3 (patch) | |
tree | b12a1123474ab9aa566fc1a6e57e050653588ba0 | |
parent | 43f393caec0362abe03c72799d3f342af3973070 (diff) |
netfilter: create audit records for x_tables replaces
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>
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | include/linux/audit.h | 1 | ||||
-rw-r--r-- | net/netfilter/x_tables.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/audit.h b/include/linux/audit.h index ae227dfcf9c6..32b5c62a5042 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -104,6 +104,7 @@ | |||
104 | #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ | 104 | #define AUDIT_CAPSET 1322 /* Record showing argument to sys_capset */ |
105 | #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ | 105 | #define AUDIT_MMAP 1323 /* Record showing descriptor and flags in mmap */ |
106 | #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ | 106 | #define AUDIT_NETFILTER_PKT 1324 /* Packets traversing netfilter chains */ |
107 | #define AUDIT_NETFILTER_CFG 1325 /* Netfilter chain modifications */ | ||
107 | 108 | ||
108 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ | 109 | #define AUDIT_AVC 1400 /* SE Linux avc denial or grant */ |
109 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ | 110 | #define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */ |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index ee5de3af510a..fbc2b72091e0 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/audit.h> | ||
26 | #include <net/net_namespace.h> | 27 | #include <net/net_namespace.h> |
27 | 28 | ||
28 | #include <linux/netfilter/x_tables.h> | 29 | #include <linux/netfilter/x_tables.h> |
@@ -834,6 +835,21 @@ xt_replace_table(struct xt_table *table, | |||
834 | */ | 835 | */ |
835 | local_bh_enable(); | 836 | local_bh_enable(); |
836 | 837 | ||
838 | #ifdef CONFIG_AUDIT | ||
839 | if (audit_enabled) { | ||
840 | struct audit_buffer *ab; | ||
841 | |||
842 | ab = audit_log_start(current->audit_context, GFP_KERNEL, | ||
843 | AUDIT_NETFILTER_CFG); | ||
844 | if (ab) { | ||
845 | audit_log_format(ab, "table=%s family=%u entries=%u", | ||
846 | table->name, table->af, | ||
847 | private->number); | ||
848 | audit_log_end(ab); | ||
849 | } | ||
850 | } | ||
851 | #endif | ||
852 | |||
837 | return private; | 853 | return private; |
838 | } | 854 | } |
839 | EXPORT_SYMBOL_GPL(xt_replace_table); | 855 | EXPORT_SYMBOL_GPL(xt_replace_table); |