From: Bruce Richardson <bruce.richardson@intel.com>
To: Robin Jarry <rjarry@redhat.com>
Cc: <dev@dpdk.org>, <stable@dpdk.org>
Subject: Re: [PATCH dpdk] telemetry-exporter: listen on loopback by default
Date: Mon, 27 Jan 2025 14:39:52 +0000 [thread overview]
Message-ID: <Z5eauLXHdzkNi64w@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250127115143.585207-2-rjarry@redhat.com>
On Mon, Jan 27, 2025 at 12:51:44PM +0100, Robin Jarry wrote:
> Fix the following warning reported by Coverity:
>
> Defect type: SIGMA.insecure_network_bind:
> > dpdk-stable-24.11.1/usertools/dpdk-telemetry-exporter.py:278:
> > Sigma main event: The HTTP server binds to all network interfaces by
> > setting the IP address to "", `0.0.0.0`, `::`, or `::0`.
> > This may expose the server to unintended traffic.
>
> Avoid listening to all interfaces by default to avoid exposing private
> information unwillingly.
>
> Unrelated: The Python stdlib TCP server listens on IPv4 only by default.
> Changing this requires creating a subclass that overrides address_family
> to socket.AF_INET6.
>
> Fixes: d94ebd627a86 ("usertools: add telemetry exporter")
> Cc: stable@dpdk.org
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
> usertools/dpdk-telemetry-exporter.py | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/usertools/dpdk-telemetry-exporter.py b/usertools/dpdk-telemetry-exporter.py
> index 6eca0db2e80a..6f66d4ecaab1 100755
> --- a/usertools/dpdk-telemetry-exporter.py
> +++ b/usertools/dpdk-telemetry-exporter.py
> @@ -75,7 +75,7 @@ def cmd(self, uri, arg=None) -> dict | list:
> "/usr/local/share/dpdk/telemetry-endpoints",
> "/usr/share/dpdk/telemetry-endpoints",
> ]
> -DEFAULT_OUTPUT = "openmetrics://:9876"
> +DEFAULT_OUTPUT = "openmetrics://127.0.0.1:9876"
>
Minor nit, but would it be better to use "localhost" rather than the
hardcoded IP here and below?
>
> def main():
> @@ -275,11 +275,11 @@ def serve_openmetrics(
> Start an HTTP server and serve requests in the openmetrics/prometheus
> format.
> """
> - listen = (args.output.hostname or "", int(args.output.port or 80))
> + listen = (args.output.hostname or "127.0.0.1", int(args.output.port or 80))
> with server.HTTPServer(listen, OpenmetricsHandler) as httpd:
> httpd.dpdk_socket_path = args.socket_path
> httpd.telemetry_endpoints = endpoints
> - LOG.info("listening on port %s", httpd.server_port)
> + LOG.info("listening on %s", httpd.socket.getsockname())
> try:
> httpd.serve_forever()
> except KeyboardInterrupt:
> --
> 2.48.1
>
next prev parent reply other threads:[~2025-01-27 14:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 11:51 Robin Jarry
2025-01-27 14:39 ` Bruce Richardson [this message]
2025-01-27 20:21 ` Robin Jarry
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=Z5eauLXHdzkNi64w@bricha3-mobl1.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=rjarry@redhat.com \
--cc=stable@dpdk.org \
/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).