From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0129C433C1 for ; Mon, 29 Mar 2021 00:53:08 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22574601FC for ; Mon, 29 Mar 2021 00:53:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22574601FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=paul-moore.com Authentication-Results: mail.kernel.org; spf=tempfail smtp.mailfrom=linux-audit-bounces@redhat.com Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-553-EuY51HK1NMugwTL-L8jqxw-1; Sun, 28 Mar 2021 20:53:05 -0400 X-MC-Unique: EuY51HK1NMugwTL-L8jqxw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC60F51D9; Mon, 29 Mar 2021 00:53:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C327460657; Mon, 29 Mar 2021 00:53:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 83DC61800215; Mon, 29 Mar 2021 00:52:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12T0p46Q021437 for ; Sun, 28 Mar 2021 20:51:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3A831112C19; Mon, 29 Mar 2021 00:51:04 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF3B11112C18 for ; Mon, 29 Mar 2021 00:51:02 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E382C811E7F for ; Mon, 29 Mar 2021 00:51:01 +0000 (UTC) Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-CGqT5CSYO3ir9ExzilnSyg-1; Sun, 28 Mar 2021 20:50:57 -0400 X-MC-Unique: CGqT5CSYO3ir9ExzilnSyg-1 Received: by mail-ej1-f41.google.com with SMTP id u5so16833215ejn.8 for ; Sun, 28 Mar 2021 17:50:57 -0700 (PDT) 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=qOGj01vI3Uc7S2heTR+DBI45GarfMAPhjx8bFs/zKTkb83TwJkPgAixn1gQcriGtv9 r5M3V+w6vPWKHzK7M/ATS+blQytzo4++dSPDmvxPNASBSOTuPl2KXkTPp/G8/ueAzagC xM7NfNQJ58GkOsiYdIu8p22544pjVRNERuIj0zfXSkC3VDHNpcB/AmxO6OVx/3H2CtHA IYGIPfHRKzEtkJBFJqV8NAputporQq7iMgFAtDOFLGJdGhyGoCA1O0U1Wj6oI4GDzHQr Y2ZIv/7Z+2Z+CiyCHnliik8lRyOnBTcT7ZVyl6Tx3lIVK9/Ea2JpmJIJacuj4p19/Q2/ rBew== X-Gm-Message-State: AOAM532gaszkqnPke9aLprIWFqSZZApQGrGig49ZHS3CiSXvWLhu0HYW cwki6SWCQ1ibDmppvDYZCRIKI1QSVyKDgfgKGEJW X-Google-Smtp-Source: ABdhPJymzHFuTcp5RmAop4j8vr4nvsReBMBhbfDdtl2mYkWAszWg3rggapnjcBBz8387TSOrzu38UIz933tpKAZEQSs= 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 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: linux-audit@redhat.com Cc: Jones Desougi , Phil Sutter , Florian Westphal , LKML , Linux-Audit Mailing List , netfilter-devel@vger.kernel.org, twoerner@redhat.com, Eric Paris , tgraf@infradead.org, dan.carpenter@oracle.com X-BeenThere: linux-audit@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Linux Audit Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=linux-audit-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 -- Linux-audit mailing list Linux-audit@redhat.com https://listman.redhat.com/mailman/listinfo/linux-audit