r/podman • • 22d ago

Rootful Reverse Proxy to Rootless Container

Hi!

I am running Caddy as a rootful container on the default network. I have a Jellyfin container that I am running rootless on a default Pasta network with port 8096 is only exposed to 127.0.0.1. I am trying to setup Caddy to reverse proxy for Jellyfin.

In Caddy, I am using host.containers.internal to obtain the the host's IP address. This works when proxying for another rootful container, but does not work when proxying for Jellyfin. From the logs it looks like the gateway to the Pasta network is rejecting the traffic.

Is there a way to have a rootful container communicate with a rootless container?

14 Upvotes

12 comments sorted by

7

u/seb0w 22d ago

The jellyfin container listens on 127.O.O.1, but Caddy forwards it to whatever the host name host.containers.internal resolves to.

You could open the port of jellyfin on all interfaces and use your OS firewall to restrict access from outside.

4

u/typing-blindly 22d ago

That solved it! I changed my quadlet to PublishPort=0.0.0.0:8096:8096/tcp and can now reach it via Caddy.

2

u/Nextros_ 22d ago

This works, but any device can now reach Jellyfin directly instead going through Caddy. Whether that's a problem is up to you.

Why do you run Caddy as a rootful container? It would be easier to run them both rootful/rootless and put them in the same network. This way you don't need to open any ports (except for Caddy)

1

u/typing-blindly 22d ago

My previous setup had all my containers running rootless, but that required workarounds for some of the limitations of running rootless. Namely, I had to lower the start of unprivileged ports, and setup socket activation on Caddy.

With the move to a new server I thought I would try a hybrid approach. Caddy and Technitium run as root. Everything else runs rootless under a system account without a login shell. I thought I could just bind to ports on 127.0.0.1, but obviously that didn't work. I may have to rethink my setup.

2

u/Nextros_ 22d ago

You can port forward your traffic from 80/443 to whatever port your reverse proxy binds to: https://tangentsoft.com/podman/wiki?name=Rootless+Privileged+Ports&p

While it might seem like a good idea to run a hybrid setup, it will cause more pain imo

3

u/Suspicious-Travel190 22d ago

With proper firewall settings only services on same device (like Caddy) will be able to access it. And I would always recommend using firewall and only allowing specific ports, like 22, 80 and 443.

1

u/DankeBrutus 13d ago

This works, but any device can now reach Jellyfin directly instead going through Caddy. Whether that's a problem is up to you.

I could absolutely be wrong here but wouldn't this only be true on their LAN? Does Podman even bypass the a firewall, like UFW, the way that Docker will? Using myself as an example I've been testing Jellyfin with with a quadlet on one machine with my bare-metal Caddy instance on another. I have port 8096 open with firewall-cmd on the Jellyfin machine with the caddy machine proxying stream.DOMAIN.com to http://192.168.0.10:8096. Any device on my LAN can access port 8096 on the Jellyfin machine, but external traffic has to go through Caddy first.

1

u/Nextros_ 13d ago

Yes, it's only true for LAN (if 8096 isn't opened to the internet). However I think that maintaining 2 ways of access is more work and can possibly lead to more mistakes and more vulnerabilities.

I don't think Podman bypasses the firewall like Docker does. But I'm not sure.

I have everything set up to go through Caddy. This way I get HTTPS (even for LAN) and I can manage traffic from 1 point. It just seems easier for me

0

u/hadrabap 22d ago

I do pin the container IP address and let Jellyfin bind to it as it is static.

2

u/RaxenGamer001 9d ago

Probably Both are in a different network. Add a same network like and use reverse_proxy jellyfin:8096

Check if this works

1

u/ffcsmith 22d ago

I have a rootless caddy container that proxies to a rootful omni container. Not sure if my setup is useful to you.

I have included a snippet of my Caddyfile below:

```text
omni.{$DOMAIN_BASE} {
import backend h2c://host.containers.internal:8088
}

omni-api.{$DOMAIN_BASE} {
import backend h2c://host.containers.internal:8090
}

omni-k8s.{$DOMAIN_BASE} {
import backend host.containers.internal:8095
}
```