netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Paul Moore <paul@paul-moore.com>
Cc: Florian Westphal <fw@strlen.de>,
	Richard Weinberger <richard@nod.at>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	pabeni@redhat.com, kuba@kernel.org, edumazet@google.com,
	davem@davemloft.net, kadlec@netfilter.org, pablo@netfilter.org,
	rgb@redhat.com, upstream+net@sigma-star.at
Subject: Re: [PATCH] netfilter: Record uid and gid in xt_AUDIT
Date: Thu, 10 Oct 2024 19:59:25 +0200	[thread overview]
Message-ID: <20241010175925.GA11964@breakpoint.cc> (raw)
In-Reply-To: <CAHC9VhTC=KAXe6w9xTG_rY4zAnNvPv-brQ7cTYftcty866inCw@mail.gmail.com>

Paul Moore <paul@paul-moore.com> wrote:
> Correct me if I'm wrong, but by using from_kXid(&init_user_ns, Xid) we
> get the ID number that is correct for the init namespace, yes?  If so,
> that's what we want as right now all of the audit records, filters,
> etc. are intended to be set from the context of the initial namespace.

Seems to be the case, from_kuid() kdoc says
'There is always a mapping into the initial user_namespace.'.

I'm confused because of the various means of dealing with this:
9847371a84b0 ("netfilter: Allow xt_owner in any user namespace")

Does: make_kgid(net->user_ns, ... and also rejects rule-add if
net->user_ns != current_user_ns().  As this is for matching userids,
this makes sense to me, any userns will 'just work' for normal uid/gid
matching.

a6c6796c7127 ("userns: Convert cls_flow to work with user namespaces enabled")
Does: from_kuid(&init_user_ns, ... and rejects rule adds if sk_user_ns(NETLINK_CB(in_skb).ssk) != &init_user_ns)

Seems just a more conservative solution to the former one.

8c6e2a941ae7 ("userns: Convert xt_LOG to print socket kuids and kgids as uids and gids")
... which looks like the proposed xt_AUDIT change.

As I do not know what the use case is for xt_AUDIT rules residing in
another, possibly unprivileged network namespace not managed by root-root user,
I can't say if its right, but it should do the right thing.

Sorry for the noise.

  reply	other threads:[~2024-10-10 17:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 20:32 [PATCH] netfilter: Record uid and gid in xt_AUDIT Richard Weinberger
2024-10-09 21:33 ` Florian Westphal
2024-10-09 21:46   ` Paul Moore
2024-10-09 22:34     ` Florian Westphal
2024-10-10  2:02       ` Paul Moore
2024-10-10 17:59         ` Florian Westphal [this message]
2024-10-10 19:13           ` Paul Moore
2024-10-10  6:27   ` Richard Weinberger
2024-10-10 13:48     ` Florian Westphal
2024-10-10 13:53       ` Jan Engelhardt
2024-10-10 20:09       ` Richard Weinberger
2024-10-11  1:27         ` Florian Westphal
2024-10-11 13:12           ` Richard Weinberger
2024-10-09 22:02 ` Paul Moore
2024-10-10  6:24   ` Richard Weinberger
2024-10-10 19:09     ` Paul Moore
2024-10-10 20:40       ` Richard Weinberger

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=20241010175925.GA11964@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=paul@paul-moore.com \
    --cc=rgb@redhat.com \
    --cc=richard@nod.at \
    --cc=upstream+net@sigma-star.at \
    /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).