Skip to main content

Podman defaults per account

A port that an account's own container publishes without naming an address binds the account's private address, not every address of the server. The containers the panel runs for an account name that address in their units. For the ones the account starts itself, podman run -p 8080:80 over SSH, a compose file, or a client of its Podman socket, podman's default_host_ips sets it, from a drop-in for each of the account's uids.

Why not podman's default

Podman binds such a port to 0.0.0.0. The firewall fences only the account's own address, so every other account on the server could connect to it through 127.0.0.1 or the server's addresses, and it would take the port number from every other account too.

The files​

FileWritten byHolds
/etc/containers/containers.rootless.conf.d/<uid>/60-elpan-account.confelpan-systemd-confgen, from the accounts intent[network] default_host_ips = ["<the account's address>"], for each uid of the account: the login user, -www and -mail.
/usr/share/containers/containers.rootless.conf.d/50-elpan.confThe elpan-systemd package, as a static file[engine] compose_warning_logs = false: silences a warning that podman compose prints on every call. Image copies are staged where podman stages them by default, /var/tmp (or $TMPDIR): image_copy_tmp_dir = "storage" is not set, because podman 6 does not create the directory it names, and an account's first podman load fails.

Every account with a private address gets the per-uid file, whatever its status; a suspended account's containers keep publishing on its address. The file follows the address when it changes (elpanctl account_ip_address refresh), and goes with the account.

The transformer works like the others (Server configuration): its units are elpan-systemd-confgen (.path, .service, .timer), its commands are /usr/lib/elpan/systemd/elpan-systemd-confgen diff and the rest (The transformers' commands), and man elpan-systemd-confgen has the details. Nothing is reloaded: podman reads its configuration on every command, and the API service behind an account's Podman socket exits when idle and reads it again when it next starts.

Both directories are rootless ones: root's podman reads neither.

Your own files​

The transformer owns, in each uid's directory, only 60-elpan-account.conf. A file of another name that you put there stays, and so does the directory when its account goes.

Podman reads the drop-ins of these directories, highest priority first:

  1. ~/.config/containers/containers.conf.d/, the account's own
  2. /etc/containers/containers.rootless.conf.d/<uid>/
  3. /etc/containers/containers.rootless.conf.d/
  4. /etc/containers/containers.conf.d/
  5. the same three under /usr/share/containers/

The priority decides only between files of the same name: the copy highest up hides every lower one entirely, and the others are never read. All the remaining files, from every directory, are then applied in the order of their names, a later one overriding a key that an earlier one set. That is why the server-wide file and the per-uid file have different names: a per-uid 50-elpan.conf would hide the server-wide one instead of adding to it.

ToPut
Set another value for one uidA file in its directory that sorts after 60-elpan-account.conf, e.g. 70-local.conf.
Set a value for every accountA file in /etc/containers/containers.rootless.conf.d/ that sorts after it, if it sets default_host_ips; any name otherwise.
Replace the server-wide drop-inYour own 50-elpan.conf in /etc/containers/containers.rootless.conf.d/.
A file named before 60-elpan-account.conf loses

A drop-in that sets default_host_ips and sorts before 60-elpan-account.conf, e.g. 10-local.conf, is applied first and then overridden by the transformer's file, wherever it is.

A default, not a fence​

The setting changes what podman does when the command names no address. An account can still publish elsewhere:

  • with an address in the command, -p 0.0.0.0:8080:80 or -p 127.0.0.1:8080:80;
  • with its own drop-in in ~/.config/containers/containers.conf.d/, named to sort after 60-elpan-account.conf or named 60-elpan-account.conf;
  • with CONTAINERS_CONF, which makes podman read no drop-in at all.

What another account can reach is the firewall's matter. The account panel marks a port that is not on the account's address Not private in its Podman Ports list.

Podman 6 only​

default_host_ips is a podman 6 key: Rocky Linux 10.3 and later. Podman 5 reads the file and ignores the key without a warning, so on a server that has not reached 10.3 the per-uid files are there and do nothing, and ports without an address bind 0.0.0.0 as before. The default takes effect with the update to podman 6, with nothing else to do.

It applies when a container is created. A container created before keeps its bindings until it is created again; the account's own quadlet units create theirs again on every start, a podman run -d container does not. After an address change the same holds. The account holder's side is in Containers.