Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable --uts option in singularity.conf #1767

Closed
sinirajapan opened this issue Jun 14, 2023 · 4 comments · Fixed by #2915
Closed

Disable --uts option in singularity.conf #1767

sinirajapan opened this issue Jun 14, 2023 · 4 comments · Fixed by #2915
Assignees
Labels
enhancement New feature or request maybe Features / changes that maybe implemented in future, depending on need & resources

Comments

@sinirajapan
Copy link

sinirajapan commented Jun 14, 2023

【Request】
 In singularity.conf, add ’allow userns' and 'allow uts ns' like 'allow pid ns'.

【Background】
EDA (Electronic design automation) tool uses FlexLM (https://www.flexera.com/) for license management.
It is possible to restrict the access source of the license, and provides restrictions using "username" and "hostname"

【Theme】
When running the EDA tool in an environment that uses singularity, singularity exec --hostname ok_machine eda.sif eda_exec
By doing so, the above restrictions can be passed by disguising the hostname.
This is an issue that should be solved by FlexLM and/or EDA tools, but the situation is that singularity cannot be introduced because the developer does not support it.
Similarly, by binding /etc/passwd, the user name is changed and the above restrictions can be passed.

@sinirajapan sinirajapan added the enhancement New feature or request label Jun 14, 2023
@sinirajapan
Copy link
Author

Not only --uts option but also disabling --hostname.

@dtrudg
Copy link
Member

dtrudg commented Jun 14, 2023

This is not really going to be an effective way of avoiding the issue. You would have to disable unprivileged user namespaces on the system entirely, and disallow --hostname through Singularity.

On most systems these days, unshare is available. A user can unshare -u -r to get a user namespace with UTS namespace outside of Singularity. They can then set the hostname directly with the hostname command.

$ whoami
dtrudg-sylabs
$ hostname
mini
$ unshare -u -r

$ whoami
root
$ hostname bob
$ hostname
bob

Disabling the user & UTS namespaces in singularity.conf is therefore not effective. It would have to be done for the whole system by disabling unprivileged user namespaces with a sysctl. Otherwise there are easy ways to work around the configuration.

In general we prefer to avoid adding configuration options that infer some kind of security-related restriction that can easily be bypassed. As we are moving toward unprivileged execution in our upcoming OCI mode, which will require unprivileged user namespaces, I'm not sure these configuration options make sense.

Are the vendors of the software aware of the ability to bypass purely with unshare and not containers?

@sinirajapan
Copy link
Author

sinirajapan commented Jun 14, 2023

We've already disabled user namespaces with sysctl to disable 'unshare -r'.

Other namespaces are also used by systemd on RHEL9(network, uts, etc.), so we want to keep them available.

But I don't want to be able to use it in singularity.

Are the vendors of the software aware of the ability to bypass purely with unshare and not containers?

I don't have any connection with Flexlm vendor...

@dtrudg
Copy link
Member

dtrudg commented Jun 14, 2023

Okay. I think we'd consider a PR contributing this, but it's not a high priority to develop unless it affects a broad range of users.

@dtrudg dtrudg added the maybe Features / changes that maybe implemented in future, depending on need & resources label Jun 16, 2023
@dtrudg dtrudg added this to the SingularityCE 4.2.0 milestone Apr 26, 2024
@cyanezstange cyanezstange self-assigned this May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request maybe Features / changes that maybe implemented in future, depending on need & resources
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants