Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2501550pxb; Thu, 11 Feb 2021 14:11:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyNWsw+kjJD0iSZ+dJngpfYRe7gZTievxCkU7sATXZviW2T7QqcDPEJU14lOQakH3QW4Q/j X-Received: by 2002:a17:906:1447:: with SMTP id q7mr10930765ejc.27.1613081494471; Thu, 11 Feb 2021 14:11:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613081494; cv=none; d=google.com; s=arc-20160816; b=YrVPtGZv9ZmMujXM5io7Xkfrgb/9poLBg8VQfZwhiMn/pfkyGTLMQl/8I730ITMOT0 LFUylZeexuUixOlCAfrAKD1e5QNhfn8SD///PtcyUbc5wx8Ob34gUdllx5artT2GMg0q 0ZguLWtPvkJpnQR6+ggFtCf/+oVpVMw5xA+fHhOfERsUCUR4cfQ89ldl6YmN0RXdeo1+ FfoJib2cUrfpFne10CxA9wRA5YFX1HlsbXKFaQNxFybfC6kWtT0HjOWc289mMJHhbiYu aGvDRLQSx+PHyo09eKlaC7vza33a+eAlufb+kKRiyV8Ae66ek1U2vTpnoDfIlszO++RG cyYg== 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=jGIWI9q8CzgzN9be5cy5RQBHVSKXo8gGHLuGxtUpaUc=; b=1DaB9qBeOr6YabRta66U7R2dXmE8N7W/fhut4bWz3YqD4a6hF0c0wJaJau6jqeOONN V1VudattNp1DT6TqzUAtlWqnBS4k+TTiptybf/bNB5rL9iUI5HwYSOLgOy2k5fVc3Rzf wCNnSkgRBsEk1NGlowv3g/oID+q7vHC9XFPDTl0ZtckiphJmZm1QOkHanM0w5+BGzuQl fjhpz6DfCN6DJDrg94yrZWJVtAs48rd3LsTz8jd0heI2hVw8jUkIt3mAGVP+TNouF2f0 26vcL+/HfzqGN7tO+wfYF1BYws8kaCX6aVyxmkMjkwAScqH9Y5naSo9QesH5feZjZ6Gg 2bvw== 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 r13si4547833eji.406.2021.02.11.14.11.10; Thu, 11 Feb 2021 14:11:34 -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 S229564AbhBKWKP (ORCPT + 99 others); Thu, 11 Feb 2021 17:10:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbhBKWKO (ORCPT ); Thu, 11 Feb 2021 17:10:14 -0500 Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [IPv6:2a0a:51c0:0:12e:520::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC17BC061574; Thu, 11 Feb 2021 14:09:34 -0800 (PST) Received: from fw by Chamillionaire.breakpoint.cc with local (Exim 4.92) (envelope-from ) id 1lAK9S-0005k6-N8; Thu, 11 Feb 2021 23:09:30 +0100 Date: Thu, 11 Feb 2021 23:09:30 +0100 From: Florian Westphal To: Richard Guy Briggs Cc: Paul Moore , Phil Sutter , Linux-Audit Mailing List , LKML , netfilter-devel@vger.kernel.org, sgrubb@redhat.com, Ondrej Mosnacek , fw@strlen.de, twoerner@redhat.com, Eric Paris , tgraf@infradead.org Subject: Re: [PATCH ghak124 v3] audit: log nftables configuration change events Message-ID: <20210211220930.GC2766@breakpoint.cc> References: <20210211151606.GX3158@orbyte.nwl.cc> <20210211202628.GP2015948@madcap2.tricolour.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210211202628.GP2015948@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: > > > I personally would notify once per transaction. This is easy and quick. > > This was the goal. iptables was atomic. nftables appears to no longer > be so. If I have this wrong, please show how that works. nftables transactions are atomic, either the entire batch takes effect or not at all. The audit_log_nfcfg() calls got added to the the nft monitor infra which is designed to allow userspace to follow the entire content of the transaction log. So, if its just a 'something was changed' event that is needed all of them can be removed. ATM the audit_log_nfcfg() looks like this: /* step 3. Start new generation, rules_gen_X now in use. */ net->nft.gencursor = nft_gencursor_next(net); list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { switch (trans->msg_type) { case NFT_MSG_NEWTABLE: audit_log_nfcfg(); ... case NFT_MSG_... audit_log_nfcfg(); .. } which gives an audit_log for every single change in the batch. So, if just a summary is needed a single audit_log_nfcfg() after 'step 3' and outside of the list_for_each_entry_safe() is all that is needed. If a summary is wanted as well one could fe. count the number of transaction types in the batch, e.g. table adds, chain adds, rule adds etc. and then log a summary count instead.