public inbox for passt-user@passt.top
 help / color / mirror / Atom feed
From: Felix Rubio <felix@kngnt.org>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-user@passt.top
Subject: Re: Connecting back to the host through a dummy veth interface
Date: Mon, 22 Dec 2025 13:48:03 +0100	[thread overview]
Message-ID: <2379954.irdbgypaU6@altair> (raw)
In-Reply-To: <20251221114722.2a613e94@elisabeth>

Ok, things are starting to get clear. The problem was, I think, between the 
desk and the keyboard.

* I have everything on a VM that I configure with Ansible. I have just taken 
everything down and started from scratch

* I still have my containers without any ad-hoc network. They are binding only 
to network interface 10.255.255.1, which is a dummy ethernet.

* My error was that I am running an LDAP server in one of these containers, 
and I was checking if it was working with a ldapwhoami. The client was 
replying that could not reach the server, which triggered all subsequent 
investigation, but the real cause was that the certificate offered by the server 
was not trusted by the client, and the latter broke the connection (without 
giving a more proper message - facepalm).

Once fixed the problem with the certificates, everything seems to work. This 
means that:
 * I have a dns server in 10.255.255.1 that resolves ldap.host.internal to 
10.255.255.1
 * ldap server rootless container is listening to 10.255.255.1:1636
 * ldap client is in another rootless container, and can reach directly 
ldap.host.internal:1636.

... Is this last point expected? the ldap server is started through podman as 
a regular user, without any network options... nothing fancy.

The reason for me asking is that all I have read points in the direction that 
from a rootless container I should not be able to loopback to the host... but 
maybe this dummy interface is not identified as "the host" and therefore I can 
connect to services bound to it? On the LDAP side, the logs show that these 
connections are coming from the same 10.255.255.1. That would be actually 
convenient, because then I can put firewall rules in place that prevent 
connecting from that dummy ethernet back to the host at all.

Thank you very much, and sorry for the initial confusing messages.
Felix

On Sunday, 21 December 2025 11:47:22 Central European Standard Time Stefano 
Brivio wrote:
> On Sat, 20 Dec 2025 15:28:43 +0100
> 
> Felix Rubio <felix@kngnt.org> wrote:
> > Hey Stefano,
> > 
> > Thank you for your answer! I know I can run rootful containers, and that 
then
> > I can access the host's network ns. However, this exposes a number of
> > potential issues:
> > * In case the an attacker manages to break out of the container, gets root
> > * That enables connecting back to the host loopback, but then from that
> > container any service listening to the loopback can be reached as well.
> 
> Sure. That's the whole point behind pasta(1) and rootless containers
> with Podman / rootlesskit. I certainly won't be the one suggesting that
> you'd run anything as root. :)
> 
> > The reason for looking for a way of binding those services to 10.255.255.1 
(so
> > that only exposed services will be in that interface) and running fully
> > rootless, if works, provides a more secure system... in general.
> 
> Indeed.
> 
> > About the mapped ports, I am a bit lost: for what I have tested, running
> > rootless disables the possibility to connect back to the host, right?
> 
> Hah, I see now. No, that's not the case. You can run rootless
> containers and connect to the host from them, in two ways:
> 
> 1. disabled by default in Podman's pasta integration, not what you want:
>    via the loopback interface, see -U / -T in 'man pasta' and
>    --host-lo-to-ns-lo for the other way around.
> 
>    In that case, packets appear to be local (source address is
>    loopback) in the other namespace ("host" or initial namespace for
>    packets from a container, and container for packets from host).
> 
>    This gives you better throughput but making connections appear as if
>    they were local is risky (cf. CVE-2021-20199), so it's disabled by
>    default, and not what I'm suggesting (at least in general)
> 
> 2. what you get as default in Podman: using pasta's --map-guest-addr.
> 
>    The current description of this option in pasta(1) isn't great, hence
>    https://bugs.passt.top/show_bug.cgi?id=132, but the idea is that you
>    will reach the host from the container with a non-loopback address,
>    as if the connection was coming from another host (which should
>    represent the expected container usage).
> 
> So here's an example:
> 
> $ podman run --rm -ti -p 8089:80 traefik/whoami
> 2025/12/21 10:42:16 Starting up on port 80
> 
> [in another terminal]
> $ podman run --rm -ti fedora curl host.containers.internal:8089
> Hostname: ab94f49b5042
> IP: 127.0.0.1
> IP: ::1
> IP: **.***.*.***
> IP: ****:***:***:***::*
> IP: ****::****:****:****:****
> RemoteAddr: 169.254.1.2:46592
> GET / HTTP/1.1
> Host: host.containers.internal:8089
> User-Agent: curl/8.15.0
> Accept: */*
> 
> ...doesn't that work for you? Note that you'll need somewhat recent
> versions of pasta (>= 2024_08_21.1d6142f) and Podman (>= 5.3).


-- 
Felix Rubio



  parent reply	other threads:[~2025-12-22 12:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <176606116131.2775.3279769610610037541@maja>
2025-12-20 14:12 ` Stefano Brivio
2025-12-20 14:28   ` Felix Rubio
2025-12-21 10:47     ` Stefano Brivio
2025-12-21 15:32       ` Felix Rubio
2025-12-22 12:48       ` Felix Rubio [this message]
2025-12-18 12:32 Felix Rubio

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=2379954.irdbgypaU6@altair \
    --to=felix@kngnt.org \
    --cc=passt-user@passt.top \
    --cc=sbrivio@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 IMAP folder(s).