Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3236813pxf; Sun, 28 Mar 2021 17:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVMmqBOwHx/k/zb26XKgSim/dyhRKgZab3maBzs3SaGng7wRR0KR39aZ1WGWt00qPeJiac X-Received: by 2002:a17:907:2054:: with SMTP id pg20mr26386412ejb.213.1616979157953; Sun, 28 Mar 2021 17:52:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616979157; cv=none; d=google.com; s=arc-20160816; b=YDugJpppksEvU9qHOjXMDWinwZcss3SzVh3Brzucx/XOeav8dd1o8BW5d4fSG24ior gU6Skz2sME1n6k0Rj8pK9TglUOSkTRdZQSw114Gn6aHVrBko2ECN8xPeWaCs/qOvQA1U DgeOckPutfikOLluFiD8lEdkAZWnbl5J2rpxaI3zPpBO8LeT7HQOeY/WolQKaQwA3FQL MXPbB5RvTILRC8eAcfuq7U6K1QFbUuL+vdKS5qBvCtuCpfHJv1+rs+liJ5uPmmSE0VXZ 9owNjKZNWCNeoe813pdqq+1s4AhSJqZpyVtFL0wPspFRCApmLAlairaNAZY3GQoGd9Ur TYfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=30hFefP4ZO3Nkr29x6IoXC7oVy/hkWSV5Sy2cpozq2o=; b=Zj2fFc/Cm4CIqKRPrhyPwB/QnpIAeybtXkfBShDI9IgnEOyo8KFsT8P32n85xO14Cx 4vXMTlxZTD75pTWPYD/0Qamb/s3zsIpDZrYZcGOBLnuBIMlknuGibgvT3gmWMpob3Wex 3+dYMaoUPnZdSPZNN0rG5VzxtUytLFU3fOI2CvLxorFt7QvmUIhzR/j9ZDscNcl6ebQl MSknqgH53VpE4sDC8fIf/62kjApdgki9DwbthpkjjMAqvMaZKZJTI9KyVasXJ8s9RzLh 6ZG+Iqr2KcwNiR0mjDgOz60l25oZ5DFrP5lTq69ggY5ZgZ4R4Iq5x8bNvC++o4oaGJhJ ab+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=IN9c0bwK; 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 gv18si11837495ejc.674.2021.03.28.17.52.16; Sun, 28 Mar 2021 17:52:37 -0700 (PDT) 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; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=IN9c0bwK; 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 S229873AbhC2AvR (ORCPT + 99 others); Sun, 28 Mar 2021 20:51:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbhC2Au6 (ORCPT ); Sun, 28 Mar 2021 20:50:58 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE6FFC061756 for ; Sun, 28 Mar 2021 17:50:57 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id ce10so16833026ejb.6 for ; Sun, 28 Mar 2021 17:50:57 -0700 (PDT) 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=30hFefP4ZO3Nkr29x6IoXC7oVy/hkWSV5Sy2cpozq2o=; b=IN9c0bwKYu7WHm08RU2hXvRkJ/DfU1jsPofy54Fcf5MqkKU4M4/zuXrJ74WhTw/oc3 Qn5gL2Pqce1lQX9GzI2fkvvBsraDayLX1V5Uq6rlYkWPvqtXpTHrEGNVvOhyFjVeG7uK s+gaEa+LrZFYqvHQhzYnfqYCrTnphcqt2pVup20vGGEGbZGkkCQIX57OmG3ALy9P940c PZbB4lIINkmfSj0ffEv/BLIhTgYN+Mj7oVZsfVb/CBGwdAUfsJt6D+HqlpR/UD/S/KqL Lc4Lf/0yjyZIBWuUC2YKbfp74Bmy4TWB7qiSMbhl976eoNSQCgRZSGKbGEKCw+jxPngo Ab/A== 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=30hFefP4ZO3Nkr29x6IoXC7oVy/hkWSV5Sy2cpozq2o=; b=hgBx7djslVW3ZAPxKFjH+kf7cXSaPNiXh/wLLwwoAdU65v4Dv1ffH9IcRmFn+uFFQh ybU6lzc9s14GimngqJrfHj9y+4G1hVu59AJhoa/rI1J3SPHmgMQKB6M6RSxVGV4sZ2og YllZ5Bo09TJSGTAiQCW5ja/ILTlxslX/eoMoPBcRSbyAtYzWkINR2d7ArY7e/jpYp0gy yvzQyNMfawY4i+rf8BSDyVaRr1zEGxdXRZ3R51z/lgjyjYrKJVgDo4jpURx7/wNNpUEe viMyeaFcVZ7IUEphnjdP6haLhakCpVO1pQMXV1c7EqXn4mu3zsFAna5uBn77H2JHhaYX UwNw== X-Gm-Message-State: AOAM533g9kvQJzUrVB77sVIaN/FDzG5Jybkf2q9tIa8m9Wyh0HH4RxSH ntiAZxKxKr+mIZW5P2mwmPCIyCooOyaNgSHacUCj X-Received: by 2002:a17:906:b846:: with SMTP id ga6mr25901053ejb.542.1616979056270; Sun, 28 Mar 2021 17:50:56 -0700 (PDT) MIME-Version: 1.0 References: <28de34275f58b45fd4626a92ccae96b6d2b4e287.1616702731.git.rgb@redhat.com> In-Reply-To: <28de34275f58b45fd4626a92ccae96b6d2b4e287.1616702731.git.rgb@redhat.com> From: Paul Moore Date: Sun, 28 Mar 2021 20:50:45 -0400 Message-ID: Subject: Re: [PATCH v5] audit: log nftables configuration change events once per table To: Richard Guy Briggs Cc: Linux-Audit Mailing List , LKML , netfilter-devel@vger.kernel.org, Eric Paris , Steve Grubb , Florian Westphal , Phil Sutter , twoerner@redhat.com, tgraf@infradead.org, dan.carpenter@oracle.com, Jones Desougi Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 1:39 PM Richard Guy Briggs wrote: > > Reduce logging of nftables events to a level similar to iptables. > Restore the table field to list the table, adding the generation. > > Indicate the op as the most significant operation in the event. > > A couple of sample events: > > type=PROCTITLE msg=audit(2021-03-18 09:30:49.801:143) : proctitle=/usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid > type=SYSCALL msg=audit(2021-03-18 09:30:49.801:143) : arch=x86_64 syscall=sendmsg success=yes exit=172 a0=0x6 a1=0x7ffdcfcbe650 a2=0x0 a3=0x7ffdcfcbd52c items=0 ppid=1 pid=367 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=roo > t sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/bin/python3.9 subj=system_u:system_r:firewalld_t:s0 key=(null) > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=ipv6 entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=ipv4 entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.801:143) : table=firewalld:2 family=inet entries=1 op=nft_register_table pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > > type=PROCTITLE msg=audit(2021-03-18 09:30:49.839:144) : proctitle=/usr/bin/python3 -s /usr/sbin/firewalld --nofork --nopid > type=SYSCALL msg=audit(2021-03-18 09:30:49.839:144) : arch=x86_64 syscall=sendmsg success=yes exit=22792 a0=0x6 a1=0x7ffdcfcbe650 a2=0x0 a3=0x7ffdcfcbd52c items=0 ppid=1 pid=367 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=r > oot sgid=root fsgid=root tty=(none) ses=unset comm=firewalld exe=/usr/bin/python3.9 subj=system_u:system_r:firewalld_t:s0 key=(null) > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=ipv6 entries=30 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=ipv4 entries=30 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > type=NETFILTER_CFG msg=audit(2021-03-18 09:30:49.839:144) : table=firewalld:3 family=inet entries=165 op=nft_register_chain pid=367 subj=system_u:system_r:firewalld_t:s0 comm=firewalld > > The issue was originally documented in > https://github.com/linux-audit/audit-kernel/issues/124 > > Signed-off-by: Richard Guy Briggs > --- > Changelog: > v5: > (sorry for all the noise...) > - fix kbuild missing prototype warning in nf_tables_commit_audit_{alloc,collect,log}() > > v4: > - move nf_tables_commit_audit_log() before nf_tables_commit_release() [fw] > - move nft2audit_op[] from audit.h to nf_tables_api.c > > v3: > - fix function braces, reduce parameter scope [pna] > - pre-allocate nft_audit_data per table in step 1, bail on ENOMEM [pna] > > v2: > - convert NFT ops to array indicies in nft2audit_op[] [ps] > - use linux lists [pna] > - use functions for each of collection and logging of audit data [pna] > --- > net/netfilter/nf_tables_api.c | 187 +++++++++++++++++++--------------- > 1 file changed, 104 insertions(+), 83 deletions(-) Netfilter folks, were you planning to pull this via your tree/netdev or would you like me to merge this via the audit tree? If the latter, I would appreciate it if I could get an ACK from one of you; if the former, my ACK is below. Acked-by: Paul Moore -- paul moore www.paul-moore.com