330 points · by rl1987 · 4y ago · 102 comments
docker run -it --rm -e DISPLAY --net=host -v $XAUTHORITY:/root/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix debian:11-slim
Then inside the container, run:
apt update
apt install firefox-esr
firefox
Now Firefox runs inside the container but displays on your hosts screen and you can use it right away.On the other hand the use cases that the article describes can already be accomplished by Firefox's "account containers" feature or just creating another profile and running `firefox --no-remote`
1. That's a big "if"; I'm fond of docker precisely for fixing software availability issues.
2. It's diminished, but it still provides significant protection, since the containerized program still can't see the real filesystem or process table without going through X or something networked. That's still pretty significant; it would, for instance, protect against a Firefox zero-day that was being used to read people's private SSH keys (not a hypothetical; that incident is what pushed me personally to start sandboxing my browser).
Backup there. I somehow have not heard about this. What was the vector? What was the exposure? E.g. have I leaked the contents of ~/.ssh to some (hopefully small, at least) subset of sites I've visited? Where can I learn more?
I don't deny that in theory someone could deploy a Firefox zero day that steals ssh keys and that having an abnormal setup via docker could throw a wrench in that, but you are essentially relying on obscurity of your setup which is not an acceptable approach - in the same way that the obscurity of TempleOS would not be a good security approach.
https://www.x.org/releases/X11R7.6/doc/xextproto/security.ht...
Here's the equivalent Dockerfile + docker-compose.yaml for convenience:
# Dockerfile
FROM debian:11-slim
RUN apt-get -y update && apt-get -y install firefox-esr
CMD ["firefox"]
# docker-compose.yaml
services:
firefox:
image: firefox
build: .
environment:
DISPLAY: ${DISPLAY}
network_mode: host
volumes:
- ${XAUTHORITY}:/root/.Xauthority
- /tmp/.X11-unix:/tmp.X11-unix
This way you can run it with just: docker-compose upThe example above is writing and reading every X11 message over a socket, and not reaching into /dev on the host, else it would need additional parameters added to the docker command.
I'm not current on Wayland, but as of a few years ago all attempts to run it non-locally required the X11 back-compat layer. I have no idea what /dev nodes would be required to be shared for wayland to run in a chroot.
Yes, but GP's example is X over a unix socket. Not sure if that counts as network.
Because in practice it generally can't; I'm not aware of any Linux distribution not shipping their X server with `-nolisten tcp` by default.
I'm a little surprised the examples don't require fiddling with X permissions, which I always had to do when not using ssh.
>By using this software you agree that the following non-PII (non personally identifiable information) data will be collected, processed and used by the maintainers for the purpose of improving the docker-android project. Anonymisation with respect of the IP address means that only the first two octets of the IP address are collected.
https://github.com/budtmo/docker-android/blob/master/LICENSE...
How can you call a project Apache when you're forcing people to pay via their data ? Why is their no opt out option?
Absent that this seems like a great QA automation tool. Or a Tinder bot farm...
Just rubs me the wrong way, you can easily use this without knowing it phones home
Having a full blown container like this can be useful in some scenarios, but I think it’s overkill for general purpose apps.
This can also be accomplised by using Firefox's Multi-Account Container extension in conjunction with the Container Proxy extension.
The Multi-Account Container extension is also great for non-dirtbag purposes. For instance testing different user profiles in an application - create 1 container for User, 1 for Admin etc.
The article says you need a compatible image for that, but in my experience, everything launches just fine.
[1] https://github.com/microsoft/vscode-dev-containers/blob/main...
You can even have a whole systemd setup in a container using this VNC backend, here in this Dockerfile with CPU rendering (LIBGL_ALWAYS_SOFTWARE=1) to avoid requring a GPU:
FROM docker.io/fedora
RUN dnf -y update && dnf install -y phosh phoc wayvnc sudo socat iproute mutter xorg-x11-server-Xwayland dbus-x11 mesa-libgbm mesa-libOpenCL mesa-libGL mesa-libGLU mesa-libEGL mesa-vulkan-drivers mesa-libOSMesa mesa-dri-drivers mesa-filesystem gnome-shell gnome-terminal
RUN mkdir -p /etc/systemd/system/phosh.service.d && echo -e '\
[Unit]\n\
ConditionPathExists=\n\
[Service]\n\
Environment=WLR_BACKENDS=headless\n\
Environment=WLR_LIBINPUT_NO_DEVICES=1\n\
StandardInput=null\n\
TTYPath=/dev/console\n\
TTYReset=no\n\
TTYVHangup=no\n\
TTYVTDisallocate=no\n\
ExecStart=\n\
ExecStart=/usr/bin/phoc --exec "bash -lc \"/usr/libexec/phosh --unlocked & wayvnc 0.0.0.0 7050\""\n\
' > /etc/systemd/system/phosh.service.d/10-headless.conf
RUN systemctl enable phosh.service
# Work around a problem with a missing dbus.service unit file
RUN mkdir -p /etc/systemd/system && ln -fs /usr/lib/systemd/system/dbus-broker.service /etc/systemd/system/dbus.service
# Mask udev instead of making /sys/ read-only as suggested in https://systemd.io/CONTAINER_INTERFACE/
RUN systemctl mask systemd-udevd.service systemd-modules-load.service systemd-udevd-control.socket systemd-udevd-kernel.socket
ENV container=docker
RUN groupadd --system sudo
RUN useradd --create-home --shell /bin/bash -G sudo user
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
ENV LIBGL_ALWAYS_SOFTWARE=1
RUN sudo -u user gsettings set sm.puri.phoc auto-maximize false
EXPOSE 7050
# Set up a /dev/console link to have the same behavior with or without "-it", needs podman run --systemd=always
CMD [ "/bin/sh", "-c", "if ! [ -e /dev/console ] ; then socat -u pty,link=/dev/console stdout & fi ; exec /sbin/init" ]
Use as: podman run --systemd=always --rm -p 7050:7050 imagenameAh (edit), there it is:
Because if most tools belong to the VM, then just run a VM in full screen and use that. No need to have the display server shared if you're using mostly Linux tools that display on the VM's X server.
https://blog.jessfraz.com/post/docker-containers-on-the-desk...
[0] I was exposed to it via Fedora Silverblue, where something like it is a necessity since the base OS is immutable. I've found it very useful even outside that use case however.
[1] Seems to me you could even use bwrap if you were reluctant to use syscalls directly.
[2] having done a little research towards creating my own tool because I'd rather not depend on a package that isn't available in many LTS distros, among other reasons.
They have told users that if they want, for instance, Jetbrains IDEs to work, they should simply get a Job at Jetbrains and convince them to rewrite their entire IDE to support the flatpak model.[1]
This is the reason I avoid distros with Flathub enabled by default. Half the software on there is broken in some pretty subtantial way, and nobody at Flatpak or Flathub cares. They really need to realize they're not Apple, they simply can't tell everyone to do things their way and hope to build a working and reliable ecosystem.
They have the equivalent to snap's classic confinement, but it needs to be explicitly enabled every time you launch an app.
[1]: https://github.com/flathub/com.jetbrains.IntelliJ-IDEA-Commu...
Personally I like that the Linux Desktop community is finally starting to wake up to the idea of universal application distribution that doesn't require armies of unpaid third party maintainers, and while Flatpak is definitely not perfect it is, in my opinion, a huge step forward in that regard[0].
[0] Not that the idea is really that new, there have been many attempts at bringing sanity to Linux application distribution, many of them better (IMO), but they've just never really been embraced by the community the way Flatpak has.
The person I linked above is in fact a flatpak maintainer.
Also, I hate they are shipping broken software. Almost nothing in that IDE works properly, yet Fedora now shows it by default when I search software.
At least snaps work most of the time.
Using a Docker container, which you may already have anyway, putting CPU/RAM quotas is a one-liner.
I do this to put many of my resource hungry apps like FF in slices.
Here’s an example of one, https://github.com/accetto/ubuntu-vnc-xfce-g3
Novnc just allows accessing things via a browser too. I use it for quick checks but VNC when I want a client
As an aside, instead of talking about growth hacking, and OSINT I think this whole thing could be a lot more relatable if the author chose a simple motivation like privacy. Another comment here mentioned subtools (?) which clearly highlights that not everything should be trusted with full access to your system.
It just lets you reuse any docker image on your desktop (both podman and docker), and has some nice features like the ability to create a launcher shortcut on the host and transparently mapping your home directory. I switched to it full time, all my CLI work is just done in a container, and it's pretty transparent.
Edit: this method uses xquartz on the Mac side, and socat to bridge between a network port and a file socket.
ps. you know, for some people it's very hard to read bright text on black background. Especially if you're flipping from opposite contrast.
if docker version is >20.10.x also works with Linux
Ugh, sounds like the software equivalent of using a huge stack of ingenious hardware to just do something parasitic like high-frequency trading.
Fast capitalism, to me, seems to be an ideology entirely centered on an authoritarian we-versus-them mindset where profit is king, civilian collateral be damned.
At the top of growth is incumbency. I think that’s where your second paragraph comes in. Incumbents surveil innovations, and “growth hackers” don’t like to talk about this obvious conclusion. They’d rather inhabit a role that concludes once growth has succeeded and slowed.
This is no more revolutionary than traditional marketing. Marxism talks about capitalist marketing as a way to channel alienation among working classes away from collective organization. But, Marx from the beginning needed to market his ideas to different groups. He needed those groups to realize that they needed his political orientation. He tries to do this with abstractions, and explicitly gives up on whole classes he deems unfit to understand those ideas (the lumpenproletariat).
As the product of a growth hacker reaches incumbency, marketing gives way to public relations. We might consider Cambridge Analytica public relations hackers. Same level of statistical sophistication, same single-focus of corporate promotion over all other advancements.