netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: Steve Grubb <sgrubb@redhat.com>
Cc: Paul Moore <paul@paul-moore.com>,
	Linux-Audit Mailing List <linux-audit@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	netfilter-devel@vger.kernel.org, omosnace@redhat.com,
	fw@strlen.de, twoerner@redhat.com,
	Eric Paris <eparis@parisplace.org>,
	ebiederm@xmission.com, tgraf@infradead.org
Subject: Re: [PATCH ghak25 v4 3/3] audit: add subj creds to NETFILTER_CFG record to cover async unregister
Date: Wed, 6 May 2020 18:42:33 -0400	[thread overview]
Message-ID: <20200506224233.najv6ltb5gzcicqb@madcap2.tricolour.ca> (raw)
In-Reply-To: <3250272.v6NOfJhyum@x2>

On 2020-05-06 17:26, Steve Grubb wrote:
> On Wednesday, April 29, 2020 5:32:47 PM EDT Richard Guy Briggs wrote:
> > On 2020-04-29 14:47, Steve Grubb wrote:
> > > On Wednesday, April 29, 2020 10:31:46 AM EDT 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 <rgb@redhat.com>
> > > 
> > > 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?
> > > > 
> > > > From the ghak28 discussion, this list and order was selected due to
> > > > Steve's preference for the "kernel" record convention, so deviating
> > > > from this will create yet a new field list.  I'll defer to Steve on
> > > > this. It also has to do with the searchability of fields if they are
> > > > missing.
> > > > 
> > > > I do agree that some fields will be superfluous in the kernel case.
> > > > The most important field would be "subj", but then "pid" and "comm", I
> > > > would think.  Based on this contents of the "subj" field, I'd think
> > > > that "uid", "auid", "tty", "ses" and "exe" are not needed.
> > > 
> > > We can't be adding deleting fields based on how its triggered. If they
> > > are unset, that is fine. The main issue is they have to behave the same.
> > 
> > I don't think the intent was to have fields swing in and out depending
> > on trigger.  The idea is to potentially permanently not include them in
> > this record type only.  The justification is that where they aren't
> > needed for the kernel trigger situation it made sense to delete them
> > because if it is a user context event it will be accompanied by a
> > syscall record that already has that information and there would be no
> > sense in duplicating it.
> 
> We should not be adding syscall records to anything that does not result from 
> a syscall rule triggering the event. Its very wasteful. More wasteful than 
> just adding the necessary fields.

So what you are saying is you want all the fields that are being
proposed to be added to this record?

If the records are all from one event, they all should all have the same
timestamp/serial number so that the records are kept together and not
mistaken for multiple events.  One reason for having information in
seperate records is to be able to filter them either in kernel or in
userspace if you don't need certain records.

> I also wished we had a coding specification that put this in writing so that 
> every event is not a committee decision. That anyone can look at the document 
> and Do The Right Thing ™.
> 
> If I add a section to Writing-Good-Events outlining the expected ordering of 
> fields, would that be enough that we do not have long discussions about event 
> format? I'm thinking this would also help new people that want to contribute.

If you add this expected ordering of fields, can we re-factor all the
kernel code to use this order because the userspace parser won't care
what order they are in?

I realize this isn't what you are saying, but having a clear description
in that document that talks about the different classes of events and
what each one needs in terms of minimum to full subject attributes and
object attributes would help a lot.  It would also help for new records
to be able to decide if it should follow the format of an existing
related or similar record, or a new class with the expected standard order.

> -Steve

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635


  reply	other threads:[~2020-05-06 22:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-22 21:39 [PATCH ghak25 v4 0/3] Address NETFILTER_CFG issues Richard Guy Briggs
2020-04-22 21:39 ` [PATCH ghak25 v4 1/3] audit: tidy and extend netfilter_cfg x_tables and ebtables logging Richard Guy Briggs
2020-04-28 22:15   ` Paul Moore
2020-04-22 21:39 ` [PATCH ghak25 v4 2/3] netfilter: add audit table unregister actions Richard Guy Briggs
2020-04-28 22:15   ` Paul Moore
2020-04-22 21:39 ` [PATCH ghak25 v4 3/3] audit: add subj creds to NETFILTER_CFG record to cover async unregister Richard Guy Briggs
2020-04-28 22:25   ` Paul Moore
2020-04-29 14:31     ` Richard Guy Briggs
2020-04-29 18:47       ` Steve Grubb
2020-04-29 21:32         ` Richard Guy Briggs
2020-05-01 16:23           ` Paul Moore
2020-05-06 21:26           ` Steve Grubb
2020-05-06 22:42             ` Richard Guy Briggs [this message]
2020-05-08  2:45               ` Paul Moore
2020-05-08 18:23               ` Steve Grubb
2020-05-17 14:15     ` Richard Guy Briggs
2020-05-17 21:50       ` Paul Moore
2020-05-18  0:39         ` Richard Guy Briggs
2020-05-18 14:40           ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506224233.najv6ltb5gzcicqb@madcap2.tricolour.ca \
    --to=rgb@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=eparis@parisplace.org \
    --cc=fw@strlen.de \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=omosnace@redhat.com \
    --cc=paul@paul-moore.com \
    --cc=sgrubb@redhat.com \
    --cc=tgraf@infradead.org \
    --cc=twoerner@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).