dockerproxy

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package dockerproxy is the read-only Docker Engine API proxy behind `docker: readonly`.

A worker with that grant never receives the Docker socket. The controller runs one Server per worker on a Unix socket inside that session's own socket directory, and the worker's DOCKER_HOST points at it. The Server forwards a fixed allowlist of GET and HEAD endpoints to the controller's own daemon socket and answers everything else with 403 before it reaches the daemon.

What a worker can still learn is deliberate and documented as a capability warning: every container, image, network, and volume on the host, their inspect documents with environment values redacted, resource stats, and the daemon's event stream. It cannot create, change, start, stop, exec into, attach to, or read the logs or files of anything.

Index

Constants

View Source
const (

	// RedactedValue replaces every environment variable value in container and
	// image inspect output. The variable name stays, so a worker can still see
	// which variables are set.
	RedactedValue = "<redacted>"

	// RefusalPrefix starts the message of every refused request.
	RefusalPrefix = "Peen's readonly Docker access refuses this request: "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is one running read-only proxy.

func Start

func Start(
	ctx context.Context,
	socketPath, upstreamSocketPath string,
) (*Server, error)

Start listens on socketPath and forwards allowed requests to the Docker daemon at upstreamSocketPath.

A stale file at socketPath is removed first, because the path belongs to one session by construction and a Unix socket file outlives the process that made it. The socket is restricted to the controller's account. The returned Server serves until Close; ctx only scopes its logging.

func (*Server) Close

func (s *Server) Close() error

Close stops accepting, ends every open connection including a streaming /events request, and removes the socket file. It is safe to call more than once and returns the first call's result.

func (*Server) SocketPath

func (s *Server) SocketPath() string

SocketPath is the socket the proxy listens on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL