How do you guys handle reverse proxies in rootless containers? - eviltoast

I’ve been trying to migrate my services over to rootless Podman containers for a while now and I keep running into weird issues that always make me go back to rootful. This past weekend I almost had it all working until I realized that my reverse proxy (Nginx Proxy Manager) wasn’t passing the real source IP of client requests down to my other containers. This meant that all my containers were seeing requests coming solely from the IP address of the reverse proxy container, which breaks things like Nextcloud brute force protection, etc. It’s apparently due to this Podman bug: https://github.com/containers/podman/issues/8193

This is the last step before I can finally switch to rootless, so it makes me wonder what all you self-hosters out there are doing with your rootless setups. I can’t be the only one running into this issue right?

If anyone’s curious, my setup consists of several docker-compose files, each handling a different service. Each service has its own dedicated Podman network, but only the proxy container connects to all of them to serve outside requests. This way each service is separated from each other and the only ingress from the outside is via the proxy container. I can also easily have duplicate instances of the same service without having to worry about port collisions, etc. Not being able to see real client IP really sucks in this situation.

  • herrfrutti@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    7 months ago

    Podman + Caddy does it for me.

    You need to adjust the “minimum” port a user can bind. Podman tells you how to do it (or a quick google search).

    • Molecular0079@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 months ago

      I am guessing you’re not running Caddy itself in a container? Otherwise you’ll run into the same real IP issue.

      • herrfrutti@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 months ago

        I do. If you run caddy with network_mode: hostor better with network_mode: "slirp4netns:port_handler=slirp4netns" it should work.

        also adding:

        cap_add:
              - net_admin
              - net_raw