You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH,SEC: Create additional sockets with limited permissions #38879
It's unfortunately common for projects to mount the docker socket into (privileged) containers. A configuration option for specifying additional sockets with limited privileges would be fairly simple and would make it easier to do it easily without doing it wrong.
Essentially, in the docker configuration, users would be able to specify the path of an additional socket with a limited set of permissions:
I am aware that there are a number of far more complete RBAC solutions to limiting privileges; but I think creating said additional socket(s) with limited docker API privileges would be a fairly simple improvement that could help avoid granting unnecessarily broad privileges (e.g for easy ACME cert reloads and load balancing).
An example use case: securing the Traefik docker driver:
This role does exactly that: it launches two containers, a traefik one and another to securely provide limited access to the docker socket. It also provides the necessary configuration.
Creates a HAproxy container that proxies limited access to the docket socket
With such a proposed configuration option for additional docker sockets with limited privileges, such an additional docker socket proxy container would be unnecessary.
Thanks for opening; there's been quite some discussions around this (I'll link to some of them), and some attempts on possible implementations, but unfortunately, there was never a consensus on the right approach.
I definitely agree that this is still a desirable feature though (my personal 0.02c).
Detect exposed ports from inside container #3778 Detect exposed ports from inside container (slightly different, but about containers being able to obtain information about itself from the API)
Thank you for the references to earlier discussions.
#27261 (comment) suggests three cap names: (DOCKER_CAP_FORK, DOCKER_CAP_INSPECT, DOCKER_CAP_ADMIN), which may be sufficiently granular.
docker-socket-proxy [1] has:
Access granted by default
These API sections are mostly harmless and almost required for any service that
uses the API, so they are granted by default.
EVENTS
PING
VERSION
Access revoked by default
Security-critical
These API sections are considered security-critical, and thus access is revoked
by default. Maximum caution when enabling these.
AUTH
SECRETS
POST: When disabled, only GET and HEAD operations are allowed, meaning
any section of the API is read-only.
Not always needed
You will possibly need to grant access to some of these API sections, which are
not so extremely critical but can expose some information that your service
does not need.
Activity
westurner commentedon Mar 14, 2019
https://docs.docker.com/glossary/?term=authorization
"Access authorization plugin"
https://docs.docker.com/engine/extend/plugins_authorization/
thaJeztah commentedon Mar 14, 2019
Thanks for opening; there's been quite some discussions around this (I'll link to some of them), and some attempts on possible implementations, but unfortunately, there was never a consensus on the right approach.
I definitely agree that this is still a desirable feature though (my personal 0.02c).
Some earlier discussions;
westurner commentedon Mar 14, 2019
Thank you for the references to earlier discussions.
#27261 (comment) suggests three cap names: (
DOCKER_CAP_FORK,DOCKER_CAP_INSPECT,DOCKER_CAP_ADMIN), which may be sufficiently granular.docker-socket-proxy [1] has:
With the following from haproxy.cfg https://github.com/Tecnativa/docker-socket-proxy/blob/master/haproxy.cfg:
[1] https://github.com/Tecnativa/docker-socket-proxy
westurner commentedon Mar 14, 2019
It appears that #32801 has the longest list; but the only API permission listed is
api.accessin https://github.com/moby/libentitlement as well. moby/libentitlement#67 may also be relevant.