Add an Ansible role to install the proxy as a hardened systemd service
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 12/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 领域
- devops, infrastructure
调研方向
The proxy's policy loading is in go/internal/policy/manager.go, and the README's systemd Service section shows the manual install that the role would automate. The work is a new Ansible collection under ansible/ with one role, plus tests in ansible/tests/ that run against a real Docker daemon. Done means the role installs and verifies the binary, writes policies and a hardened unit, restarts on change, and the test suite passes with ansible-lint and --syntax-check in CI.
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem?
There is no supported way to install the proxy on a host. The README's systemd Service section lists manual commands and a minimal unit. Every consumer must write the same install: the pinned binary and its checksum, the service account and its groups, the policy files and their modes, a hardened unit, log rotation, and a restart when a policy changes. Some details are easy to get wrong:
- The proxy reads its policies only at startup (
go/internal/policy/manager.go). A changed policy with no restart is a silent no-op. - The proxy ignores unknown policy keys. A misspelled key loads without an error and enforces nothing.
- The proxy can give its socket only to a group that it belongs to. Without that membership, startup fails.
- The proxy opens the audit log once and never reopens it. A rotation by rename leaves it writing to the rotated file.
lodestar-infrastructure is the first consumer (ChainSafe/lodestar-infrastructure#64, the spec in ChainSafe/lodestar-infrastructure#9). The install is not specific to Lodestar.
Describe the solution
Add an Ansible collection, chainsafe.docker_socket_policy, under ansible/. It contains one role, docker_socket_policy. Consumers install it from this repository at a release tag (git+https://github.com/ChainSafe/docker-socket-policy.git#/ansible/). The role:
- installs the Go or Rust release binary for amd64 or arm64, and checks it against the sha256 digest that GitHub publishes for the asset;
- creates a system account in the Docker group and the socket group;
- writes one policy per entry,
root:<group> 0640, and removes policy files that it does not manage; - rejects unknown or unenforced policy keys (
ports,user_id,group_id), and rejects overlapping service or container names; - writes a unit with
ProtectSystem=strict,RestrictAddressFamilies=AF_UNIX, an empty capability set,MemoryDenyWriteExecute=trueandUMask=0027; - restarts the proxy when a policy, the binary or the unit changes;
- writes a logrotate rule with
copytruncate.
ansible/tests/ installs the role with two test policies that share one image, then sends real requests through the proxy to a real daemon on a disposable host. The tests cover denied mounts, groups, namespaces, capabilities, devices, inherited mounts, policy confusion, lifecycle on unmanaged containers, exec, update, path tricks and pulls. They also check the forced values and socket access by group. CI runs ansible-lint and --syntax-check.
Describe alternatives
- A role in
ChainSafe/ansible-collection(chainsafe.general). Rejected: the policy schema changes with proxy releases (container_namesin v0.5.0,group_addin v0.6.0). A role in this repository is versioned and tested with the binary that it installs. - A role in lodestar-infrastructure's
lodestar-collection. Rejected: the install is not specific to Lodestar. - Keep the README commands only. Rejected: every consumer repeats the details above.
Which implementation(s) would this affect?
- Go (installs the Go binary)
- Rust (installs the Rust binary)
- TypeScript (released as a tarball that needs Node; the role does not install it)
- Quint specification
- All
Additional context
No proxy code changes. The first release that contains ansible/ would be the first version that consumers can pin.
- 主要语言
- Rust
- 星标
- 2
- 派生
- 0
- 平均合并
- 12 小时 11 分钟
- 30 天内合并 PR
- 30
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ChainSafe/docker-socket-policy 的其他 Issue
-
Priority: P3 Type: Enhancement
难度 4/5 3-5 天 新手友好度 15/100
ChainSafe/docker-socket-policy#95 ·
维护者通常 1 天内回复
-
Type: Feature
难度 5/5 一周以上 新手友好度 25/100
ChainSafe/docker-socket-policy#65 ·
维护者通常 1 天内回复
-
Type: Enhancement
难度 5/5 一周以上 新手友好度 38/100
ChainSafe/docker-socket-policy#46 · 1 条评论 ·
维护者通常 1 天内回复
查看 ChainSafe/docker-socket-policy 的全部 Issue
相似的 Issue
-
[1.x Bug] run-operation --sql reports success but rolls back writes on transaction-capable adapters未关闭triage
难度 2/5 1-3 小时 新手友好度 64/100
维护者通常 1 天内回复
-
area:cli bug good first issue priority:medium
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
bnv-manager-v2: accept_invite creates the Mailcow domain admin before the commit可能已有人在做 @myOmikron 今天认领。 未关闭bug ready-for-agent
难度 2/5 1-3 小时 新手友好度 82/100
-
platform:windows tool triaged wontfix
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
resources: add a regression test confirming admin mint still works after the #16 SAC handoff可能已有人在做 @Daniexie 今天认领。 未关闭contracts good first issue Stellar Wave
难度 2/5 1-3 小时 新手友好度 72/100
OlaGreat/starbound-realms#137 · 1 条评论 ·