[slurm-users] container on slurm cluster

331 zobrazení
Přeskočit na první nepřečtenou zprávu

GHui

nepřečteno,
13. 5. 2022 1:43:1113.05.22
komu: slurm-users
I fount a serious problem. If I run a container on a common user, eg. tom. In container I switch user to jack, now, if I submit a job to slurm cluster, the job owner is jack.
So I use the tom account submit a jack's job.

Any help will be appreciated.
--GHui

GHui

nepřečteno,
16. 5. 2022 1:54:1916.05.22
komu: slurm-users

Ole Holm Nielsen

nepřečteno,
16. 5. 2022 2:26:1816.05.22
komu: slurm...@lists.schedmd.com
You must check that the users' UID is the same on all nodes, see
http://slurm.schedmd.com/quickstart_admin.html

/Ole



Hermann Schwärzler

nepřečteno,
16. 5. 2022 4:02:1616.05.22
komu: slurm...@lists.schedmd.com
Hi GHui,

I have a few questions regarding your mail:

* What kind of container are you using?

* How exactly do you switch to a different user inside the container?

Regards,
Hermann

Marcus Wagner

nepřečteno,
16. 5. 2022 5:03:0516.05.22
komu: slurm...@lists.schedmd.com
In fact, that is something, that I would expect. In my opinion, that is a misconfiguration of the container.
If on bare metal I do a sudo -u <newuser> and then submit a job, I would expect that to be submitted as newuser, and not as the old one.

Best
Marcus
--
Dipl.-Inf. Marcus Wagner

IT Center
Gruppe: Server, Storage, HPC
Abteilung: Systeme und Betrieb
RWTH Aachen University
Seffenter Weg 23
52074 Aachen
Tel: +49 241 80-24383
Fax: +49 241 80-624383
wag...@itc.rwth-aachen.de
www.itc.rwth-aachen.de

Social Media Kanäle des IT Centers:
https://blog.rwth-aachen.de/itc/
https://www.facebook.com/itcenterrwth
https://www.linkedin.com/company/itcenterrwth
https://twitter.com/ITCenterRWTH
https://www.youtube.com/channel/UCKKDJJukeRwO0LP-ac8x8rQ

GHui

nepřečteno,
17. 5. 2022 1:50:0917.05.22
komu: slurm-users
I use podman 4.0.2. And slurm 21.08.8-2.
I run container on my host with username rsync. And it only has itself privilege.
I create the same username, UID and GID in container with the host.
I run "podman exec -it <container> /bin/bash" to login with host user rsync. And the user is root on container.
Now I submit job with root in container. And job is running on host. And the job's owner is root.
So I submit a job with user rsync, but it runs as root privilege.

On 5/16/22 7:53 AM, GHui wrote:

&gt; I fount a serious problem. If I run a container on a common user, eg. tom. In container I switch user to jack, now, if I submit a job to slurm cluster, the job owner is jack.
&gt; So I use the tom account submit a jack's job.
&gt;
&gt; Any help will be appreciated.
&gt; --GHui</container>

Brian Andrus

nepřečteno,
17. 5. 2022 9:58:4617.05.22
komu: slurm...@lists.schedmd.com
You are starting to understand a major issue with most containers.

I suggest you check out Singularity, which was built from the ground up
to address most issues. And it can run other container types (eg: docker).

Brian Andrus

Hermann Schwärzler

nepřečteno,
17. 5. 2022 10:11:2117.05.22
komu: slurm...@lists.schedmd.com
Hi GHui,

fyi: I am not a podman-expert so my questions might be stupid. :-)

From what you told us so far you are running the podman-command as
non-root but you are root inside the container, right?

What is the output of "podman info | grep root" in your case?

How are you submitting a job from inside the container?
You have to have Slurm and munge installed and correctly configured
inside the container for that, right?
Why are you using such a container in the first place?

Regards,
Hermann

Timo Rothenpieler

nepřečteno,
17. 5. 2022 11:18:0317.05.22
komu: slurm...@lists.schedmd.com
On 17.05.2022 15:58, Brian Andrus wrote:
> You are starting to understand a major issue with most containers.
>
> I suggest you check out Singularity, which was built from the ground up
> to address most issues. And it can run other container types (eg: docker).
>
> Brian Andrus

Side-Note to this, singularity is now called apptainer, but is otherwise
the same thing.
Documentation and Google results are wildly split between the two.

Stephan Roth

nepřečteno,
18. 5. 2022 2:26:1518.05.22
komu: Slurm User Community List
Sidenote 2: Singularity was renamed to Apptainer. The 3.8 series is
still maintained. Sylabs forked Singularity and kept the name.
So there are effectively 3 versions around for the time being:

https://github.com/apptainer/singularity (3.8 Series)
https://github.com/apptainer/apptainer (Successor to the original)
https://github.com/sylabs/singularity (SingularityCE, fork from Sylabs)

Also see: https://apptainer.org/news/community-announcement-20211130/

Personal note: I'm not sure what I'd choose as a successor to
Singularity 3.8, yet. Thoughts are welcome.

Stephan

GHui

nepřečteno,
18. 5. 2022 3:14:4618.05.22
komu: slurm-users
Hi, Hermann

Yes, I run podman as non-root, and use the root inside the container.
But the root in container has only privilege non-root which I run podman-command.

[]$ podman info | grep root
rootless: true

I exec "sbatch sub.sh" to submit inside the container.

I had config the right slurm and munge inside the container.

