From: Thomas Haller <thaller@redhat.com>
To: Phil Sutter <phil@nwl.cc>
Cc: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [nft PATCH v4 2/6] src: add input flag NFT_CTX_INPUT_NO_DNS to avoid blocking
Date: Wed, 09 Aug 2023 21:17:36 +0200 [thread overview]
Message-ID: <b1829e8f312b2e626dc4efefdc1d666044405552.camel@redhat.com> (raw)
In-Reply-To: <ZNNoUHB/i7rxPXS1@orbyte.nwl.cc>
Hi,
On Wed, 2023-08-09 at 12:20 +0200, Phil Sutter wrote:
> On Tue, Aug 08, 2023 at 10:05:19PM +0200, Thomas Haller wrote:
> > On Tue, 2023-08-08 at 15:24 +0200, Phil Sutter wrote:
> > > On Thu, Aug 03, 2023 at 09:35:16PM +0200, Thomas Haller wrote:
> > > > getaddrinfo() blocks while trying to resolve the name. Blocking
> > > > the
> > > > caller of the library is in many cases undesirable. Also, while
> > > > reconfiguring the firewall, it's not clear that resolving names
> > > > via
> > > > the network will work or makes sense.
> > > >
> > > > Add a new input flag NFT_CTX_INPUT_NO_DNS to opt-out from
> > > > getaddrinfo()
> > > > and only accept plain IP addresses.
> > >
> > > This sounds like user input validation via backend. Another way
> > > to
> > > solve
> > > the problem at hand is to not insert host names into the
> > > rules(et)
> > > fed
> > > into libnftables, right?
> >
> > Right. More generally, ensure not to pass any non-addresses in JSON
> > that would be resolved.
>
> Well, detecting if a string constitutes a valid IP address is rather
> trivial. In Python, there's even 'ipaddress' module for that job.
firewalld messed it up, showing that it can happen.
>
> > Which requires that the user application is keenly aware,
> > understands
> > and validates the input data. For example, there couldn't be a
> > "expert
> > option" where the admin configures arbitrary JSON.
>
> Why is host resolution a problem in such scenario? The fact that
> using
> host names instead of IP addresses may result in significant delays
> due
> to the required DNS queries is pretty common knowledge among system
> administrators.
It seems prudent that libnftables provides a mode of operation so that
it doesn't block the calling application. Otherwise, it is a problem
for applications that care about that.
>
> > And that the application doesn't make a mistake with that ([1]).
> >
> > [1]
> > https://github.com/firewalld/firewalld/commit/4db89e316f2d60f3cf856a7025a96a61e40b1e5a
>
> This is just a bug in firewall-cmd, missing to convert ranges into
> JSON
> format. I don't see the benefit for users which no longer may use
> host
> names in that spot.
Which spot do you mean? /sbin/nft is not affected, unless it opts-in to
the new flag. firewalld never supported hostnames at that spot anyway
(or does it?).
Thomas
next prev parent reply other threads:[~2023-08-09 19:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 19:35 [nft PATCH v4 0/6] add input flags and "no-dns"/"json" flags Thomas Haller
2023-08-03 19:35 ` [nft PATCH v4 1/6] src: add input flags for nft_ctx Thomas Haller
2023-08-16 15:49 ` Phil Sutter
2023-08-03 19:35 ` [nft PATCH v4 2/6] src: add input flag NFT_CTX_INPUT_NO_DNS to avoid blocking Thomas Haller
2023-08-08 13:24 ` Phil Sutter
2023-08-08 20:05 ` Thomas Haller
2023-08-09 10:20 ` Phil Sutter
2023-08-09 19:17 ` Thomas Haller [this message]
2023-08-10 7:45 ` Phil Sutter
2023-08-10 8:43 ` Thomas Haller
2023-08-16 16:01 ` Phil Sutter
2023-08-18 9:45 ` Thomas Haller
2023-08-16 16:02 ` Phil Sutter
2023-08-03 19:35 ` [nft PATCH v4 3/6] src: add input flag NFT_CTX_INPUT_JSON to enable JSON parsing Thomas Haller
2023-08-16 16:02 ` Phil Sutter
2023-08-03 19:35 ` [nft PATCH v4 4/6] py: fix exception during cleanup of half-initialized Nftables Thomas Haller
2023-08-16 16:03 ` Phil Sutter
2023-08-03 19:35 ` [nft PATCH v4 5/6] py: extract flags helper functions for set_debug()/get_debug() Thomas Haller
2023-08-16 16:04 ` Phil Sutter
2023-08-03 19:35 ` [nft PATCH v4 6/6] py: add Nftables.{get,set}_input() API Thomas Haller
2023-08-08 14:04 ` Phil Sutter
2023-08-08 20:07 ` Thomas Haller
2023-08-16 16:10 ` Phil Sutter
2023-08-18 9:45 ` Thomas Haller
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=b1829e8f312b2e626dc4efefdc1d666044405552.camel@redhat.com \
--to=thaller@redhat.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
/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).