Skip to content

Commit a45d885

Browse files
rgbriggspcmoore
authored andcommitted
netfilter: add audit table unregister actions
Audit the action of unregistering ebtables and x_tables. See: linux-audit/audit-kernel#44 Signed-off-by: Richard Guy Briggs <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent c4dad0a commit a45d885

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

include/linux/audit.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct audit_ntp_data {};
9797
enum audit_nfcfgop {
9898
AUDIT_XT_OP_REGISTER,
9999
AUDIT_XT_OP_REPLACE,
100+
AUDIT_XT_OP_UNREGISTER,
100101
};
101102

102103
extern int is_audit_feature_set(int which);

kernel/auditsc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ struct audit_nfcfgop_tab {
136136
};
137137

138138
const struct audit_nfcfgop_tab audit_nfcfgs[] = {
139-
{ AUDIT_XT_OP_REGISTER, "register" },
140-
{ AUDIT_XT_OP_REPLACE, "replace" },
139+
{ AUDIT_XT_OP_REGISTER, "register" },
140+
{ AUDIT_XT_OP_REPLACE, "replace" },
141+
{ AUDIT_XT_OP_UNREGISTER, "unregister" },
141142
};
142143

143144
static int audit_match_perm(struct audit_context *ctx, int mask)

net/bridge/netfilter/ebtables.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,6 +1124,8 @@ static void __ebt_unregister_table(struct net *net, struct ebt_table *table)
11241124
mutex_lock(&ebt_mutex);
11251125
list_del(&table->list);
11261126
mutex_unlock(&ebt_mutex);
1127+
audit_log_nfcfg(table->name, AF_BRIDGE, table->private->nentries,
1128+
AUDIT_XT_OP_UNREGISTER);
11271129
EBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size,
11281130
ebt_cleanup_entry, net, NULL);
11291131
if (table->private->nentries)

net/netfilter/x_tables.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,8 @@ void *xt_unregister_table(struct xt_table *table)
14721472
private = table->private;
14731473
list_del(&table->list);
14741474
mutex_unlock(&xt[table->af].mutex);
1475+
audit_log_nfcfg(table->name, table->af, private->number,
1476+
AUDIT_XT_OP_UNREGISTER);
14751477
kfree(table);
14761478

14771479
return private;

0 commit comments

Comments
 (0)