-
Notifications
You must be signed in to change notification settings - Fork 424
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
Should --cleanenv work for instance start? #5353
Comments
The I do see the argument here that If your |
That would be a reasonable solution, although then the interaction with the instances would need to be limited to singularity-compose commands. @biocyberman could you chime in here about the issue you are having? I thought I understood, but after your recent comment I'm not following - a service container that requires a password to start would need to have that variable from the host after start, and then you could unset it. A user that is able to exec/shell would already have access to their local environment (so shelling inside, if the envar is unset, they would not see it). We could add this --clean-env option to singularity-compose commands, but it would still be possible to use singularity on the host and just override that. |
@vsoch Thanks for following up on this. You got it right as you wrote at
All secret passwords are used only for setting up a service the first time. Therefore An administrator runs a script called Now translate to the use case:
I realize that some environmental variables need to be kept in the container, something like, "JAVA_HOME" in the old days, or custom addition to $PATH. These can be saved in I agree, |
@biocyberman if the container service (the startscript) needs the password to start the service, I'm not clear how it could be the case that singularity-compose "knows" the password but the container does not. To get the environment in the first place you have to map it into the .singularity.d environment folder, so the only think I can think of to "remove" it after starting is to unset the variable and delete the file. The same is true for docker-compose - there isn't some set of environment variables that docker-compose knows about that are used to start services, but then aren't available in the container. To give the parallel example with Docker, their docker secrets are only available via swarm, which means there is a separate service handling encryption and giving them out. So - I think for this simple example, if you want to start the service and then get rid of secrets, you would need to unset and then remove the environment file. On the Singularity side, there could be some custom feature where you can |
@vsoch / @biocyberman - would you like to define a feature request on this stuff, or shall I close the issue? |
I understand the spirit of the issue - we want to start the container with some sets of secrets that don’t endure for later invocations - but I’m not sure how to do that in practice. If the envars were indeed used then unset, and some file bound and removed with some —cleanenv-post flag, subsequent interactions wouldn’t see them, but you would never be able to recover them to restart the container. And would the services started continue to work? Could it work that a password protected file is used and the password required to read the envars at start and then restart? The issue is creeping into different methods to manage secrets, and I’m wondering if this is in Singularity ballpark or should be done with some third party tool (does anyone have suggestions?) @biocyberman what are your thoughts? |
If there are further thoughts on this, please feel free to reopen. A docs issue is tracked at apptainer/singularity-userdocs#383 |
Version of Singularity:
What version of Singularity are you using?
Expected behavior
I would expect to run
and then have the environment cleaned for the start script and all subsequent interactions.
Actual behavior
--cleanenv
doesn't seem to do anything, you can shell/exec/otherwise interact with the instance and the host environment is there.To give you some context, when we start instances with
singularity-compose
we would want to enforce isolation of the environment, and be sure that our services (when interacted with) don't have any secrets. The user familiar with docker-compose would also expect that. The issue was first brought up here singularityhub/singularity-compose#25 (comment) so if we are unable to support--cleanenv
for start, my questions would be:Thank you! I'll put a dummy example to reproduce this below.
Steps to reproduce this behavior
What OS/distro are you running
Ubuntu 18.04
How did you install Singularity
Don't remember, likely a master branch some time ago :)
The text was updated successfully, but these errors were encountered: