Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp162759ybl; Thu, 30 Jan 2020 19:20:36 -0800 (PST) X-Google-Smtp-Source: APXvYqykyMtuyTjzLeqsoKrzAM+NiTJgnmqN0PALylOrfIyPEG9PcOBB7YPMEOnWdx0UOdKudDj2 X-Received: by 2002:a05:6830:10d5:: with SMTP id z21mr6424540oto.30.1580440836005; Thu, 30 Jan 2020 19:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580440835; cv=none; d=google.com; s=arc-20160816; b=GtiUHw3t0eSnbq9Xh8Y4EYqyXaaMSqNyhxTb2uCu4x9J+wc5V6WA4Whe9G2sMxDyM3 K811DPWNbbpmdsO/FVD8LX7GfVrRjQ6NgftNO4obv+/GJyjCzGHZaZSMNKg6r2avlCSY GwYXBzofWM6LrCuhKOHmmFN6cHc1VQmQt11bSjtQ8J7W2sZ042cHBH0n5qprU7X+D1hI Pj2x82L7tjg2ehkZcuBrNFXeZmIXVc17cEfK/8stX6WmIlPllwdT6VpL4qhH9CL4z9/C bW/riSVq91zNsuRhpSz3CaAgH4GsQJ3onKMkfDHxYIrzrB3VpZ1LNlNelbtRzUaHBt0Z DIjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=buSrMaq3P1kBcoQzppNWiz8mxz8CGYk6xzumXwp47Gw=; b=u11kd2V7V3GT1dLumXYnw6lgxQ7GTOZEo/bny3AohGj6bgUXMLyeFBeDSU/YSrLiJQ fanQzNp1Ad+lDswxkcn/rmqoNwT9wsfB4ccFcyHDiFZhygVdkmJjh2ggehGKvwf3Mr4n Lsb51AtAvGQ2z/69IWIt5UriTbS+ncuyeku4HQkobuClsost0VKGd+vb4pETKYbXRJUU JsakhSX8ImlW32ce/F6Z3Ykla0hAE0eGUUFAxDMZuYBzHhNNVhmK8+UEG0w+SKTzWhDd Kfs74H8jP4KEisCMYC4PN40DvNlp0evzd3E479jMucsIwgU9WX83jvD2Qc6dr1Z30/sD BMEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b="TJDqBje/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s77si3778297oih.51.2020.01.30.19.20.23; Thu, 30 Jan 2020 19:20:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b="TJDqBje/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728030AbgAaDSw (ORCPT + 99 others); Thu, 30 Jan 2020 22:18:52 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:45094 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727859AbgAaDSw (ORCPT ); Thu, 30 Jan 2020 22:18:52 -0500 Received: by mail-ed1-f68.google.com with SMTP id v28so6170153edw.12 for ; Thu, 30 Jan 2020 19:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=buSrMaq3P1kBcoQzppNWiz8mxz8CGYk6xzumXwp47Gw=; b=TJDqBje/4kovhxVoa7fJhxwtKvZu96ba4Fazph6w0MgqLiH+B86Unk3FQHMvj+szhb B+Fwi7Ht3cclOtcdVriI0tXdtSDQBCAFStUdJgnbkt4+vZrvpw+EROax34d0/bRsfeW6 ROE2KlfQBnuFt7v8hN2PDQ+BARCWXMOkI/Gt9Bz8UFhqL8QMsjDG/xQrc3UFr5a1bFaS iLokGwwI0n+mG7MPo+eH/zIhgjWSNhi6URIfdKGDRMmYeB958FCJJPksr3lcnOymGzJ0 s7oMAFx+LdZvIuYbpYr4i08c47RbFsxOT15G6EYtBdMhhskmV0O3Pp1facwCw8noaoZU Kpag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=buSrMaq3P1kBcoQzppNWiz8mxz8CGYk6xzumXwp47Gw=; b=Ui24WOX83E42L5kdBxIRnsVSMNR+EoSuneDis4CB84UUjm1vmHtWNC5X/s7o32MA6d s1i48ZoIkBDAK4d7AEDB7+Amb0oCI2EqZuf3aryvtZ5HsqPkyFNnGIdTtrAR6lcYQKHw LIRsKjwa4P5IH/oGADiJa65NcGeyjfFeYjtRy9b0xd1AZgHwky9HHFW+JT3I1k3Up8/I NCEB0tNIOgqkviGYRZai+dDOAYjBsdmnLXKzv8V5XSkhIYUBFALm+OFKq3L11ORVXVoT IFIChPzpyAn39S9YrldtfyE9nF2LEPl3RAFnW2Rea43hwbo/A7+oUBHi8O2moWfLhPtj g3TQ== X-Gm-Message-State: APjAAAWV4rXAwigDLfHOxLve2HbbcDAKWGYEUkWYiKJ54stdUxS4fkRX lm/l0pFWsir/v4w/Tduy7kPck1ZT8SLGi7f3bh5x X-Received: by 2002:a17:906:198b:: with SMTP id g11mr6985931ejd.271.1580440730598; Thu, 30 Jan 2020 19:18:50 -0800 (PST) MIME-Version: 1.0 References: <65974a7254dffe53b5084bedfd60c95a29a41e08.1577830902.git.rgb@redhat.com> In-Reply-To: <65974a7254dffe53b5084bedfd60c95a29a41e08.1577830902.git.rgb@redhat.com> From: Paul Moore Date: Thu, 30 Jan 2020 22:18:39 -0500 Message-ID: Subject: Re: [PATCH ghak25 v2 9/9] netfilter: audit table unregister actions To: Richard Guy Briggs Cc: Linux-Audit Mailing List , LKML , netfilter-devel@vger.kernel.org, sgrubb@redhat.com, omosnace@redhat.com, fw@strlen.de, twoerner@redhat.com, Eric Paris , ebiederm@xmission.com, tgraf@infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 6, 2020 at 1:56 PM Richard Guy Briggs wrote: > > Audit the action of unregistering ebtables and x_tables. > > See: https://github.com/linux-audit/audit-kernel/issues/44 > Signed-off-by: Richard Guy Briggs > --- > kernel/auditsc.c | 3 ++- > net/bridge/netfilter/ebtables.c | 3 +++ > net/netfilter/x_tables.c | 4 +++- > 3 files changed, 8 insertions(+), 2 deletions(-) ... and in keeping with an ongoing theme for this patchset, please squash this patch too. > diff --git a/kernel/auditsc.c b/kernel/auditsc.c > index 999ac184246b..2644130a9e66 100644 > --- a/kernel/auditsc.c > +++ b/kernel/auditsc.c > @@ -2557,7 +2557,8 @@ void __audit_nf_cfg(const char *name, u8 af, int nentries, int op) > return; /* audit_panic or being filtered */ > audit_log_format(ab, "table=%s family=%u entries=%u op=%s", > name, af, nentries, > - op ? "replace" : "register"); > + op == 1 ? "replace" : > + (op ? "unregister" : "register")); > audit_log_end(ab); > } > EXPORT_SYMBOL_GPL(__audit_nf_cfg); > diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c > index baff2f05af43..3dd4eb5b13fd 100644 > --- a/net/bridge/netfilter/ebtables.c > +++ b/net/bridge/netfilter/ebtables.c > @@ -1126,6 +1126,9 @@ static void __ebt_unregister_table(struct net *net, struct ebt_table *table) > mutex_lock(&ebt_mutex); > list_del(&table->list); > mutex_unlock(&ebt_mutex); > + if (audit_enabled) > + audit_nf_cfg(table->name, AF_BRIDGE, table->private->nentries, > + 2); > EBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size, > ebt_cleanup_entry, net, NULL); > if (table->private->nentries) > diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c > index 4ae4f7bf8946..e4852a0cb62f 100644 > --- a/net/netfilter/x_tables.c > +++ b/net/netfilter/x_tables.c > @@ -1403,7 +1403,7 @@ struct xt_table_info *xt_replace_table(struct xt_table *table, > > if (audit_enabled) > audit_nf_cfg(table->name, table->af, private->number, > - private->number); > + !!private->number); > > return private; > } > @@ -1466,6 +1466,8 @@ void *xt_unregister_table(struct xt_table *table) > private = table->private; > list_del(&table->list); > mutex_unlock(&xt[table->af].mutex); > + if (audit_enabled) > + audit_nf_cfg(table->name, table->af, private->number, 2); > kfree(table); > > return private; > -- > 1.8.3.1 -- paul moore www.paul-moore.com