I just want to run some software in container, in order to get out of host OS environment.
On a whim, I config the slurm on container and submit a job.


On 5/17/22 16:10:55, Hermann wrote:
&gt; fyi: I am not a podman-expert so my questions might be stupid. :-)
&gt; From what you told us so far you are running the podman-command as
&gt; non-root but you are root inside the container, right?
&gt; What is the output of "podman info | grep root" in your case?
&gt; How are you submitting a job from inside the container?
&gt; You have to have Slurm and munge installed and correctly configured
&gt; inside the container for that, right?
&gt; Why are you using such a container in the first place?
&gt;
&gt;&gt; On 5/17/22 7:49 AM, GHui wrote:
&gt;&gt; I use podman 4.0.2. And slurm 21.08.8-2.
&gt;&gt; I run container on my host with username rsync. And it only has itself privilege.
&gt;&gt; I create the same username, UID and GID in container with the host.
&gt;&gt; I run "podman exec -it <container>&gt; /bin/bash" to login with host user rsync. And the user is root on container.
&gt;&gt; Now I submit job with root in container. And job is running on host. And the job's owner is root.
&gt;&gt; So I submit a job with user rsync, but it runs as root privilege.
&gt;&gt;
&gt;&gt; On 5/16/22 7:53 AM, GHui wrote:
&gt;&gt;&gt; I fount a serious problem. If I run a container on a common user, eg. tom. In container I switch user to jack, now, if I submit a job to slurm cluster, the job owner is jack.
&gt;&gt;&gt; So I use the tom account submit a jack's job.
&gt;&gt;&gt;
&gt;&gt;&gt; Any help will be appreciated.
&gt;&gt;&gt; --GHui</container>

GHui

nepřečteno,
18. 5. 2022 3:23:2918.05.22
komu: slurm-users
Hi, Brian Andrus
I think the main poblem is that container can cheat Slurm.

On 5/17/22 06:58:20, Brian Andrus wrote:
&gt; You are starting to understand a major issue with most containers.
&gt; I suggest you check out Singularity, which was built from the ground up
&gt; to address most issues. And it can run other container types (eg: docker).
&gt; Brian Andrus


&gt;
&gt;&gt; On 5/17/22 7:49 AM, GHui wrote:
&gt;&gt; I use podman 4.0.2. And slurm 21.08.8-2.
&gt;&gt; I run container on my host with username rsync. And it only has itself privilege.
&gt;&gt; I create the same username, UID and GID in container with the host.

&gt;&gt; I run "podman exec -it container-id /bin/bash" to login with host user rsync. And the user is root on container.

Markus Kötter

nepřečteno,
18. 5. 2022 5:34:2418.05.22
komu: slurm...@lists.schedmd.com
Hi,

On 18.05.22 08:25, Stephan Roth wrote:

> Personal note: I'm not sure what I'd choose as a successor to
> Singularity 3.8, yet. Thoughts are welcome.

I can recommend nvidia enroot/pyxis.
enroot does unprivileged sandboxes/containers, pyxis is the slurm SPANK
glue.

https://slurm.schedmd.com/SLUG19/NVIDIA_Containers.pdf

https://github.com/NVIDIA/enroot
https://github.com/NVIDIA/pyxis


Notes from operation:
I recommend using nvme for the container storage, default configuration
uses tmpfs.

> …/enroot.conf


> ENROOT_RUNTIME_PATH /tmp/enroot/user-$(id -u)

> ENROOT_DATA_PATH /tmp/enroot-data/user-$(id -u)




tmpfiles.d/…
> d /tmp/enroot/ 0777 root root - -
> d /tmp/enroot-data/ 0777 root root - -
> d /tmp/pyaxis-runtime/ 0777 root root - -


> dest: /etc/slurm/plugstack.conf.d/pyxis.conf

> content: |

> required /usr/lib/x86_64-linux-gnu/slurm/spank_pyxis.so runtime_path=/tmp/pyxis-runtime/



Time savers:
The container url formatting is … unexpected, # is used as seperator for
the path in host:port#path/file - and may need to be escaped to avoid
getting interpreted as comment.

It uses a netrc formatted .credentials file for container registries
with authentication.
Insert the credentials twice - with and without port.

Can do more than documented. (e.g. #SBATCH --container-image)



MfG
--
Markus Kötter, +49 681 870832434
30159 Hannover, Lange Laube 6
Helmholtz Center for Information Security

Josef Dvoracek

nepřečteno,
18. 5. 2022 6:33:5918.05.22
komu: slurm...@lists.schedmd.com
> I had config the right slurm and munge inside the container.

this is the reason.

Who has access to munge.key can effectively became root at slurm cluster.

you should not disclose munge.key to containers.

cheers

josef

On 18. 05. 22 9:13, GHui wrote:
> ...I had config the right slurm and munge inside the container.
>
...

Brian Andrus

nepřečteno,
18. 5. 2022 8:55:0718.05.22
komu: slurm...@lists.schedmd.com
Ghui,

It seems that things are doing what they should.

You are allowing an account to become root inside the pod and the pod is
considered a trusted environment by slurm (you are running munge inside it).
So as far as slurm is concerned, 'root' from a trusted environment is
submitting a job.

Which circles back to the big issue with most container environments:
security.

You should not allow full access to root inside your container (or other
environments). Use sudoers and be highly restrictive with what commands
are allowed.
If that is not possible, you need to trust the people you give the
permission to that they will not abuse it.

Brian Andrus
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv