netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: Florian Westphal <fw@strlen.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-Audit Mailing List <linux-audit@redhat.com>,
	netfilter-devel@vger.kernel.org, ebiederm@xmission.com,
	twoerner@redhat.com, eparis@parisplace.org, tgraf@infradead.org
Subject: Re: [PATCH ghak25 v2 8/9] netfilter: add audit operation field
Date: Thu, 13 Feb 2020 07:14:10 -0500	[thread overview]
Message-ID: <20200213121410.b2dsh2kwg3k7xg7e@madcap2.tricolour.ca> (raw)
In-Reply-To: <20200106202306.GO795@breakpoint.cc>

On 2020-01-06 21:23, Florian Westphal wrote:
> Richard Guy Briggs <rgb@redhat.com> wrote:
> > diff --git a/include/linux/audit.h b/include/linux/audit.h
> > index 96cabb095eed..5eab4d898c26 100644
> > --- a/include/linux/audit.h
> > +++ b/include/linux/audit.h
> > @@ -379,7 +379,7 @@ extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
> >  extern void __audit_fanotify(unsigned int response);
> >  extern void __audit_tk_injoffset(struct timespec64 offset);
> >  extern void __audit_ntp_log(const struct audit_ntp_data *ad);
> > -extern void __audit_nf_cfg(const char *name, u8 af, int nentries);
> > +extern void __audit_nf_cfg(const char *name, u8 af, int nentries, int op);
> 
> Consider adding an enum instead of int op.
> 
> >  	if (audit_enabled)
> > -		audit_nf_cfg(repl->name, AF_BRIDGE, repl->nentries);
> > +		audit_nf_cfg(repl->name, AF_BRIDGE, repl->nentries, 1);
> 
> audit_nf_cfg(repl->name, AF_BRIDGE, repl->nentries, AUDIT_XT_OP_REPLACE);
> 
> ... would be a bit more readable than '1'.
> 
> The name is just an example, you can pick something else.

Thanks Florian.

Another question occurs to me about table default policy.

I'd observed previously that if nentries was zero due to an empty table,
then it was due to table registration calls, which resulted from module
loading.  The default policy is NF_ACCEPT (because Rusty didn't want
more email, go figure...).  It occurred to me later that some table
loads took a command line parameter to be able to change the default
policy verdict from NF_ACCEPT to NF_DROP.  In particular, filter FORWARD
hook tables.  Is there a straightforward way to be able to detect this
in all the audit_nf_cfg() callers to be able to log it?  In particular,
in:
	net/bridge/netfilter/ebtables.c: ebt_register_table()
	net/bridge/netfilter/ebtables.c: do_replace_finish()
	net/bridge/netfilter/ebtables.c: __ebt_unregister_table()
	net/netfilter/x_tables.c: xt_replace_table()
	net/netfilter/x_tables.c: xt_unregister_table()

It appears to be stored in the second entry of struct ipt_replace and
struct ip6t_replace, of types struct ipt_standard and struct
ip6t_standard in target.verdict, which doesn't appear to be obvious or
easily accessible from xt_replace_table().  In ebtables, it appears to
be in the policy member of struct ebt_entries.

Both potential solutions are awkward, adding a parameter to pass that
value in, but also trying to reach into the protocol-specific entry
table to find that value.  Would you have a recommendation?  This
assumes that reporting that default policy value is even desired or
required.

- 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


  parent reply	other threads:[~2020-02-13 12:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 18:54 [PATCH ghak25 v2 0/9] Address NETFILTER_CFG issues Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 1/9] netfilter: normalize x_table function declarations Richard Guy Briggs
2020-01-06 20:23   ` Florian Westphal
2020-01-08 16:47   ` Nicolas Dichtel
2020-01-16 21:29     ` Richard Guy Briggs
2020-01-31  3:17   ` Paul Moore
2020-02-10 19:13     ` Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 2/9] netfilter: normalize ebtables " Richard Guy Briggs
2020-01-06 20:30   ` Florian Westphal
2020-01-31  3:17   ` Paul Moore
2020-01-06 18:54 ` [PATCH ghak25 v2 3/9] netfilter: normalize ebtables function declarations II Richard Guy Briggs
2020-01-06 20:31   ` Florian Westphal
2020-01-31  3:17   ` Paul Moore
2020-01-06 18:54 ` [PATCH ghak25 v2 4/9] audit: record nfcfg params Richard Guy Briggs
2020-01-31  3:18   ` Paul Moore
2020-02-18 22:47     ` Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 5/9] netfilter: x_tables audit only on syscall rule Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 6/9] netfilter: ebtables " Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 7/9] netfilter: ebtables audit table registration Richard Guy Briggs
2020-01-31  3:18   ` Paul Moore
2020-02-18 22:35     ` Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 8/9] netfilter: add audit operation field Richard Guy Briggs
2020-01-06 20:23   ` Florian Westphal
2020-01-31  3:18     ` Paul Moore
2020-02-13 12:14     ` Richard Guy Briggs [this message]
2020-02-13 12:34       ` Florian Westphal
2020-02-13 14:29         ` Richard Guy Briggs
2020-01-06 18:54 ` [PATCH ghak25 v2 9/9] netfilter: audit table unregister actions Richard Guy Briggs
2020-01-31  3:18   ` Paul Moore
2020-01-16 15:05 ` [PATCH ghak25 v2 0/9] Address NETFILTER_CFG issues Pablo Neira Ayuso
2020-01-16 19:07   ` Paul Moore
2020-01-16 21:20     ` Richard Guy Briggs

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=20200213121410.b2dsh2kwg3k7xg7e@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=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).