Don't expose the Docker socket directly to an internet-accessible container #105
Labels
No labels
Blocked
Existing Service
Infrastructure Issue
Refactor
Security Hardening
Security Issue
Service Idea
Service Removal
Upgrade service
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: data.coop/ansible#105
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Consider using docker-socket-proxy[1] for exposing the Docker socket to nginx-proxy, so that we can restrict what it has access to.
1: https://github.com/Tecnativa/docker-socket-proxy
From what I can see, the only access we would need for nginx-proxy to work properly would be
CONTAINERS=1
. Furthermore, we can allow onlyGET
requests, so the socket will be read-only.Hmm. I wonder why it re-exposes the socket as a tcp socket. Can't we use unix domain sockets for the proxy?
Ideally, we would be able to furhter restrict the environment variables nginx-proxy can read as the environment variables are used for secrets as well.
I haven't looked into it yet, but I don't think so. @valberg suggested this approach as an alternative: https://github.com/nginx-proxy/nginx-proxy#separate-containers
I thought about that too, unfortunately I don't think it's possible.
@reynir actually now that I think about it, it might be better to use the approach suggested by @valberg. This way, even if a container has full access to the Docker socket, it will not be the container that's accessible over the internet.
The other approach with docker-socket-proxy still exposes the environment variables of all containers to an internet-accessible container, and as you said, we have our secrets there.
Use docker-socket-proxy for enhanced securityto Don't expose the Docker socket directly to an internet-accessible container