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

Lock down file browser to certain directory #86

Closed
PhilsLab opened this issue Mar 7, 2019 · 9 comments
Closed

Lock down file browser to certain directory #86

PhilsLab opened this issue Mar 7, 2019 · 9 comments

Comments

@PhilsLab
Copy link

PhilsLab commented Mar 7, 2019

Being able to browse / in a docker container might be unwanted behavior.
I'd like to set an environment variable which locks the file/folder browser to a certain directory, such as /data/projects, etc.

@kylecarbs
Copy link
Member

Interesting. Wouldn't someone be able to use the terminal to break out anyways?

For a jailed session, I'd recommend running a docker container with the project directory mounted in.

@PhilsLab
Copy link
Author

PhilsLab commented Mar 7, 2019

Yeah, I already thought about having containers for each terminal.
If that would be implemented, there should be options for using the host docker (bind mount /var/lib/docker.sock) or using the Kubernetes API to spawn the container (ClusterRole).
Also, when using containers, there should be some kind of image that provides the needed programming tools for the project.

@PhilsLab
Copy link
Author

PhilsLab commented Mar 7, 2019

Also consider to switch to another docker base image when implementing this (node / alpine), it should be fully decoupled from the VS code terminals.

@unixfox
Copy link

unixfox commented Mar 8, 2019

What about using systemd to lock down the session? Systemd is very powerful at that, it's even possible to set some parameters to protect against a fork bomb:

systemd nspawn would be also a great tool to easily lock down the session: https://wiki.archlinux.org/index.php/systemd-nspawn
On systemd nspawn you can even launch unprivileged containers.

@PhilsLab
Copy link
Author

PhilsLab commented Mar 8, 2019

I don't think you should rely on the system having SystemD installed. Also, using the project scaled across a cluster would be way easier with docker/kubernetes integration.

@unixfox
Copy link

unixfox commented Mar 8, 2019

I didn't mean to only use systemd, we could provide several type of config for the user.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 8, 2019

I don't think its appropriate to implement this as part of code-server.

You can always deploy the docker image and only mount the directory you want edited.

@nhooyr nhooyr closed this as completed Mar 8, 2019
@PhilsLab
Copy link
Author

PhilsLab commented Mar 9, 2019

I can use the docker image, which also allows me to kill the server inside the docker container. When hosting this for others to use, it's a big downside, especially when the multi-user feature gets implemented.
Also, if you spawn docker containers as terminals, you can choose prebuilt images for python, node, etc., which is a lot nicer than having to manually install the tools you need each time.
I really hope you to re-evaluate this idea.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 9, 2019

You can build a custom docker image based on the existing image. See docker's FROM. So you wouldn't have to do things each time.

We can evaluate docker containers as terminals in a different issue.

This issue was about locking vscode server down which I think is out of scope. You can put it in a VM or a container easily if you want an isolated environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants