Giter Site home page Giter Site logo

datadotworld / docker-filter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datadog/docker-filter

0.0 1.0 0.0 16 KB

Filtering proxy for a read-only access to the Docker socket

License: Apache License 2.0

Shell 2.56% Python 88.95% Dockerfile 8.50%
dwstruct-t04-infra

docker-filter's Introduction

Datadog Docker socket filter

Filtering proxy for a read-only access to the Docker socket, based on HAProxy.

CircleCI

Quick start

See sample docker-compose file.

Why?

The Docker engine does not currently offer any monitoring interface (to list and inspect containers / images / volumes) other than the management socket. This API is pretty stable and allows our agents to get reliable data, but it comes with a severe security risk: all commands sent to it are executed with root privileges. An attacker could use that as a privilege escalation mechanism.

The authorization subsystem tries to solve this issue by enabling a rule-based authorization workflow, but it has several shortcomings:

  • it requires SSL client certificate authentication, which is currently not supported on the unix socket, potentially breaking orchestrators and third party software assuming access to /var/run/docker.sock
  • it is not self-contained in the Docker engine, but requires the sysadmin to install and configure a third-party software
  • if no certificate chain is already setup, creating one for that use case is a big hurdle

This is why this container aims at providing a simpler solution.

How?

The Docker management API is a standard HTTP REST API, which can be filtered through a filtering HTTP proxy. This container uses HAProxy to provide a read-only access to the API, via a socket created in the shared volume mounted in /safe-docker. Our provided configuration:

  • only allows GET/HEAD requests, as all requests that modify the state of an object are either POST, PUT or DELETE
  • passes URLs through a whitelist to forbid access to endpoints that might be exploited to escalade access (attach via a websocket) or enable DoS attacks (disk/network intensive read-only operations)

The remaining endpoints are deemed safe for use and are accessible on the safe socket. This socket can then be exposed to monitoring software.

Troubleshooting

Inside the docker-filter container you should be able to access haproxy.sock, see https://www.datadoghq.com/blog/how-to-collect-haproxy-metrics/#socket-communication to know more about how to use it to troubleshoot haproxy.

docker-filter's People

Contributors

achntrl avatar iksaif avatar xvello avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.