This is a by design part of Docker's operation. What's perhaps a little more surprising (though it shouldn't be) is that anyone with create pod rights in a k8s cluster can do this by default on every worker node in the cluster. (unless the cluster operator or provider has implemented additional controls)
Re:Root your Docker host in 10 seconds for fun and profit (2...
by eternauta3k on Tuesday May 28, 2024 @07:38AM
(#40499691)
If there's basically no security, it would be more honest to do away with the "docker" group and just say that you need to give root to all docker users.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by woodrowbarlow on Tuesday May 28, 2024 @08:42AM
(#40500157)
this is why, when you install docker, it doesn't add any users to the group automatically. it's an extra "post-installation step" listed in the documentation, with a big warning flag explaining that this is effectively equivalent to handing out root.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by dathinab on Tuesday May 28, 2024 @09:44AM
(#40500706)
It is for me also still a irritating wonder why most Linux distros ship docker like they do (which often doesn't include the docker group but sets it up in a way where it's likely users end up using it, and security warnings related to it are often more then lacking).
I mean they could ship rootless docker by default, like podman defaults to rootless (or other by now possible more secure non default setups).
Also if you care you probably want to combine rootless (or non-rootless but still user namespace using) docker with a linux secure module setup like SELinux, as it can make security vulnerabilities in rootless docker (and well docker in general) much harder to exploit.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by akdev1l on Tuesday May 28, 2024 @10:41AM
(#40501184)
> I mean they could ship rootless docker by default, like podman defaults to rootless (or other by now possible more secure non default setups).
Upstream doesn’t support that configuration as default and it will likely break all the docker tutorials online that assume a rootful daemon. (A quick example: google “Jenkins docker integration” and it will likely tell you to pass through the docker socket)
Hence package maintainers don’t want to take the burden of maintaining that.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by dathinab on Wednesday May 29, 2024 @04:44AM
(#40509820)
But exactly that is the issue especially something like Jenkins shouldn't use the default docker setup, but one of the multiple ways it can be hardened (mainly rootfull using user namespaces or rootless using user namespaces).
also to quote that documentation:
> By default, the Docker Pipeline plugin will communicate with a local Docker daemon, typically accessed through docker.sock.
which means that iff they do it right it will just work frictionless. Rootless docker still has a local socket and in a proper setup $DOCKER_HOST is used to point to it. $DOCKER_HOST is used the docker command, and any other application which communicates with the docker socket instead MUST handle it or it's a pretty big bug even in the absence of rootless.
And again you don't need rootless, you can also configure user namespaces with rootfull docker. Which isn't fixing all issues for all use cases, but fixes the ones which are an security issue for Jenkins.
In general the only place where a default docker setup can be security wise acceptable is where it's acceptable to always explicitly use sudo, e.g. no developer setup. Which mainly leaves use cases like using it for long running manual managed services, but then using podman instrumented through systemd (systemd directly supports OCI images as services) is still most times preferable.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by stingraycharles on Tuesday May 28, 2024 @08:54AM
(#40500276)
This is the biggest part imho. Podman just inherits the permissions of the current user, which makes things so much easier to reason about from a security perspective.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by willejs on Tuesday May 28, 2024 @07:21AM
(#40499592)
One thing that always surprises me, is that people havn't made more of a fuss about docker for mac. By default on install it shares the whole hard disk (unless thats changed), meaning without sudo you can get privileged access to the whole filesystem. I scope it down to my user folder, but the defaults are dangerous.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by beeboobaa3 on Tuesday May 28, 2024 @07:27AM
(#40499626)
Do you also think running any regular software is "dangerous"? Because that gets to access your disk as well. Docker is not for security isolation, it is for distributing apps so they'll even run on your mac.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by anais9 on Tuesday May 28, 2024 @07:33AM
(#40499664)
While your point about Docker’s primary purpose is valid, containerization is commonly used for security isolation as well. With proper configuration, it can be very useful towards this end.
Can you suggest any preferred alternative methods of isolation that offer similar efficacy and ease of use for quickly running complete software systems made by an unknown/untrusted actor?
Re:Root your Docker host in 10 seconds for fun and profit (2...
by beeboobaa3 on Tuesday May 28, 2024 @07:58AM
(#40499808)
> With proper configuration, it can be very useful towards this end.
It can. I think it's fair to assume that the standard developer setup to let them be productive is not this proper configuration.
> Can you suggest any preferred alternative methods of isolation that offer similar efficacy and ease of use for quickly running complete software systems made by an unknown/untrusted actor?
No. It's a hard problem! If it was easily solved we wouldn't be seeing all this development surrounding e.g. WebAssembly
Re:Root your Docker host in 10 seconds for fun and profit (2...
by zmgsabst on Tuesday May 28, 2024 @07:55AM
(#40499792)
Docker has had security and isolation features since it was competing with LXC on who glued cgroups and namespaces together better — and discussed in those terms the whole time.
While I agree that Docker as written isn’t good at security, your post has big “they’re holding the iPhone wrong!” vibes — and seemingly ignores the historic reasons that people would think it provides security.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by beeboobaa3 on Tuesday May 28, 2024 @08:00AM
(#40499819)
> your post has big “they’re holding the iPhone wrong!” vibes
More like "it just isn't meant to be used for that". At least not in the default configuration, and that's fine!
> seemingly ignores the historic reasons that people would think it provides security
I've been using docker since it was announced. People have always been very clear that docker is not a security boundary, at least not with its default configuration.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by gtirloni on Tuesday May 28, 2024 @08:29AM
(#40500052)
I think your point is valid. Docker was indeed all about developer productivity in the beginning and it's up to infrastructure operator to lock it down.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by ryan-duve on Tuesday May 28, 2024 @07:25AM
(#40499611)
For anyone turned off by the title, here's the first sentence:
> Disclaimer: There is no actual profit. That was just one of those clickbaity things everybody seems to like so much these days. Also, it’s not really fun. Alright, on with the show!
Re:Root your Docker host in 10 seconds for fun and profit (2...
by cpach on Tuesday May 28, 2024 @07:52AM
(#40499770)
In case you didn’t recognize the trope: It’s a reference to the seminal article ‘Smashing the stack for fun and profit’ by Aleph One. Published in Phrack #49, 1996. IIUC that was the article that introduced the concept of buffer overflow exploits to a wider audience. People have been writing ‘X for fun and profit’ headlines ever since.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by timrichard on Tuesday May 28, 2024 @08:28AM
(#40500046)
On dot matrix and impact (like daisywheel) printers, there were sprockets along the side edges of the paper so that the tractor part of the printer could advance the paper after a linefeed.
It's sometimes called 'listing paper', as it was commonly used to print out listings of your code :
Re:Root your Docker host in 10 seconds for fun and profit (2...
by dcminter on Tuesday May 28, 2024 @08:40AM
(#40500146)
Also known as "Continuous Stationery" (one of my Father's customers companies was even called that) because each page was joined via a perforated line or "fanfold" as it was folded into the box with alternating left-right folds along the perforation just as a paper fan is folded.
Often the holes for the tractor feed were also separated from the main part of the page by a perforation so that one could tear it off to leave a more-or-less pristine letter (or A4 over here) page of content.
Fiddling with the left-over narrow strips of hole-punched edging paper was one of those universal habits that you don't even notice until long after it's gone.
(Edit: _a_ I just realised I replied to the wrong parent post and _b_ now I'm wondering if you're somebody I know!)
Re:Root your Docker host in 10 seconds for fun and profit (2...
by dcminter on Tuesday May 28, 2024 @10:34AM
(#40501116)
That's hilarious! When I mentioned the joy of messing with those strips of holes from the paper I was thinking of a specific occasion in a very dull lecture (business studies?) when I built a small paper boat out of them and you and Phil (I think) sitting in the row behind me said it was the only interesting part...
As Pratchett said, "We've all passed a lot of water since those days..." :D
Re:Root your Docker host in 10 seconds for fun and profit (2...
by gtirloni on Tuesday May 28, 2024 @08:31AM
(#40500065)
Epson LX300 was on my wish list for a long time. I didn't have the money at the time, then inkjet happened and the matrix printers became extremely expensive here.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by orwin on Tuesday May 28, 2024 @07:57AM
(#40499805)
Also, i think this idiom sound nice, and add disambiguation to the sentence ("Root your docker host" can mean something totally different than the OP title)
Re:Root your Docker host in 10 seconds for fun and profit (2...
by sunshine-o on Tuesday May 28, 2024 @09:05AM
(#40500365)
My pet theory is that open source is very much about packaging things.
I remember being amazed when I discovered that there was this a system, called GNU/Linux, where everything you need was already packaged and easy to install.
Then came the Maven, npm & co.
Docker (and containers) is basically an universal package manager that was fulled by the success of open source, the arrival of a lot of new people (working on Mac and Windows) in that space and the adoption of the cloud.
Docker Hub became the open source "app store".
The crime is the misleading term "container" because I bet a majority of people assume there is some security guarantee by design, what is absolutely false.
Actually container security is pretty hard and a most people don't really care because it doesn't run on their computer but in the cloud.
My guess is something like Kata containers, compatible with the container standards while leveraging hardware virtualization technology will prevail. Or a cleaner system, similar to NixOS/Guix but easier to use, will appear.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by Gasp0de on Tuesday May 28, 2024 @09:30AM
(#40500568)
I don't get why this is supposed to be a big thing, I thought it was commonly known. This doesn't mean that people can get root from inside a docker container, just that anyone who is allowed to create and start docker containers on a machine can also get root on that machine.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by HankB99 on Tuesday May 28, 2024 @10:16AM
(#40500963)
> and does not suffer from many of the docker shortcomings.
Would you care to elaborate on the shortcomings? I use Docker in my home lab and have taken a couple runs at Podman but have not been highly motivated and reverted to Docker rather than fiddle with things to get my containers working. If I were aware of significant benefits for my usage, I might be inclined to keep trying. If the benefits are more relevant to enterprise or cloud environs, it probably does not matter much to me.
My use cases include Gitea (git server) which opens privileged ports inside the container that get mapped to unprivileged ports on the host and I believe that was a problem area.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by worksonmine on Tuesday May 28, 2024 @06:42PM
(#40506381)
> opens privileged ports inside the container that get mapped to unprivileged ports on the host
You can either allow those ports to be mapped on your host, or you can map a higher port on the host 8000:80 or 4443:443. I did the former.
The biggest problem I have with docker other than root is that it touches the firewall for convenience. Any port you map on the host will be opened in nftables, as per the documentation[1]. Very dangerous default that few developers realize is a problem. You probably only want 80/443 open and proxy your subdomains on the host, but all ports are now exposed to the internet.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by HankB99 on Wednesday May 29, 2024 @09:47AM
(#40511967)
> Any port you map on the host will be opened in nftables ...
That rates a "Wow!" but seems like something more important to Enterprise/Cloud. It seems like it would be a Bad Thing to open a port because a DB server ran in a different container. That's not something that should be opened unless the DB is on a different host (VM) from an application that uses the DB.
In my case I have a firewall/router protecting my home LAN and don't generally run firewalls on individual hosts.
Re:Root your Docker host in 10 seconds for fun and profit (2...
by worksonmine on Wednesday May 29, 2024 @09:57AM
(#40512086)
Any website you visit on your home network could do a portscan on the local network and figure out what you're hosting. Hackers are creative. Chrome has some mitigations against this but unfortunately not Firefox last time I checked. Do you have any IoT devices? Smart TV?
It's always a good idea to lock down everything you can and avoid unsafe defaults. If podman causes any friction there's most likely a good reason behind it. For me there are none and I've lost count of the containers I'm running.
This is a by design part of Docker's operation. What's perhaps a little more surprising (though it shouldn't be) is that anyone with create pod rights in a k8s cluster can do this by default on every worker node in the cluster. (unless the cluster operator or provider has implemented additional controls)
https://docs.docker.com/engine/install/linux-postinstall/
Creating a docker group and adding the user to the docker group to avoid sudo is more of a convenience thing, and the implication seems to be well documented now - https://docs.docker.com/engine/install/linux-postinstall/
so if someone sacrificed convenience over security, I think the authors can't do much.
Also I think there's no such thing as secure vs non-secure product, instead its levels of security.
I mean they could ship rootless docker by default, like podman defaults to rootless (or other by now possible more secure non default setups).
Also if you care you probably want to combine rootless (or non-rootless but still user namespace using) docker with a linux secure module setup like SELinux, as it can make security vulnerabilities in rootless docker (and well docker in general) much harder to exploit.
Upstream doesn’t support that configuration as default and it will likely break all the docker tutorials online that assume a rootful daemon. (A quick example: google “Jenkins docker integration” and it will likely tell you to pass through the docker socket)
Hence package maintainers don’t want to take the burden of maintaining that.
also to quote that documentation:
> By default, the Docker Pipeline plugin will communicate with a local Docker daemon, typically accessed through docker.sock.
which means that iff they do it right it will just work frictionless. Rootless docker still has a local socket and in a proper setup $DOCKER_HOST is used to point to it. $DOCKER_HOST is used the docker command, and any other application which communicates with the docker socket instead MUST handle it or it's a pretty big bug even in the absence of rootless.
And again you don't need rootless, you can also configure user namespaces with rootfull docker. Which isn't fixing all issues for all use cases, but fixes the ones which are an security issue for Jenkins.
In general the only place where a default docker setup can be security wise acceptable is where it's acceptable to always explicitly use sudo, e.g. no developer setup. Which mainly leaves use cases like using it for long running manual managed services, but then using podman instrumented through systemd (systemd directly supports OCI images as services) is still most times preferable.
then yes :)
https://docs.docker.com/engine/security/rootless/
Noteworthy alternate: podman
"Rootless containers allow you to contain privileges without compromising functionality."
Can you suggest any preferred alternative methods of isolation that offer similar efficacy and ease of use for quickly running complete software systems made by an unknown/untrusted actor?
It can. I think it's fair to assume that the standard developer setup to let them be productive is not this proper configuration.
> Can you suggest any preferred alternative methods of isolation that offer similar efficacy and ease of use for quickly running complete software systems made by an unknown/untrusted actor?
No. It's a hard problem! If it was easily solved we wouldn't be seeing all this development surrounding e.g. WebAssembly
While I agree that Docker as written isn’t good at security, your post has big “they’re holding the iPhone wrong!” vibes — and seemingly ignores the historic reasons that people would think it provides security.
More like "it just isn't meant to be used for that". At least not in the default configuration, and that's fine!
> seemingly ignores the historic reasons that people would think it provides security
I've been using docker since it was announced. People have always been very clear that docker is not a security boundary, at least not with its default configuration.
I’ve also used it since the beginning and that’s some mighty strong revisionism.
Docker was compared to VMs — with a tiny asterisk of fine print that it’s not actually configured to employ security features it’s built with.
By certain people, yes. They have always been wrong. Never by the docker team themselves.
> Disclaimer: There is no actual profit. That was just one of those clickbaity things everybody seems to like so much these days. Also, it’s not really fun. Alright, on with the show!
http://phrack.org/issues/49/1.html
It's sometimes called 'listing paper', as it was commonly used to print out listings of your code :
https://www.reddit.com/r/nostalgia/comments/noi8xm/dot_matri...
Hmm, wonder what became of my Epson MX80. Much fonder memories than the printers that came after it....
Often the holes for the tractor feed were also separated from the main part of the page by a perforation so that one could tear it off to leave a more-or-less pristine letter (or A4 over here) page of content.
Fiddling with the left-over narrow strips of hole-punched edging paper was one of those universal habits that you don't even notice until long after it's gone.
(Edit: _a_ I just realised I replied to the wrong parent post and _b_ now I'm wondering if you're somebody I know!)
As Pratchett said, "We've all passed a lot of water since those days..." :D
I remember being amazed when I discovered that there was this a system, called GNU/Linux, where everything you need was already packaged and easy to install.
Then came the Maven, npm & co.
Docker (and containers) is basically an universal package manager that was fulled by the success of open source, the arrival of a lot of new people (working on Mac and Windows) in that space and the adoption of the cloud. Docker Hub became the open source "app store".
The crime is the misleading term "container" because I bet a majority of people assume there is some security guarantee by design, what is absolutely false.
Actually container security is pretty hard and a most people don't really care because it doesn't run on their computer but in the cloud.
My guess is something like Kata containers, compatible with the container standards while leveraging hardware virtualization technology will prevail. Or a cleaner system, similar to NixOS/Guix but easier to use, will appear.
Rootless docker is still not the default choice somehow.
Podman however has been working rootlessly for a few years now, and does not suffer from many of the docker shortcomings.
Would you care to elaborate on the shortcomings? I use Docker in my home lab and have taken a couple runs at Podman but have not been highly motivated and reverted to Docker rather than fiddle with things to get my containers working. If I were aware of significant benefits for my usage, I might be inclined to keep trying. If the benefits are more relevant to enterprise or cloud environs, it probably does not matter much to me.
My use cases include Gitea (git server) which opens privileged ports inside the container that get mapped to unprivileged ports on the host and I believe that was a problem area.
Thanks!
You can either allow those ports to be mapped on your host, or you can map a higher port on the host 8000:80 or 4443:443. I did the former.
The biggest problem I have with docker other than root is that it touches the firewall for convenience. Any port you map on the host will be opened in nftables, as per the documentation[1]. Very dangerous default that few developers realize is a problem. You probably only want 80/443 open and proxy your subdomains on the host, but all ports are now exposed to the internet.
[1]: https://docs.docker.com/network/#published-ports
That rates a "Wow!" but seems like something more important to Enterprise/Cloud. It seems like it would be a Bad Thing to open a port because a DB server ran in a different container. That's not something that should be opened unless the DB is on a different host (VM) from an application that uses the DB.
In my case I have a firewall/router protecting my home LAN and don't generally run firewalls on individual hosts.
It's always a good idea to lock down everything you can and avoid unsafe defaults. If podman causes any friction there's most likely a good reason behind it. For me there are none and I've lost count of the containers I'm running.