0
0
Fork 0
mirror of https://github.com/netdata/netdata.git synced 2025-05-03 08:50:02 +00:00

Document CetusGuard as a Docker socket proxy solution ()

* Document CetusGuard as a Docker socket proxy solution

* Re-add Docker Socket Proxy to docs
This commit is contained in:
Héctor Molinero Fernández 2023-04-18 17:39:22 +02:00 committed by GitHub
parent 9dea17ac2d
commit 2e168e9a74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 9 deletions
collectors/cgroups.plugin
packaging/docker

View file

@ -120,8 +120,9 @@ container names. To do this, ensure `podman system service` is running and Netda
to `/run/podman/podman.sock` (the default permissions as specified by upstream are `0600`, with owner `root`, so you to `/run/podman/podman.sock` (the default permissions as specified by upstream are `0600`, with owner `root`, so you
will have to adjust the configuration). will have to adjust the configuration).
[docker-socket-proxy](https://github.com/Tecnativa/docker-socket-proxy) can also be used to give Netdata restricted [Docker Socket Proxy (HAProxy)](https://github.com/Tecnativa/docker-socket-proxy) or [CetusGuard](https://github.com/hectorm/cetusguard)
access to the socket. Note that `PODMAN_HOST` in Netdata's environment should be set to the proxy's URL in this case. can also be used to give Netdata restricted access to the socket. Note that `PODMAN_HOST` in Netdata's environment should
be set to the proxy's URL in this case.
### Charts with zero metrics ### Charts with zero metrics

View file

@ -331,17 +331,17 @@ your machine from within the container. Please read the following carefully.
#### Docker socket proxy (safest option) #### Docker socket proxy (safest option)
Deploy a Docker socket proxy that accepts and filters out requests using something like Deploy a Docker socket proxy that accepts and filters out requests using something like
[HAProxy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-haproxy.md) so that it restricts connections to read-only access to the CONTAINERS [HAProxy](https://github.com/netdata/netdata/blob/master/docs/Running-behind-haproxy.md) or
[CetusGuard](https://github.com/hectorm/cetusguard) so that it restricts connections to read-only access to the `/containers`
endpoint. endpoint.
The reason it's safer to expose the socket to the proxy is because Netdata has a TCP port exposed outside the Docker The reason it's safer to expose the socket to the proxy is because Netdata has a TCP port exposed outside the Docker
network. Access to the proxy container is limited to only within the network. network. Access to the proxy container is limited to only within the network.
Below is [an example repository (and image)](https://github.com/Tecnativa/docker-socket-proxy) that provides a proxy to Here are two examples, the first using [a Docker image based on HAProxy](https://github.com/Tecnativa/docker-socket-proxy)
the socket. and the second using [CetusGuard](https://github.com/hectorm/cetusguard).
You run the Docker Socket Proxy in its own Docker Compose file and leave it on a private network that you can add to ##### Docker Socket Proxy (HAProxy)
other services that require access.
```yaml ```yaml
version: '3' version: '3'
@ -356,13 +356,40 @@ services:
proxy: proxy:
image: tecnativa/docker-socket-proxy image: tecnativa/docker-socket-proxy
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro - /var/run/docker.sock:/var/run/docker.sock:ro
environment: environment:
- CONTAINERS=1 - CONTAINERS=1
``` ```
**Note:** Replace `2375` with the port of your proxy. **Note:** Replace `2375` with the port of your proxy.
##### CetusGuard
```yaml
version: '3'
services:
netdata:
image: netdata/netdata
# ... rest of your config ...
ports:
- 19999:19999
environment:
- DOCKER_HOST=cetusguard:2375
cetusguard:
image: hectorm/cetusguard:v1
read_only: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
CETUSGUARD_BACKEND_ADDR: unix:///var/run/docker.sock
CETUSGUARD_FRONTEND_ADDR: tcp://:2375
CETUSGUARD_RULES: |
! Inspect a container
GET %API_PREFIX_CONTAINERS%/%CONTAINER_ID_OR_NAME%/json
```
You can run the socket proxy in its own Docker Compose file and leave it on a private network that you can add to
other services that require access.
#### Giving group access to the Docker socket (less safe) #### Giving group access to the Docker socket (less safe)
> :warning: Caution > :warning: Caution