-
|
Based on this discussion, @rhatdan stated that But is the isolation in a unique UserNS as secure as running podman from an unprivileged user? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 48 replies
-
|
It is actually more secure. If you run two containers as a rootless user, they run in the same user namespace so they can attack each other from a User Namespace point of view. If you run two containers as root with podman run --userns auto, then they run in unigue user namespace and are isolated. Rootless containers are great for containers run by users on a system, but if you are just running containers on a server, then --userns=auto is a more secure solution. (I plan on writing a blog on this). |
Beta Was this translation helpful? Give feedback.
-
|
Can you please remember to write a short blog post stating that a rootful podman is safer than a rootless podman? I'm really struggling to convince other users of this. Maybe a short notice in the README would be enough? |
Beta Was this translation helpful? Give feedback.
-
|
One thing related to this...what would I think be quite cool is integration with systemd |
Beta Was this translation helpful? Give feedback.
-
|
@rhatdan, were you ever able to write the blog post above regarding the security implications of rootfull podman as potentially more secure vs rootless? I'd love to read it if you can share a link. Thank you! |
Beta Was this translation helpful? Give feedback.
-
|
Hello, what's the best practice here nowadays? I'm currently deploying containerized services creating a dedicated non-root user on my system per "pod". Enable lingering and running the container within that dedicated user in rootless mode. How does it look? Would it be better to run them instead with |
Beta Was this translation helpful? Give feedback.
-
|
I was very excited at the thought of not creating a user per pod but I am running into a problem if I run and maybe I need to read more about how this all works, but I tried setting subuid's and subgid's for the user 'container', that did nothing, I tried doing it for root and then realized root already had a lot. I tried running the command without sudo, that worked. I was hoping to have an uncomplicated and secure way to have multiple admins be able to tinker with containers and this seemed to be that promise. If i could get it going.... |
Beta Was this translation helpful? Give feedback.
-
|
I am a bit surprised by the conclusion of this discussion: $ cat /etc/subuid
dwalsh:100000:65536
rootless:2147483647:2147483648
$ cat /etc/subgid
dwalsh:100000:65536
rootless:2147483647:2147483648where |
Beta Was this translation helpful? Give feedback.
-
|
My struggle was with the advice pointed to in this thread. To make a user and attach a container to it this is what I've done, vaultwarden is an example of what I am trying to do.
This has worked just fine for me.
`sudo useradd vaultwarden`
`sudo loginctl enable-linger vaultwarden`
`mkdir -p /home/vaultwarden/vaultwarden_data`
`mkdir -p /home/vaultwarden/.config/containers/systemd`
`sudo chown -R vaultwarden:vaultwarden /home/vaultwarden/`
to make sure the following command works `sudo dnf install systemd-container`
`sudo machinectl shell vaultwarden@` or potentially `sudo -i -u vaultwarden` I'm not sure what the ups and downs are
```
cat < ~/.config/containers/systemd/vaultwarden.container
[Unit]
Description=Vaultwarden Server
[Container]
EnvironmentFile=%h/.env
Image=docker.io/vaultwarden/server:latest
AutoUpdate=registry
Network=host
UserNS=keep-id
Volume=%h/vaultwarden_data:/data:Z
Environment=ROCKET_PORT=8000
[Service]
# Inform systemd of additional exit status Success
ExitStatus=0 143
# Extend Timeout to allow time to pull the image
TimeoutStartSec=900
[Install]
# Start by default on boot
WantedBy=default.target
# https://docs.podman.io/en/latest/markdown/podman-systemd.unit.5.html
EOF
```
`systemctl --user daemon-reload`
`systemctl --user start vaultwarden.service`
`systemctl --user status vaultwarden.service`
This has worked pretty well. But I would like to dedicate a moment to try the tehnique mentioned in this issue, I think it would make management easier.
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
It is actually more secure. If you run two containers as a rootless user, they run in the same user namespace so they can attack each other from a User Namespace point of view.
If you run two containers as root with podman run --userns auto, then they run in unigue user namespace and are isolated.
Rootless containers are great for containers run by users on a system, but if you are just running containers on a server, then --userns=auto is a more secure solution. (I plan on writing a blog on this).