Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7376599pxb; Thu, 18 Feb 2021 08:30:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbWTMtH/QpSCkPrEt412eYTw6XJta8NEpd6QwCXbSmWorIuBWKZcgVyY2KKC2E8aV4GBUr X-Received: by 2002:a17:906:7119:: with SMTP id x25mr2060221ejj.362.1613665829342; Thu, 18 Feb 2021 08:30:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613665829; cv=none; d=google.com; s=arc-20160816; b=rjatn/+OM5zcE2DsvML3WWA2wBMmC8nZCJcYBbaNWYGLCRIDG/2x99cUbwY2m5MFn5 tJpYElgZHFIYlfUUVvo8smmeurh0ZKQg2ObzxT/0kdon+86SHHdqmq2Uo8YWik1CEcFr xCJNExOXHRHFuHUF1fFt8I1YAWmPzWUEk12tJKhv0TW2AD74FEe3J9TPMdrJXSQAQgZ2 zVeKVMIOWYtJCkccf4vhkvP9z1kAy7E8hgGzXVlRJS4RrQM5r06bd1TyJ7A0xUW4XKYm AEJzRh/+a7yXDMxABDPiv1Ghj2SyZ18TplqDrabinssHxuL0rIr1QWc7y7XR/mVREPsd yWpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DzOPQ8roHGuPLVvPQyFVuYzpTsa3tlwI6Bqj2ScRJiM=; b=cv2LGqhal6gOb0NbZs2Mkkuv8qrT4EuAIhoHTYDsMyLkhU53BtHKt812Tvtaa4HuDd pYbt8OekWC3LvWGVWAP+us+5gR3RVJcEcYNw+Ki4Sy8DQO8PZPCmDuH7CxTGM1gsk8FZ Y6nFwliKNihVtgLyEVBTgeYq40QDy9a65nJJvZhs3qXooCIYAVPez8tnf0RaikVjDx8W 13sqFkLoQiLBK+2kD/RlMJPPyhxM0sMRGkUvDLdm+u/8b+OtnnOwbY1M9gj3GET6pRO5 ocoB2Hqwbco/nPJ1CykNWSNEWepTOSITgoApeEqbAJQPi+a6VziHsBJG0ZCvJbNx7Cdo WJUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f4si3827739edy.176.2021.02.18.08.30.04; Thu, 18 Feb 2021 08:30:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233228AbhBRQ0n (ORCPT + 99 others); Thu, 18 Feb 2021 11:26:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbhBRNlt (ORCPT ); Thu, 18 Feb 2021 08:41:49 -0500 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B943EC061756; Thu, 18 Feb 2021 05:41:08 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1lCjYI-0006xj-Uv; Thu, 18 Feb 2021 14:41:07 +0100 Date: Thu, 18 Feb 2021 14:41:06 +0100 From: Florian Westphal To: Richard Guy Briggs Cc: Florian Westphal , Phil Sutter , LKML , Linux-Audit Mailing List , netfilter-devel@vger.kernel.org, twoerner@redhat.com, Eric Paris , tgraf@infradead.org Subject: Re: [PATCH ghak124 v3] audit: log nftables configuration change events Message-ID: <20210218134106.GC22944@breakpoint.cc> References: <20210211151606.GX3158@orbyte.nwl.cc> <20210211202628.GP2015948@madcap2.tricolour.ca> <20210211220930.GC2766@breakpoint.cc> <20210217234131.GN3141668@madcap2.tricolour.ca> <20210218082207.GJ2766@breakpoint.cc> <20210218124211.GO3141668@madcap2.tricolour.ca> <20210218125248.GB22944@breakpoint.cc> <20210218132843.GP3141668@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210218132843.GP3141668@madcap2.tricolour.ca> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Richard Guy Briggs wrote: > Ok, can I get one more clarification on this "hierarchy"? Is it roughly > in the order they appear in nf_tables_commit() after step 3? It appears > it might be mostly already. If it isn't already, would it be reasonable > to re-order them? Would you suggest a different order? For audit purposes I think enum nf_tables_msg_types is already in the most relevant order, the lower numbers being more imporant. So e.g. NEWTABLE would be more interesting than DELRULE, if both are in same batch. > > > such that it would be desirable to filter them out > > > to reduce noise in that single log line if it is attempted to list all > > > the change ops? It almost sounds like it would be better to do one > > > audit log line for each table for each family, and possibly for each op > > > to avoid the need to change userspace. This would already be a > > > significant improvement picking the highest ranking op. > > > > I think i understand what you'd like to do. Yes, that would reduce > > the log output a lot. > > Would the generation change id be useful outside the kernel? Yes, we already announce it to interested parties via nfnetlink. > What > exactly does it look like? Its just a u64 counter that gets incremented whenever there is a change. > I don't quite understand the genmask purpose. Thats an implementation detail only. When we process a transaction, changes to the ruleset are being made but they should not have any effect until the entire transaction is processed. So there are two 'generations' at any time: 1. The active ruleset 2. The future ruleset 2) is what is being changed/modified. When the transaction completes, then the future ruleset becomes the active ruleset. If the transaction has to be aborted, the pending changes are reverted and the genid/genmasks are not changed.