Steam in Docker
hub.docker.com
hub.docker.com
* app isn't tied to / doesn't assume a Debian-ish distribution (we ship .deb, .rpm, a PKGBUILD, and a simple binary .tar.xz)
* app uses firejail on Linux (sandbox-exec on macOS, different user on Windows) to "set up more fences around" games you download from the internet.
There's a bunch more features we want to add to the app (live video capture, see itchio/capsule on github, synced collections, etc.) — but isolating "downloaded apps" from the rest of the system seemed like a sensible prerequisite on the road to doing that.I don't want to spam links, but if you're interested in our approach, you can probably search "itch.io sandbox" with your favorite search engine and stumble upon it :)
Is there something that the firejail does better than the Docker?
I can see the firejail also uses the namespaces and seccomp-bpf.
If I'm not mistaken, containers come with their own userland, if you want a useful graphical container you're in for a few hundred megabytes of dependencies, whereas sandboxing approaches (firejail, projectatomic/bubblewrap - used by flatpak for example) just try and limit what a process in the same user space has access to.
I wanted a solution that was low-overhead enough that it was a no-brainer for users to turn it on. However, it's not perfect: our sandbox policy could use tightening (as long as it doesn't break too much stuff), and having an additional SUID binary around is definitely something to look out for.
I'm hoping that more interest gathers around sandboxes and that they become more mainstream in Linux ecosystems. "Trusting package maintainers" only goes so far, and doesn't really account for third-parties shipping binary packages!
Or is this an exercise in getting GUI applications with slightly exotic features (GPU access) to run?
I'd like to understand why this was made but it isn't described in the usage instructions.
Few main points though, which pushed me making this Docker container:
1. I want to set-up more fences when running the code I don't/can't trust;
2. I don't want to spend time on figuring out how to install Steam (what deps) in a non-Debian (or non-SteamOS) based distro;
3. I like cleanliness: I can erase Steam and all its dependencies in a matter of seconds;
4. Like you said, it was an interesting exercise and it still needs some polishing :-)
And few Pros from my PoV:
- I can have Steam on my Ubuntu/openSUSE/[put any other distro I will want to use] in a short time that Docker takes when downloads this Steam container;
- Since Steam is meant to run in Debian (SteamOS) based distro, it is not a problem anymore, since it is in a container now.
The image build instructions are pretty easy to audit. And I trust docker (to an extent).
So in my mind it's safer, but not absolutely safe. I just view it as another layer of security :)
But security-wise, running it in a container is better, than running it without isolation. IMHO.
And of course, no one asks getting this image built by the 3rd party, since the Dockerfile is open, just build it yourself ;-)
Containers are great for development and production on your own infrastructure, or shared infrastructure like GCE or AWS. Security can be had from doing inspected builds, self signing, etc.
For consumers, however, it's a completely different ballgame.
By the time serious hacking is an issue through Steam, I'd expect containers will be that much better anyhow. For all they can be criticized, and regardless of whether you think some other approach would have been better, they're getting the "trial by fire" treatment. By hook or by crook, in another year or two I expect they'll be as secure as you could ask for.
Worn most of the time while a typical user is awake, goggle hacking will represent a very large target with widely varying rewards.
I think kordless is claiming that using Docker here could increase the severity of an attack; otherwise it doesn't seem like putting up another barrier could hurt security, even if it is later broken.
Everything falls to hacking eventually. That's the nature of it, at least till now.
I would note that Docker is primarily a tool for developers and operations folk who are also the author of the software being run. Docker itself is not the risk here, but using it for some use cases may very well be.
But it would still help in preventing such bugs as https://github.com/valvesoftware/steam-for-linux/issues/3671
HN discussion: https://news.ycombinator.com/item?id=8896186
What I actually meant is that I'd rather run an isolated (separated) process from other processes and the file-system space (and the other isolation features which cgroups are giving us), not meaning isolation from the host system.
With the cgroups/namespaces it's a process isolation (or separation, whatever wording you prefer). In the Linux kernel documentation they also use isolation wording. ;-)
This looks really promising though, and shows a practical use case for docker.
https://wiki.archlinux.org/index.php/PulseAudio/Examples#Pul...
Forgot exactly what I did with X11, but one part of it was having an environment variable that used my main users XAuthority
E.G. [gamer@mycomputer]$ echo $XAUTHORITY
/home/notthemessiah/.Xauthority
"Those who do not understand UNIX are condemned to reinvent it, poorly." -- Henry Spencer, programmer
This goes doubly for "containers" not understanding chroot/jails.
If only chroot was enough, noone would be investing their time to the cgroups, namespaces, LXC, Docker, etc... :-)
Containers provide chroot-like behavior for more than just the filesystem. Processes, user IDs, network interfaces... Chroot is filesystem only.
Is there a better way?
It automatically discovers the devices and the right driver files on the host.
The main goal is compute (CUDA), but we also demonstrated how to run TF2 on Steam OS during our DockerCon 16 OpenForum presentation.
Nice job! :)
Edit: in other words, your Docker image doesn't depend on a specific driver version and can be ran on any machine with sufficient drivers. Driver files are mounted as a volume when starting the container.
To make pulseaudio work in a container, you basically want to pass these volumes from the host to a container:
- /etc/localtime:/etc/localtime:ro
- /etc/machine-id:/etc/machine-id:ro
- $XDG_RUNTIME_DIR/pulse:/run/user/1000/pulse
And then, this environment variable:
PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native
HN discussion: https://news.ycombinator.com/item?id=8896186
I regularly reference the # scary! comment at work.
I have tested HL engine based games and CS:GO which has its csgo_linux64 binary, causing lots of people to complain they could not run it, since Steam itself is 32-bit one. With this image it is not a problem, since I am preloading all the necessary libraries. It, though, still needs some polishing... @all: I appreciate your advice / PR !
This will give you a frame rate identical to your host, so there is no overhead running your 3D apps in the container.
I'm not very familiar with using Docker.
https://youtu.be/ZHWsR8TnKsw?t=801
PS: Audio is in spanish.
But changing just one line in a docker-compose.yml file you can mount it wherever you want on your host. See "data:/home" in there.
You can write there "/home/your-user/mysteamdata:/home", so that all Steam games (caches, saves, ...) will be available for you at your home directory in "mysteamdata" directory ;-)
Alternatively, you can keep an environment variable GAME_SAVE_MOUNTS to which you append a -v flag with the desired mount saves. You can that start your container with $GAME_SAVE_MOUNTS and have everything work out of the box.
IE how many FPS do you get with a native Steam install vs Dockerized Steam on the same hardware?
The precise testing haven't been done explicitly to measure increase/decrease. But feel free to test it. ;)
There actually shouldn't be any significant decrease since the Docker's overhead is negligible.
Then as discussed in this thread, it gives few security advantages, control benefits since those isolated resources are controllable.