public inbox for passt-user@passt.top
 help / color / mirror / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Nicholas Rodrigues Lordello <n@lordello.net>
Cc: passt-user@passt.top
Subject: Re: CAP_NET_BIND_SERVICE does not allow binding to low ports
Date: Mon, 16 Nov 2026 00:24:15 +0100 (CET)	[thread overview]
Message-ID: <20261116002414.09b82be6@elisabeth> (raw)
In-Reply-To: <A59F14D4-FC86-406E-8C06-EDB14F46E215@lordello.net>

Hi Nick,

Sorry for the delay.  I finally found a moment to look into this:

On Wed, 14 Oct 2026 14:32:43 +0000
Nicholas Rodrigues Lordello <n@lordello.net> wrote:

> Hey all,
> 
> Just wanted to report what is either a documentation issur, or an
> issue in `passt` proper. The `man` pages document the following for
> binding to low numbered (i.e. service ports):
> 
>     or the CAP_NET_BIND_SERVICE Linux capability is granted, see
>     services(5) and capabilities(7).
> 
>     [...]
> 
>     To grant this capability, you can issue, as root:
> 
>         for p in $(which passt passt.avx2); do
>             setcap 'cap_net_bind_service=+ep' "${p}"
>         done
> 
> However, this does not work:
> 
>     # setcap 'cap_net_bind_service=+ep' /usr/local/bin/passt
>     # setcap 'cap_net_bind_service=+ep' /usr/local/bin/passt.avx2
>     $ /usr/local/bin/passt -f -t 123
>     Listen failed for HOST TCP port */123: Permission denied
>     Couldn't listen on requsted ports
>     [1]
> 
> The reason I'm asking is that `krun` uses `passt` for port forwarding
> and is having issues with service ports [1]. The current work-around is
> to set the `net.ipv4.ip_unprivileged_port_start` sysctl to a lower
> number in the container where `passt` is run, but since `passt` is
> started already with `CAP_NET_BIND_SERVICE` it would be nice for that
> to work and not require the `sysctl` work-around.
> 
> Anyway, curious to know if this is documentation issue or actually
> something that should be working but isn't (or a local setup issue).

...ideally we'd like it to work (not for automatic port forwards, and
also not for runtime ones, that is, configured via pesto(1)), but:

  https://archives.passt.top/passt-dev/Y0YshqEtFoCRlLH9@yekko/

on the other hand, there would be a way to fix it, by reordering things
a bit and postponing isolation steps.  This was my draft from 4 years
ago:

  https://archives.passt.top/passt-dev/20221013125017.195769cf@elisabeth/

now things changed quite a bit, but what would need to be done is
essentially to move the isolate_user() call *after* the initial
fwd_listen_init() call.  There might be a few implications, I don't
think it's as simple as moving that single call, but I think it should
be doable.

-- 
Stefano


      reply	other threads:[~2026-11-15 23:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14 14:32 Nicholas Rodrigues Lordello
2026-11-15 23:24 ` Stefano Brivio [this message]

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=20261116002414.09b82be6@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=n@lordello.net \
    --cc=passt-user@passt.top \
    /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 IMAP folder(s).