Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2779128ybk; Mon, 18 May 2020 07:45:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoJbsnft20GGo+bJ3MY0Aw6zdkolGJv0OwfUI3l+pNtcdWtuWXZoaN+wpdiomcjA0ajyQp X-Received: by 2002:a05:6402:b2c:: with SMTP id bo12mr2292271edb.274.1589813107876; Mon, 18 May 2020 07:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589813107; cv=none; d=google.com; s=arc-20160816; b=V1RjtAnUOhR9RTZK2a/W+gyMyS7im9ETt9oUKjgO70BgqduAH4EZ0UAdqSKFjp3qsy ZTctQnJWI6bKEl4VLaLQmaKBTyQnZ2GUGPzu+7QPM3jv1ARP9irLMcIywKXJ1ThTs977 /6Kui41hL7SIVik5PT0HaO9lX+TS9DXpXffQ09f3lXPvZDou858ZsZBckeQNHhnRP0xn 0j58i9Jd1hKutuy5118omfjjVAJ/iG1m7W+ePpHbXrKoZUANI7zIJFEGZebUWC8Ma6l+ 79QiCwu2uY6o1M3HD3FIVqJBsD5cPV7q3s+Yilm0bW2xIdZyWPlHqojYNb+U8W+YXhvW bnXw== 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=Y82Wa/YXfbo2pFIdBdGJ5l3oNnVnkoqZdsw/qlj3M4k=; b=09eyQOCEmK6DNPq7s9Da3BSRVG7OeWBuZWf1LhstAVfrUE13QNlaZAVZ9ByJJZdsMq OlQCqcL8DsJzXK9GAmL4NVHAJCFiAeo5Vt05nT43OrTRLqPAk2hogjpy3KjV2gcSt2pK vbZqkiID1LC1uga0ogXPorePVWp57Y/AbATEJjKbdFc3RYTkv9uJg9VYvHClVFuI+HQc gQUzWxoS93nERis5SNbw58JF8uzm49njraEOdGKR9Sx6NxWYEI6mcgg+/3poUuH4v5JV iPuvRTBS2HTIQYLLOjvCe7wPgn63pPhQ0neCSizdMQLlFkt9nTgqCS5czN5G1OAKU6bQ t/Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20150623.gappssmtp.com header.s=20150623 header.b=exGeRrZl; 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 l16si2892842edj.436.2020.05.18.07.44.43; Mon, 18 May 2020 07:45:07 -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=exGeRrZl; 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 S1728088AbgEROlG (ORCPT + 99 others); Mon, 18 May 2020 10:41:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728068AbgEROlF (ORCPT ); Mon, 18 May 2020 10:41:05 -0400 Received: from mail-ed1-x544.google.com (mail-ed1-x544.google.com [IPv6:2a00:1450:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B14EC05BD09 for ; Mon, 18 May 2020 07:41:04 -0700 (PDT) Received: by mail-ed1-x544.google.com with SMTP id l25so3966660edj.4 for ; Mon, 18 May 2020 07:41:04 -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=Y82Wa/YXfbo2pFIdBdGJ5l3oNnVnkoqZdsw/qlj3M4k=; b=exGeRrZlknyuMB4d2TwhyRGvfIcmzYX8ZarWq9HJJK9k4nZaJ7Xrj16vDEFWeu83W8 hkNS8h29h4vDwXb053+x4OFUcU/OReXr+AhuP0f3jXh7/H1TvDy8F8fY3H3OcKJYznxG u+ioUJkrPAiwwcNbQN+UFn7QhShmOJeLUlxUQkJAFPG7QuECxy7HGe5ZZsDpAI7nhAPn xzlNGiLY8GpBjJlJM2RNMuVWumL2ZZT73CRyiHAJrfs0RI1FgU9Ka64T4Fn4lcBb3daz e0ejm8YIzbwErMdGA/G59gXqRH+t8zYrMiM1dpHWjAtpoqxyFVAcLqDqtGauGLVfuRCw KDGA== 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=Y82Wa/YXfbo2pFIdBdGJ5l3oNnVnkoqZdsw/qlj3M4k=; b=CsHW2tVA+T/qWqe4CHMkSp3ZKNspZT97hwwCK4A2SOtQTazPlkEX/P94FcGxFXyyxW ffwwW8vxRmd5y61xzX3dc2jIatGU4H4JRqhrE7A6Z4aFh3jRC7OZS6dLcWtJirPJ9l3w qXffORMIgz1nWl41dtN8DDzuta7QWSFE/w9aj+U2At19JkRQXZaEaju/6PlihPfgft3D sU08paYQhnVce9cIl+SkSsFzgN0UCjkC0TvYhxeAyTC6KxvpbyvQQ65UTWBMA+zmGdMu nSqX4YANetGHl8q6xAPsKO0N1bnZeRzOymwXhhiG0cpCL+35XU0qK0lxHpM44uTYWpcf +1tQ== X-Gm-Message-State: AOAM531ZhJ8WBy0RhwxdOScQ2C8a195jyPX1Uu5o/YZrh/3w2uheHLo8 9eR070ZOgrCOiYmtAZCPZ7iJWryz+Dxza3PB+Quf X-Received: by 2002:aa7:c887:: with SMTP id p7mr13686147eds.269.1589812862499; Mon, 18 May 2020 07:41:02 -0700 (PDT) MIME-Version: 1.0 References: <20200517141515.qqx3jx5ulb2546tx@madcap2.tricolour.ca> <20200518003920.e6vyzhvadyi5wdjd@madcap2.tricolour.ca> In-Reply-To: <20200518003920.e6vyzhvadyi5wdjd@madcap2.tricolour.ca> From: Paul Moore Date: Mon, 18 May 2020 10:40:51 -0400 Message-ID: Subject: Re: [PATCH ghak25 v4 3/3] audit: add subj creds to NETFILTER_CFG record to cover async unregister To: Richard Guy Briggs Cc: fw@strlen.de, LKML , Linux-Audit Mailing List , netfilter-devel@vger.kernel.org, ebiederm@xmission.com, twoerner@redhat.com, Eric Paris , 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 Sun, May 17, 2020 at 8:40 PM Richard Guy Briggs wrote: > On 2020-05-17 17:50, Paul Moore wrote: > > On Sun, May 17, 2020 at 10:15 AM Richard Guy Briggs wrote: > > > On 2020-04-28 18:25, Paul Moore wrote: > > > > On Wed, Apr 22, 2020 at 5:40 PM Richard Guy Briggs wrote: > > > > > Some table unregister actions seem to be initiated by the kernel to > > > > > garbage collect unused tables that are not initiated by any userspace > > > > > actions. It was found to be necessary to add the subject credentials to > > > > > cover this case to reveal the source of these actions. A sample record: > > > > > > > > > > type=NETFILTER_CFG msg=audit(2020-03-11 21:25:21.491:269) : table=nat family=bridge entries=0 op=unregister pid=153 uid=root auid=unset tty=(none) ses=unset subj=system_u:system_r:kernel_t:s0 comm=kworker/u4:2 exe=(null) > > > > > > > > [I'm going to comment up here instead of in the code because it is a > > > > bit easier for everyone to see what the actual impact might be on the > > > > records.] > > > > > > > > Steve wants subject info in this case, okay, but let's try to trim out > > > > some of the fields which simply don't make sense in this record; I'm > > > > thinking of fields that are unset/empty in the kernel case and are > > > > duplicates of other records in the userspace/syscall case. I think > > > > that means we can drop "tty", "ses", "comm", and "exe" ... yes? > > > > > > > > While "auid" is a potential target for removal based on the > > > > dup-or-unset criteria, I think it falls under Steve's request for > > > > subject info here, even if it is garbage in this case. > > > > > > Can you explain why auid falls under this criteria but ses does not if > > > both are unset? > > > > "While "auid" is a potential target for removal based on the > > dup-or-unset criteria, I think it falls under Steve's request for > > subject info here, even if it is garbage in this case." > > > > It's a concession to Steve. As I mentioned previously, I think the > > subject info is bogus in this case; either it is valid and we get it > > from the SYSCALL record or it simply isn't present in any meaningful > > way. > > Sorry for being so dense. I still don't follow your explanation. You've > repeated the same paragraph that didn't make sense to me the first time. > > What definition of "subject info" are you working with? The subject is generally the task which is causing the event to occur, "subject info" would be any such attribute which describes the subject; examples include LSM label, the various UIDs/GIDs, etc.. Think "current->cred" and you on the right track. > I had assumed > it was the set of fields that contain information that came from that > task's struct task_struct. Some of those fields contain information > that isn't helpful. Why not remove them all rather than keep one that > still contains no useful information? Once again - and I don't know how else to explain this to you - I think it is pointless to record the subject info in this record as we either have that info from other records in the event or there is no valid subject info to record. As you state in the commit description: "Some table unregister actions seem to be initiated by the kernel to garbage collect unused tables that are not initiated by any userspace actions." > Or is it a matter of keeping one > key field that contains no useful information that proves that the rest > is bogus? Steve said that daemons leave no useful information in auid > as well, so I don't see how keeping this field helps us. My > understanding is that the subj field's "...:kernel_t:..." is the key > here and that pid and comm give us a bit more of a clue that it is a > kernel thread. Is that correct? What use does including auid serve > here? As I've mentioned in the thread above, including the auid was done as a concession to Steve, I don't think it serves any useful purpose. -- paul moore www.paul-moore.com